Skip to content

Conversation

@benhillis
Copy link
Member

@benhillis benhillis commented Dec 19, 2025

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.

Copilot AI review requested due to automatic review settings December 19, 2025 20:24
@benhillis benhillis requested a review from a team as a code owner December 19, 2025 20:24
Copy link
Collaborator

@OneBlue OneBlue left a 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 ?

Copy link
Contributor

Copilot AI left a 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

Copy link
Contributor

Copilot AI commented Dec 19, 2025

@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 benhillis changed the title WSLA: Switch to using PMEM for readonly VHDs that are added at boot WSLA: Switch VHD boot disk approach and support PMEM for VHD disks Dec 20, 2025
Copy link
Contributor

Copilot AI commented Dec 31, 2025

@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.

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.

3 participants