-
Notifications
You must be signed in to change notification settings - Fork 1.6k
WSLA: Switch VHD boot disk approach and support PMEM for VHD disks #13943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/wsl-for-apps
Are you sure you want to change the base?
WSLA: Switch VHD boot disk approach and support PMEM for VHD disks #13943
Conversation
OneBlue
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change looks good, I'd be curious to see what the performance difference is with pmem vs scsi before making it the default though
Also do we know if there are versions of Windows that don't support it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR switches from using SCSI to PMEM for attaching the root VHD and kernel modules VHD that are known at VM boot time. The key benefits are: (1) device paths are known upfront without needing to query the guest, eliminating a round-trip communication step; (2) VHD attachment issues occur at VM creation time rather than during runtime, improving error detection.
Key Changes
- Added PMEM device structures to HCS schema (VirtualPMemDevice, VirtualPMemController, and related enums)
- Modified VM initialization to attach root and kernel modules VHDs via PMEM instead of SCSI
- Updated ConfigureMounts to accept device paths as parameters rather than discovering them via AttachDisk
- Consolidated security descriptor construction to use std::format for improved readability
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/windows/common/hcs_schema.h | Added PMEM device schema definitions (VirtualPMemDevice, VirtualPMemController, VirtualPMemImageFormat, VirtualPMemBackingType) and integrated them into the Devices struct |
| src/windows/wslaservice/exe/WSLAVirtualMachine.h | Updated ConfigureMounts signature to accept root and modules device paths as parameters |
| src/windows/wslaservice/exe/WSLAVirtualMachine.cpp | Implemented PMEM controller initialization, moved VHD attachment to VM creation time with deterministic device paths (/dev/pmem0, /dev/pmem1), and refactored ConfigureMounts to use provided device paths instead of AttachDisk calls |
|
@benhillis I've opened a new pull request, #13944, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@benhillis I've opened a new pull request, #14006, to work on those changes. Once the pull request is ready, I'll request review from you. |
This PR introduces support for attaching VHDs (Virtual Hard Disks) as persistent memory (PMEM) devices in WSL, controlled by a new feature flag. It refactors how virtual disks are attached and mounted, adds new schema definitions for PMEM devices, and simplifies the mounting logic by integrating it directly into the VM creation JSON.