Repository navigation
[DO NOT REVIEW] pal_async: report why a driver cannot set up its io-uring - #5278
Merged
Pedro Henrique Penna (ppenna) merged 7 commits intoNov 25, 2026
Conversation
TopologyBuilder::from_cpuid stored the VPs per socket that it derives from the host's CPUID without checking them against the range of 1 to 32768 that the vps_per_socket setter clamps to (microsoft/nvx#1378). A host whose leaf 0Bh core level has an x2APIC shift of 16 or more gave 65536 or more VPs per socket, and topology_cpuid then panicked with "value out of bounds [0, 15]" encoding them into an AMD guest's leaf 80000008h, whose ApicIdCoreIdSize holds the log2 of a socket's reserved VPs in 4 bits. An AMD host without leaf 0Bh, whose leaf 80000008h counts one thread and whose leaf 8000001Eh has a ThreadsPerComputeUnit of 2, gave 1 / 2 = 0, and build() then panicked with "attempt to divide by zero". Both panic in debug and release builds. The standard machine and OpenHCL start from the host's topology, through from_host_topology; the microVM starts from new_x86() and is not affected. from_cpuid now refuses a count outside that range with the new error UnsupportedVpsPerSocket, so such a host's VM fails to start with that error instead of panicking later. It refuses the count rather than clamping it, so that the topology never silently differs from the host's, as it already refuses more than two threads per core with UnsupportedThreadsPerCore. MAX_VPS_PER_SOCKET now names the range's upper bound for the setter and from_cpuid alike, and the setter documents its clamp. Tests, in a new tests module of the x86 topology, feed from_cpuid synthetic host CPUID; vm_topology gains test_with_tracing as a dev-dependency for them. host_vps_per_socket_above_the_range_are_refused checks that an Intel host with a core-level shift of 16 is refused with 65536 and that one with a shift of 15 builds a topology of 32768 VPs per socket. host_vps_per_socket_below_the_range_are_refused checks that the AMD host above is refused with 0 and that one whose leaf 80000008h counts two threads builds a topology of 1. At feature/microvm/dev d44a113, both fail, from_cpuid accepting both hosts; both pass with the fix. A scratch test, not committed, ran these hosts through virt's topology_cpuid. At d44a113, the Intel host's topology panicked there for an AMD guest with "value out of bounds [0, 15]", and the AMD host's build(1) with "attempt to divide by zero", in the dev and release profiles. With the fix, from_cpuid refuses both hosts, and a host with 32768 VPs per socket gives an AMD guest an ApicIdCoreIdSize of 15 without panicking. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Only the hypervisor's APIC suspends a VP that reads HV_X64_MSR_GUEST_IDLE, which a save then records as the Hyper-V idle MP state. The user-mode APIC, which `whp:user_mode_apic` selects, as does `no_enlightenments` with `--hv`, never saves that state, but a snapshot does not record which APIC captured it, so a restore with the user-mode APIC can be given one, and restore_activity then reached `unimplemented!()` and aborted the VMM. The user-mode APIC cannot hold the state: an interrupt wakes an idle VP even with its interrupts disabled, which a VP that it halts does not take, so restoring the VP as halted would be wrong. restore_activity now refuses the state before it changes anything, with the UnsupportedState error that it returns for the other activity that WHP cannot hold, as virt_kvm refuses the idle state with an error. Test: the WHP case user_mode_apic_refuses_an_idle_vp_hv1, in the suspend module of virt_backend_tests, restores an idle activity into the VP of a partition with the user-mode APIC and Hv1, and requires that the restore fails with UnsupportedState and leaves the activity as it was. The activity differs from the VP's in the pending NMI, which the user-mode APIC keeps, and in the NMI mask and the interrupt shadow, which WHP's registers keep, so the case also fails when restore_activity sets the pending NMI or writes the interrupt state before it refuses the state. On Windows 11 build 26300 with an Intel Core i9-12900H, at d44a113 the case panics at apic.rs:261 with "not implemented", and with this commit it passes, as do the other 26 cases of virt_backend_tests that run on WHP there and the 45 tests of virt_whp. There, a snapshot's restore does not reach the activity: the VP that the hypervisor's APIC saves holds a TSC deadline, which the partition with the user-mode APIC does not support, so restore_all refuses that element first. A saved state without one reaches the activity. The Guide's page on the backend contract tests names the case. cargo check, cargo clippy --all-targets, and cargo doc for virt_whp, cargo clippy --all-targets for vmm_tests, and cargo xtask fmt have no warnings. Refs microsoft/nvx#1475 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
A KVM partition with Hyper-V enlightenments routes the SynIC of each VP through a GSI of its own, VMBUS_BASE_GSI, after the 24 lines of the I/O APIC, plus the VP's index, which build claims in the partition's routing table of NUM_GSIS, 2048, GSIs. Nothing checked the number of VPs against that table, so build, on a host whose KVM allows that many vCPUs, created every vCPU of a partition of more than 2024 enlightened VPs and then panicked in GsiRouting::claim, "index out of bounds: the len is 2048 but the index is 2048", in debug and release builds alike (microsoft/nvx#1377). Only the VM's configuration reaches it, before the guest runs. new_partition now refuses such a configuration before it creates the VM, with the new KvmError::TooManyVps, which names the number of VPs and the limit, MAX_SYNIC_VPS, NUM_GSIS less VMBUS_BASE_GSI, or 2024. A partition without enlightenments, such as an NVX microVM, routes nothing for its VPs, and is not limited. No saved state, format, or version changes. On nvx-kvm-test (Azure Linux 3, Linux 6.18.57, KVM built with CONFIG_KVM_MAX_NR_VCPUS=4096), with RLIMIT_NOFILE raised to 8192, a scratch /dev/kvm test of virt_kvm built partitions at d44a113: one of 2024 enlightened VPs built, one of 2025 enlightened VPs panicked as above, and one of 2025 VPs without enlightenments built. With the fix, new_partition refuses the second with "a partition with Hyper-V enlightenments supports at most 2024 VPs, not 2025", and the others build as before. Tests: a KVM-only contract test of virt_backend_tests, which OpenVMM's CI runs on its KVM hosts, creates partitions without building them, so without creating their VPs, and requires that one of 2025 enlightened VPs is refused with KvmError::TooManyVps, and that one of 2024 enlightened VPs, and one of 2025 VPs without enlightenments, are not. It fails on nvx-kvm-test with the check disabled, and passes with it. The Guide's section on the backend contract tests lists it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
An AP of an SEV-ES or SEV-SNP guest waits in its AP reset hold once the guest asks for it through the GHCB, with the AP Reset Hold VMGEXIT or the GHCB MSR protocol's request, and KVM_GET_MP_STATE then reports KVM_MP_STATE_AP_RESET_HOLD (9). The activity of a VP panicked on any MP state that it did not map, with "unrecognized mp state 9", although it returns a Result, so a save of such a VP, and an inspection of its state (vp/N/vtl0), which both read the activity, aborted the VM worker's process, whose dev and release profiles abort on a panic (microsoft/nvx#1383). Its arm for KVM_MP_STATE_SIPI_RECEIVED, which KVM never reports, was a todo!(). The activity now maps the MP state with mp_state_from_kvm, which keeps the four mappings and refuses every other state with the new KvmError::UnsupportedMpState, which names the VP and the state. KVM wakes an AP in its reset hold as it wakes a halted one, but keeps the guest's request, which an INIT and a SIPI complete instead of starting the AP at the SIPI's vector, so no MP state of the activity describes the hold. A save of such a VP now fails, so a capture rolls back and the guest continues, and an inspection shows the rest of the VP's state without its activity. No saved element, format, or version changes, and a partition without isolation, such as NVX's microVM, never holds a vCPU in the hold. Tests: a unit test maps each MP state that the activity describes, and requires the refusal, with the VP and the state, of the reset hold, of SIPI_RECEIVED, of an aarch64 state, and of an undefined one. A KVM test, ignored for its need of /dev/kvm, binds the second VP of a partition without isolation, puts it in the reset hold with KVM_SET_MP_STATE, which KVM accepts for any vCPU with an in-kernel LAPIC, and requires that its activity and its save fail with the error and that it stays in the hold. On nvx-kvm-test, an Intel Xeon Platinum 8573C VM that runs Linux 6.18.57, the KVM test panicked at d44a113 with "unrecognized mp state 9", and passes with the fix, as do all 156 virt_kvm tests, the ignored ones included. cargo check, cargo clippy --all-targets -- -D warnings, and cargo doc with -D warnings pass for virt_kvm there, and cargo xtask fmt is clean. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
On Intel, topology_cpuid reports in leaf 4 that the VPs of a socket share its L3 cache: cache_parameters_cpuid encodes the topology's reserved VPs per socket, less one, as the number of logical processors sharing the cache, a 12-bit field (EAX[25:14]). The topology builder accepts up to 32768 VPs per socket and reserves that count rounded up to a power of two, so a socket of more than 4096 VPs overflowed the field, and its bitfield setter panicked with "value out of bounds [0, 4095]" in debug and release builds, whatever the VM's VP count (microsoft/nvx#1379). That aborted the creation of a standard VM on an Intel host with KVM, without a time ABI, or with WHP, which build the topology CPUID from the host's, when --vps-per-socket asked for more than 4096 VPs per socket, or when the host topology that the standard VM starts from had that many, as that of a host whose leaf 0Bh core level has an x2APIC shift above 12 does. The microVM, which refuses --vps-per-socket, starts from its own topology, and has at most 8 VPs in its one socket, never reached it, nor did a time ABI partition, which only the microVM has. The count now saturates at the field's maximum, 4096 logical processors, as the core count of the same leaf and the sharing count of AMD's leaf 8000001Dh already do, so the guest of such a socket sees an L3 cache per 4096 APIC IDs. Counts of up to 4096 VPs per socket, and every other field of the leaf, are unchanged, so no CPUID that OpenVMM produced before changes, the time ABI's effective CPUID included. Tests: l3_sharing_saturates_above_4096_vps_per_socket builds the topology CPUID of a VM with one VP and 4096, 4097, or 32768 VPs per socket, with and without SMT, from an Intel and an AMD CPUID, and finds the L3 cache shared by 4096 logical processors and each L1 and L2 cache by the threads of a core. At d44a113, it panics as above on Intel. On Intel hosts, the standard VM with one VP and --vps-per-socket 8192 panicked so at d44a113 on KVM (Xeon Platinum 8573C) and WHP (Xeon Platinum 8370C); with the fix applied there, it starts and runs its guest on both with 8192 and 32768 VPs per socket, as it did with 4096. virt's unit tests pass on Windows and Linux. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
With the APIC that the VMM emulates, as `whp:user_mode_apic` gives it, and as Hv1 without the hypervisor's enlightenments does, every restore of a VP's activity failed, and so did every INIT to an AP. restore_activity wrote the four registers of vp::Activity, the internal activity state among them, and with LocalApicEmulationMode None WHP denies a write of that register with HV_STATUS_ACCESS_DENIED, even of the running state that it holds. So restore_all failed at "activity" for every saved state, even the save of a new VP, and x86_init, which makes an AP wait for a SIPI through set_activity, failed in inject_init, which unwraps the error and aborts the VMM: every multiprocessor guest sends its APs an INIT. hv1_emulator's set_x86_vp_context, which starts a VP for HvCallStartVirtualProcessor, failed the same way. In this mode the VMM keeps the VP's halt and its wait for a SIPI itself, and the hypervisor's internal activity state stays running, which is all that the restore wrote there. restore_activity now writes only the other three activity registers, the pending interruption, the interrupt state, and the pending event, which WHP accepts. Test: the new `user_mode_apic` module of virt_backend_tests registers four cases for `whp_user_mode_apic`, a WHP backend whose APIC the VMM emulates. restores_the_activity_in_each_state restores an activity in each state that the VMM keeps, with an NMI pending, NMIs masked, an interrupt shadow, and a pending exception as both an interruption and an event, and requires that it reads back as given, in the VP and, from a save of it, in a new partition's VP. The interruption is an exception because WHP refuses a pending interrupt with HV_STATUS_INVALID_VP_STATE while RFLAGS.IF is clear, as it is in a new VP. restores_a_new_vp_into_a_new_partition restores a save of a new VP into a new partition, without Hv1 and with it. an_init_makes_an_ap_wait_for_a_sipi sends the AP of a two-VP partition an INIT and then a SIPI, twice, and flushes the AP's requests after each, as the VMM does before it saves a VP, and requires that the INIT makes the AP wait for a SIPI, at its reset RIP, and that the SIPI starts it at the SIPI's vector. The fixture gains build_all, and with_vps for a fixture of more than one VP, for it. The Guide describes the cases. On Windows 11 build 26300 with an Intel Core i9-12900H, at d44a113, the four cases fail: restores_the_activity_in_each_state with "failed to set registers: Access to the specified object was denied. (os error -1070268410)", both cases of restores_a_new_vp_into_a_new_partition with the same error at phase restore "activity", and an_init_makes_an_ap_wait_for_a_sipi with the panic at apic.rs:764 that the issue reports. With this change on d44a113 they pass, as do the other 26 cases of virt_backend_tests that run there (10 report ignored), and the 64 tests of virt_whp, those that need WHP included. cargo clippy --all-targets for virt_whp and vmm_tests, which also passes for virt_backend_tests on x86_64-unknown-linux-gnu, cargo doc, and cargo xtask fmt have no warnings. Refs microsoft/nvx#1472 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
On a heavily loaded Linux host, about one microVM start in eight failed with "driver does not support io-uring" (microsoft/nvx#1909). The epoll driver sets up its io-uring lazily, at its first probe or submission, and dropped the error of that set-up with `.ok()`, so a failed `io_uring_setup`, such as one that fails with ENOMEM, read as a driver without io-uring support, and its errno was lost. `IoUringDriver::io_uring_submitter` and `Driver::io_uring_probe` now return the error that keeps a driver from providing an io-uring: the error of the epoll driver's set-up, or an `Unsupported` error of a driver without io-uring. A failed set-up still leaves the epoll driver without a ring, so its next probe tries again. `disk_blockdevice` fails a device with "failed to set up io-uring" and that error as its source, and a submission through a driver that cannot set up its io-uring fails with that error rather than `Unsupported`. `disk_vmdk` still falls back to its portable reads when the probe fails. With `io_uring_setup` refused with ENOMEM by a seccomp filter, the fatal error of a `nvx sandbox run` on a Linux/KVM host ended with 3: failed to create new device 4: driver does not support io-uring and now ends with 3: failed to create new device 4: failed to set up io-uring 5: Cannot allocate memory (os error 12) Tests: the epoll driver reports the ENOMEM of a refused `io_uring_setup` and sets its ring up at the next probe, and a block device over a driver whose `io_uring_setup` fails names the set-up and its errno. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
This PR modifies files containing For more on why we check whole files, instead of just diffs, check out the Rustonomicon |
This was referenced Nov 25, 2026
Pedro Henrique Penna (ppenna)
added a commit
to microsoft/nvx
that referenced
this pull request
Nov 25, 2026
…the OpenVMM roadmap Map position 385, the commit of microsoft/openvmm#5279, which NVX now pins at 043083f40, 259 commits past the mapped tip, on 44747bf1c, position 384, the head of microsoft/openvmm#5278: - 385, virtiofs: count only shown entries toward a microVM listing's bound. The listing that the first read of a microVM directory handle takes checks its bound of 4,096 entries after the access-policy filter, beside its bound of 64 KiB of names, so that an entry that the policy hides no longer fails with E2BIG a listing whose shown entries fill the bound (#2093). Its test lowers the bound through the new build_microvm_directory_snapshot_within. Position 385 is not yet assigned to a PR. It fixes a defect of PR18's position 083, whose build_microvm_directory_snapshot checked the bound before the filter that skips the entries that PR22's position 102's denied paths and position 160's traverse-only directories hide, but its code follows position 371's loop and its test needs PR22's position 102 and positions 164 and 335, so it is not a PR18 fixup. Positions 160, 330, 346, 349, 354, 355, and 371 also change the microVM's file.rs, and none of positions 372-384 changes its files. Upstream main, 8d4e03132, lacks the defect, since it lacks the microVM's listings, and replaying the commit there conflicts in the microVM's file.rs and fs_tests.rs, which upstream main lacks, so it cannot go upstream on its own. The Scope also names the head of feature/microvm/dev, fa239c823, since microsoft/openvmm#5275, microsoft/openvmm#5276, and microsoft/openvmm#5277 landed positions 381-383. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pedro Henrique Penna (ppenna)
merged commit Nov 25, 2026
44747bf
into
feature/microvm/dev
104 of 105 checks passed
5 tasks done
Pedro Henrique Penna (ppenna)
deleted the
copilot/nvx-issue-1909-io-uring-start
branch
November 25, 2026 05:57
syeedali
pushed a commit
to syeedali/nvx
that referenced
this pull request
Nov 25, 2026
On a heavily loaded Linux/KVM host, about one microVM start in eight failed with "driver does not support io-uring" (microsoft#1909). The epoll driver sets its io-uring up lazily, and dropped the error of a failed io_uring_setup, such as ENOMEM, so a microVM sandbox block, which is a block-device disk on Linux, read a set-up that failed as a driver without io-uring support, and its errno was lost. Pin 44747bf1cc13d53ab10f987b6074c6d77c005d4a, the head of microsoft/openvmm#5278, one commit on fa239c823, the head of microsoft/openvmm#5277, which NVX pins below this commit: - pal_async: report why a driver cannot set up its io-uring. IoUringDriver::io_uring_submitter and Driver::io_uring_probe return the error that keeps a driver from providing an io-uring: the error of the epoll driver's set-up, which its next probe tries again, or an Unsupported error of a driver without io-uring. disk_blockdevice fails a device with "failed to set up io-uring" and that error as its source, and a submission through a driver that cannot set up its io-uring fails with that error. Two tests refuse io_uring_setup with ENOMEM through a seccomp filter. A sandbox start whose io-uring set-up fails still fails, and its OpenVMM log now ends with 4: failed to set up io-uring 5: Cannot allocate memory (os error 12) No saved state, protocol, ABI, or format, and no version of any of them, changes. NVX needs no coordinated change: the protocol vectors, the source excerpts, the contract versions, and the CPU profiles that nvx copies from OpenVMM match the revision's. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
syeedali
pushed a commit
to syeedali/nvx
that referenced
this pull request
Nov 25, 2026
Map position 384, the commit of microsoft/openvmm#5278, which NVX now pins at 44747bf1c, 258 commits past the mapped tip, on fa239c823, position 383, the head of microsoft/openvmm#5277: - 384, pal_async: report why a driver cannot set up its io-uring. IoUringDriver::io_uring_submitter and Driver::io_uring_probe return the error that keeps a driver from providing an io-uring, which the epoll driver dropped with .ok(), so that disk_blockdevice fails a device whose driver cannot set up its io-uring with "failed to set up io-uring" and the errno of io_uring_setup, rather than with "driver does not support io-uring" (microsoft#1909). Two tests refuse io_uring_setup with ENOMEM through a seccomp filter. No earlier chain commit changes its files but Cargo.lock, whose 42 earlier changers, mapped PRs' among them, change neither the entry of pal_async nor that of disk_blockdevice, to each of which it adds seccompiler. The dropped error is upstream's, since microsoft/openvmm#3271, so the commit changes no line that a mapped PR adds, is no fixup, and stays unassigned. Of positions 369-383, only positions 370 and 378 change one of its files, other packages' entries of Cargo.lock. Replaying it on upstream main, 8d4e03132, applies without conflicts, and its six packages type-check there for x86_64-unknown-linux-gnu with their tests, so it can go upstream on its own. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
syeedali
pushed a commit
to syeedali/nvx
that referenced
this pull request
Nov 25, 2026
A microVM's virtio-fs listing of a host directory whose shown entries, `.` and `..` included, filled a handle's 4,096 entries failed the guest's first FUSE_READDIR or FUSE_READDIRPLUS of the handle with E2BIG when the host listed an entry that the share's access policy hides after them, and listed them all when the host listed it first, so the outcome depended on the host's enumeration order, which the guest cannot control (microsoft#2093). A guest's busybox `ls -a` of such a share printed nothing. The listing checked its bound of 4,096 entries before the policy filter, so a hidden entry counted toward it. Pin microsoft/openvmm 043083f4059c7dfda9d021a8cf983ac65017c91e, the head of microsoft/openvmm#5279, one commit on 44747bf1c, the head of microsoft/openvmm#5278, which NVX pins below this commit: - virtiofs: count only shown entries toward a microVM listing's bound. The check of the 4,096 entries per handle runs after the policy filter, beside the check of 64 KiB of names, so only the entries that the guest can list count toward either bound, and a 4,097th of them still fails the listing with E2BIG. Its test fails without the fix, for the file that the host lists last, and passes with it, on Windows and Linux. The virtiofs package's tests pass at the pin on Windows, and on Linux at 5066e2c84, the same commit on d44a113be before its rebase onto microsoft/openvmm#5278 and the commits below it, which touch none of its files. In an Alpine guest of release v0.1.0-dev.86984fe72c05, whose OpenVMM CI built from d44a113be, `ls -a` of a read-only share of 4,095 files whose policy hides the last file that the host lists printed no name, on KVM (nvx-kvm-test, ext4) and on WHP (Windows 11, NTFS). With OpenVMM built from the fix, 5066e2c84 on KVM and the pinned 043083f40 on WHP, it printed all 4,096 names, and the filesystem-shares, filesystem-snapshot, filesystem-policy, filesystem-owner, denied-filesystem-paths, filesystem-comma-paths, platform-filesystem, and platform-aggregate-export scenarios passed on KVM. No saved-state, protocol, or ABI format, and no version of any of them, changes. The protocol vectors and CPU profiles that nvx copies are unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pedro Henrique Penna (ppenna)
added a commit
to microsoft/nvx
that referenced
this pull request
Nov 25, 2026
…M roadmap Map position 389, the commit of microsoft/openvmm#5281, which NVX now pins at 350018ce4, 263 commits past the mapped tip, on 1633b3797, position 388, the head of feature/microvm/dev since microsoft/openvmm#5280 landed positions 386-388: - 389, virtiofs: let a new microVM object take the last node ID. The insert of the node of an object that FUSE_MKDIR, FUSE_MKNOD, FUSE_SYMLINK, or FUSE_CREATE makes, with the node ID that the request reserved before it made the object, no longer requires that the table can hand out another node ID, so that the object takes the last node ID, u64::MAX - 1, rather than stay on the host without a node after the request fails with ENOSPC (#2135). The inode and alias limits still apply to that insert. Position 389 is a PR18 fixup. It fixes a defect of PR18's position 081, whose InodeReservation::insert check required another free node ID, which position 083's restore makes reachable and position 350 moved to u64::MAX - 1, and it needs nothing that a later position adds but, for its test, position 350's table and position 164's helpers. Fold it into position 081, where its changes of lib.rs and limits.rs apply as they are, as git merge-tree shows, and its test into position 350, where only the imports conflict: at 301937559, position 350, with the fix and the test so placed, the virtiofs tests pass on Windows, and without the fix the test fails. The Scope, the DAG, the fold sentences, the PR summary, the dependency graph, and the commit mapping record the fixup. Of positions 372-388, only 385 changes one of its files, fs_tests.rs. Upstream main, 8d4e03132, lacks the defect, since it lacks the microVM's limits, and replaying the commit there conflicts in lib.rs and in the microVM's limits.rs and fs_tests.rs, so it follows PR18 upstream. The Scope also records that microsoft/openvmm#5277, microsoft/openvmm#5278, microsoft/openvmm#5279, and microsoft/openvmm#5280 have landed positions 383-388 on feature/microvm/dev. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Aaqibhafeez Khan (Aaqibhafeezkhan)
pushed a commit
to Aaqib-OSS/nvx
that referenced
this pull request
Nov 25, 2026
…enVMM roadmap Map positions 386-388, the commits of microsoft/openvmm#5280, which NVX now pins at 1633b3797, 262 commits past the mapped tip, on 043083f40, the head of microsoft/openvmm#5279, whose position 385 follows position 384, 44747bf1c, the head of microsoft/openvmm#5278, whose position follows position 383, fa239c823, the head of feature/microvm/dev since microsoft/openvmm#5277 landed it: - 386, vmm_core: forget a debugger's halt reports when it detaches. A detach clears halt_reported, which the next session's first resume took for the debugger continuing from a halt recorded after the detach, and reports the recorded halt to the client only when the halt went to the debugger instead, which position 150's record_halt now records through DebuggerState::route_halt. - 387, vmm_core: clear VP debug state on detach only if the debugger set it, since the ARM64 backends of KVM and OpenHCL panic on any request to set it. - 388, debug_worker: detach the debugger when its session ends. The stub attaches through a guard that sends DebugRequest::Detach when it is dropped, however the session ends, and forgets the session's hardware breakpoints; the Guide's gdbstub page says what a detach does. They are not fixups and stay unassigned to a PR: the missing detach and the defects of its handling are upstream's, and positions 150 and 372, whose record_halt line and debugger tests they change or extend, are not assigned to PRs. In partition_unit/debug.rs, they change upstream's handling of Detach and SetDebugState, beside position 372's hold, not the halt reasons that position 054 maps. No chain commit changes the debug worker, and none of the 43 that change Cargo.lock changes the entry of debug_worker. Of positions 373-385, only 378 and 384 change one of their files, other packages' entries of Cargo.lock. Replaying them on upstream main, 8d4e03132, conflicts in partition_unit.rs, partition_unit/debug.rs, and debug_rpc.rs, which lack the code of positions 150 and 372, so they cannot go upstream on their own. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs microsoft/nvx#1909.
Stacked on #5277: this branch holds its commit,
fa239c823, which follows the head offeature/microvm/dev,acfaa5199, since #5271, #5272, #5273, #5275, and #5276 landed, and one commit of its own on top of it,44747bf1c. Review only that last commit; #5277 covers the other.NVX pins the head of this branch,
44747bf1cc13d53ab10f987b6074c6d77c005d4a, in microsoft/nvx#2119, which is stacked on microsoft/nvx#2118, the NVX pull request of microsoft/nvx#1472 that pins #5277. This pull request is therefore a prerequisite of microsoft/nvx#2119. It lands after #5277, by fast-forwardingfeature/microvm/devto that exact commit, not with the merge button, which squashes.What and why
On a heavily loaded Linux/KVM host, about one microVM start in eight failed with this fatal error, which named no cause:
On Linux a microVM sandbox block is a
BlockDeviceDiskHandle, andBlockDevice::new(disk_blockdevice) probes its driver's io-uring. The epoll driver (support/pal/pal_async/src/unix/epoll.rs) sets its io-uring up lazily, at the first probe or submission, and dropped the error of that set-up with.ok(). A failedio_uring_setup, such as one that fails withENOMEM, so read as a driver without io-uring support, and its errno was lost.IoUringDriver::io_uring_submitternow returnsio::Result<&Submitter>andDriver::io_uring_probereturnsio::Result<bool>: the error that keeps a driver from providing an io-uring, which is the error of the epoll driver's set-up, or anUnsupportederror of a driver without io-uring (LocalDriver). Thepal_uringand OpenHCL threadpool drivers always have their ring, andvmcore's task drivers forward the result. A failed set-up still leaves the epoll driver without a ring, so its next probe tries again, as before.disk_blockdevicefails a device with a newNewDeviceError::IoUringSetup,failed to set up io-uring, whose source is the driver's error.NoIoUringnow means only a ring withoutIORING_OP_READ.Unsupported.disk_vmdkstill falls back to its portable reads when the probe fails.The device does not fall back to the blocking
FileDiskwhen the set-up fails: that disk presents other geometry and features to the guest (its physical sector size, discard, FUA), which would then depend on the host's load, and a snapshot's restore would meet a device unlike the captured one. The error now says why the start failed, and NVX quotes it (microsoft/nvx#1909).No saved state, protocol, ABI, or format, and no version of any of them, changes.
Tests
Both tests refuse
io_uring_setupwithENOMEM, as a host under memory pressure can, through a seccomp filter on a thread of their own.seccompiler, a workspace dependency thatpalalready uses, becomes a Linux dev-dependency ofpal_asyncanddisk_blockdevice.pal_async'suring_setup_failure_is_reported_and_retried: the epoll driver's probe fails withENOMEMon that thread, and the next probe, on the test's thread, sets the ring up.disk_blockdevice'sio_uring_setup_failure_names_its_error: a device over a driver whoseio_uring_setupfails has the error chainfailed to set up io-uring,Cannot allocate memory (os error 12).Validation
On nvx-kvm-test (Azure Linux 3, kernel 6.18, x86_64, KVM), with the fix on
d44a113be, the head offeature/microvm/devbefore this stack:cargo check,cargo clippy --all-targets, andcargo doc --no-depsofpal_async,pal_uring,underhill_threadpool,vmcore,disk_vmdk, anddisk_blockdevicehave no warnings, andcargo nextest run --profile agentof them passes 124 tests (1 skipped: the loop-device test, which needs root).cargo xtask fmt --fixchanges nothing.d44a113bewith the newdisk_blockdevicetest alone, it fails withleft: ["driver does not support io-uring"]; after, both new tests pass. Thepal_asynctest needs the new signature, so it does not build before the fix.sandbox runof the Ubuntu distro layer whoseio_uring_setupa seccomp filter refuses withENOMEMended its log with4: driver does not support io-uring, and now with4: failed to set up io-uringand5: Cannot allocate memory (os error 12), or with5: Operation not permitted (os error 1)forEPERM. Runs without the filter boot as before.The rebase onto #5277 applied without conflicts: #5271 to #5277 change none of these packages or their dependencies, and
Cargo.lockgains their one unrelated line beside these two, whichcargo metadata --lockedaccepts.git range-difffinds the rebased commit identical to the one validated above. This head's CI run, 45527006004, passedunit tests [x64-linux],unit tests [x64-windows], andrun vmm-testsonx64-linux-amd-kvm,x64-linux-intel-mshv,x64-windows-intel, andx64-windows-amd.Alone on upstream main,
8d4e03132, the commit applies without conflicts, andcargo check --target x86_64-unknown-linux-gnu --all-targetsof its six packages passes there, so it could go upstream on its own.