Skip to content

Commit

Permalink
Create UVM honoring NUMA configuration parameters (#2198)
Browse files Browse the repository at this point in the history
* Expose NUMA config to containers. Use HCS device affinity so that UVM is configured on same NUMA node as the device. Expose SLIT configuration to UVM to gather NUMA node distances.

Signed-off-by: Apurv Barve <apurvbarve@microsoft.com>

* Fixing lint errors

Signed-off-by: Apurv Barve <apurvbarve@microsoft.com>

* Fix linter errors

Signed-off-by: Apurv Barve <apurvbarve@microsoft.com>

* Addressing review comments

Signed-off-by: Apurv Barve <apurvbarve@microsoft.com>

* Addressing review comments

Signed-off-by: Apurv Barve <apurvbarve@microsoft.com>

* Schema changes

Signed-off-by: Apurv Barve <apurvbarve@microsoft.com>

* OS build version check

Signed-off-by: Apurv Barve <apurvbarve@microsoft.com>

* Removing some checks not required for container platform

Signed-off-by: Apurv Barve <apurvbarve@microsoft.com>

* Removing a TODO comment

Signed-off-by: Apurv Barve <apurvbarve@microsoft.com>

* Conditionalize setting PropagateNumaAffinity for newer OS build only

Signed-off-by: Apurv Barve <apurvbarve@microsoft.com>

* Changing variable name from propagationEnabled to propagateAffinity for better readability

Signed-off-by: Apurv Barve <apurvbarve@microsoft.com>

* Modifying comment and not initializing pointer as it happens implicitly.

Signed-off-by: Apurv Barve <apurvbarve@microsoft.com>

---------

Signed-off-by: Apurv Barve <apurvbarve@microsoft.com>
  • Loading branch information
apurv15 committed Jul 17, 2024
1 parent d69c26d commit 8ad5a97
Show file tree
Hide file tree
Showing 27 changed files with 565 additions and 118 deletions.
49 changes: 0 additions & 49 deletions internal/hcs/schema2/memory_2.go

This file was deleted.

21 changes: 21 additions & 0 deletions internal/hcs/schema2/memory_backing_type.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Autogenerated code; DO NOT EDIT.

/*
* Schema Open API
*
* No description provided (generated by Swagger Codegen https://github.com/swaggerapi/swaggercodegen)
*
* API version: 2.4
* Generated by: Swagger Codegen (https://github.com/swaggerapi/swaggercodegen.git)
*/

package hcsschema

type MemoryBackingType string

// List of MemoryBackingType
const (
MemoryBackingType_PHYSICAL MemoryBackingType = "Physical"
MemoryBackingType_VIRTUAL MemoryBackingType = "Virtual"
MemoryBackingType_HYBRID MemoryBackingType = "Hybrid"
)
19 changes: 19 additions & 0 deletions internal/hcs/schema2/numa.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Autogenerated code; DO NOT EDIT.

/*
* Schema Open API
*
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* API version: 2.4
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package hcsschema

type Numa struct {
VirtualNodeCount uint8 `json:"VirtualNodeCount,omitempty"`
PreferredPhysicalNodes []int64 `json:"PreferredPhysicalNodes,omitempty"`
Settings []NumaSetting `json:"Settings,omitempty"`
MaxSizePerNode uint64 `json:"MaxSizePerNode,omitempty"`
}
17 changes: 17 additions & 0 deletions internal/hcs/schema2/numa_node.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Autogenerated code; DO NOT EDIT.

/*
* Schema Open API
*
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* API version: 2.4
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package hcsschema

type NumaNode struct {
VirtualNodeIndex uint32 `json:"VirtualNodeIndex,omitempty"`
PhysicalNodeIndex uint32 `json:"PhysicalNodeIndex,omitempty"`
}
19 changes: 19 additions & 0 deletions internal/hcs/schema2/numa_node_memory.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Autogenerated code; DO NOT EDIT.

/*
* Schema Open API
*
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* API version: 2.4
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package hcsschema

type NumaNodeMemory struct {
// Total physical memory on on this physical NUMA node that is consumable by the VMs.
TotalConsumableMemoryInPages uint64 `json:"TotalConsumableMemoryInPages,omitempty"`
// Currently available physical memory on this physical NUMA node for the VMs.
AvailableMemoryInPages uint64 `json:"AvailableMemoryInPages,omitempty"`
}
17 changes: 17 additions & 0 deletions internal/hcs/schema2/numa_node_processor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Autogenerated code; DO NOT EDIT.

/*
* Schema Open API
*
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* API version: 2.4
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package hcsschema

type NumaNodeProcessor struct {
TotalAssignedProcessors uint32 `json:"TotalAssignedProcessors,omitempty"`
TotalAvailableProcessors uint32 `json:"TotalAvailableProcessors,omitempty"`
}
21 changes: 21 additions & 0 deletions internal/hcs/schema2/numa_processors.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Autogenerated code; DO NOT EDIT.

/*
* Schema Open API
*
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* API version: 2.4
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package hcsschema

type NumaProcessors struct {
CountPerNode Range `json:"count_per_node,omitempty"`
NodePerSocket uint32 `json:"node_per_socket,omitempty"`
}

type Range struct {
Max uint32 `json:"max,omitempty"`
}
21 changes: 21 additions & 0 deletions internal/hcs/schema2/numa_setting.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Autogenerated code; DO NOT EDIT.

/*
* Schema Open API
*
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* API version: 2.4
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package hcsschema

type NumaSetting struct {
VirtualNodeNumber uint32 `json:"VirtualNodeNumber,omitempty"`
PhysicalNodeNumber uint32 `json:"PhysicalNodeNumber,omitempty"`
VirtualSocketNumber uint32 `json:"VirtualSocketNumber,omitempty"`
CountOfProcessors uint32 `json:"CountOfProcessors,omitempty"`
CountOfMemoryBlocks uint64 `json:"CountOfMemoryBlocks,omitempty"`
MemoryBackingType MemoryBackingType `json:"MemoryBackingType,omitempty"`
}
23 changes: 0 additions & 23 deletions internal/hcs/schema2/processor_2.go

This file was deleted.

12 changes: 7 additions & 5 deletions internal/hcs/schema2/topology.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
// Autogenerated code; DO NOT EDIT.

/*
* HCS API
* Schema Open API
*
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* API version: 2.1
* API version: 2.4
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package hcsschema

type Topology struct {
Memory *Memory2 `json:"Memory,omitempty"`

Processor *Processor2 `json:"Processor,omitempty"`
Memory *VirtualMachineMemory `json:"Memory,omitempty"`
Processor *VirtualMachineProcessor `json:"Processor,omitempty"`
Numa *Numa `json:"Numa,omitempty"`
}
39 changes: 16 additions & 23 deletions internal/hcs/schema2/virtual_machine.go
Original file line number Diff line number Diff line change
@@ -1,36 +1,29 @@
// Autogenerated code; DO NOT EDIT.

/*
* HCS API
* Schema Open API
*
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* API version: 2.1
* API version: 2.4
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package hcsschema

// Configuration of a virtual machine, used during its creation to set up and/or use resources.
type VirtualMachine struct {

// StopOnReset is private in the schema. If regenerated need to put back.
StopOnReset bool `json:"StopOnReset,omitempty"`

Chipset *Chipset `json:"Chipset,omitempty"`

ComputeTopology *Topology `json:"ComputeTopology,omitempty"`

Devices *Devices `json:"Devices,omitempty"`

GuestState *GuestState `json:"GuestState,omitempty"`

RestoreState *RestoreState `json:"RestoreState,omitempty"`

Version *Version `json:"Version,omitempty"`
// When set to true, the virtual machine will treat a reset as a stop, releasing resources and cleaning up state.
StopOnReset bool `json:"StopOnReset,omitempty"`
Chipset *Chipset `json:"Chipset,omitempty"`
ComputeTopology *Topology `json:"ComputeTopology,omitempty"`
Devices *Devices `json:"Devices,omitempty"`
GuestState *GuestState `json:"GuestState,omitempty"`
RestoreState *RestoreState `json:"RestoreState,omitempty"`
RegistryChanges *RegistryChanges `json:"RegistryChanges,omitempty"`

StorageQoS *StorageQoS `json:"StorageQoS,omitempty"`

StorageQoS *StorageQoS `json:"StorageQoS,omitempty"`
DebugOptions *DebugOptions `json:"DebugOptions,omitempty"`
GuestConnection *GuestConnection `json:"GuestConnection,omitempty"`

SecuritySettings *SecuritySettings `json:"SecuritySettings,omitempty"`

DebugOptions *DebugOptions `json:"DebugOptions,omitempty"`
SecuritySettings *SecuritySettings `json:"SecuritySettings,omitempty"`
}
33 changes: 33 additions & 0 deletions internal/hcs/schema2/virtual_machine_memory.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Autogenerated code; DO NOT EDIT.

/*
* Schema Open API
*
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* API version: 2.4
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package hcsschema

type VirtualMachineMemory struct {
SizeInMB uint64 `json:"SizeInMB,omitempty"`
Backing *MemoryBackingType `json:"Backing,omitempty"`
// If enabled, then the VM's memory is backed by the Windows pagefile rather than physically backed, statically allocated memory.
AllowOvercommit bool `json:"AllowOvercommit,omitempty"`
// If enabled, then the memory hot hint feature is exposed to the VM, allowing it to prefetch pages into its working set. (if supported by the guest operating system).
EnableHotHint bool `json:"EnableHotHint,omitempty"`
// If enabled, then the memory cold hint feature is exposed to the VM, allowing it to trim zeroed pages from its working set (if supported by the guest operating system).
EnableColdHint bool `json:"EnableColdHint,omitempty"`
// If enabled, then the memory cold discard hint feature is exposed to the VM, allowing it to trim non-zeroed pages from the working set (if supported by the guest operating system).
EnableColdDiscardHint bool `json:"EnableColdDiscardHint,omitempty"`
// If enabled, then commit is not charged for each backing page until first access.
EnableDeferredCommit bool `json:"EnableDeferredCommit,omitempty"`
// Low MMIO region allocated below 4GB
LowMMIOGapInMB uint64 `json:"LowMmioGapInMB,omitempty"`
// High MMIO region allocated above 4GB (base and size)
HighMMIOBaseInMB uint64 `json:"HighMmioBaseInMB,omitempty"`
HighMMIOGapInMB uint64 `json:"HighMmioGapInMB,omitempty"`
SlitType *VirtualSlitType `json:"SlitType,omitempty"`
}
21 changes: 21 additions & 0 deletions internal/hcs/schema2/virtual_machine_processor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Autogenerated code; DO NOT EDIT.

/*
* Schema Open API
*
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* API version: 2.4
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package hcsschema

type VirtualMachineProcessor struct {
Count uint32 `json:"Count,omitempty"`
Limit uint64 `json:"Limit,omitempty"`
Weight uint64 `json:"Weight,omitempty"`
Reservation uint64 `json:"Reservation,omitempty"`
CpuGroup *CpuGroup `json:"CpuGroup,omitempty"`
NumaProcessorsSettings *NumaProcessors `json:"NumaProcessorsSettings,omitempty"`
}
3 changes: 2 additions & 1 deletion internal/hcs/schema2/virtual_pci_device.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@

package hcsschema

// TODO: This is pre-release support in schema 2.3. Need to add build number
// TODO: PropagateNumaAffinity is pre-release/experimental field in schema 2.11. Need to add build number
// docs when a public build with this is out.
type VirtualPciDevice struct {
Functions []VirtualPciFunction `json:",omitempty"`
PropagateNumaAffinity *bool `json:"PropagateNumaAffinity,omitempty"`
}
23 changes: 23 additions & 0 deletions internal/hcs/schema2/virtual_slit_type.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Autogenerated code; DO NOT EDIT.

/*
* Schema Open API
*
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* API version: 2.4
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/

package hcsschema

// VirtualSlitType : Indicates if a virtual SLIT should ne enabled for a VM and the type of virtual SLIT to be enabled.
type VirtualSlitType string

// List of VirtualSlitType
const (
VirtualSlitType_NONE VirtualSlitType = "None"
VirtualSlitType_FIRMWARE VirtualSlitType = "Firmware"
VirtualSlitType_MEASURED VirtualSlitType = "Measured"
VirtualSlitType_FIRMWARE_FALLBACK_MEASURED VirtualSlitType = "FirmwareFallbackMeasured"
)
Loading

0 comments on commit 8ad5a97

Please sign in to comment.