Skip to content

Support assigning cpugroup immediately after UVM start#888

Merged
katiewasnothere merged 1 commit intomicrosoft:masterfrom
katiewasnothere:cpugroup_vm_create_on_start
Dec 15, 2020
Merged

Support assigning cpugroup immediately after UVM start#888
katiewasnothere merged 1 commit intomicrosoft:masterfrom
katiewasnothere:cpugroup_vm_create_on_start

Conversation

@katiewasnothere
Copy link
Copy Markdown

@katiewasnothere katiewasnothere commented Oct 27, 2020

This PR adds a new annotation io.microsoft.virtualmachine.cpugroup.id for pod configuration that allows for specifying the ID of a cpugroup the corresponding UVM should be added to. This PR also adds e2e tests and a unit test, which is disabled since cpugroups is only enabled on systems with classic/core scheduling type.

Signed-off-by: Kathryn Baldauf kabaldau@microsoft.com

Comment thread internal/uvm/cpugroups.go Outdated
Comment thread internal/uvm/cpugroups_test.go Outdated
Comment thread internal/uvm/cpugroups.go Outdated
Comment thread internal/uvm/cpugroups.go Outdated
Comment thread test/cri-containerd/runpodsandbox_test.go Outdated
Comment thread test/cri-containerd/runpodsandbox_test.go Outdated
Comment thread test/cri-containerd/runpodsandbox_test.go Outdated
Comment thread internal/oci/cpugroup.go Outdated
Comment thread internal/uvm/cpugroups.go
Comment thread internal/oci/cpugroup.go Outdated
Comment thread internal/uvm/cpugroups.go Outdated
Comment thread internal/uvm/cpugroups.go Outdated
Comment thread test/cri-containerd/runpodsandbox_test.go Outdated
@katiewasnothere katiewasnothere force-pushed the cpugroup_vm_create_on_start branch from 6b8bb2f to 2678abe Compare October 27, 2020 03:16
Comment thread cmd/containerd-shim-runhcs-v1/pod.go Outdated
Comment thread internal/uvm/cpugroups.go Outdated
@katiewasnothere katiewasnothere force-pushed the cpugroup_vm_create_on_start branch from 2678abe to a9cf4d1 Compare October 27, 2020 20:20
Comment thread internal/uvm/cpugroups.go Outdated
@katiewasnothere katiewasnothere force-pushed the cpugroup_vm_create_on_start branch 2 times, most recently from 3294bc7 to 47845df Compare October 28, 2020 00:32
Comment thread internal/uvm/cpugroups.go
@@ -0,0 +1,121 @@
package uvm
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should move out the core CPU groups support into an internal/cpugroup package, and just call into that from uvm.SetCPUGroup and uvm.UnsetCPUGroup.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some standalone pieces that I moved out, but the code that needs to be run in Set/Unset/Release require the uvm package, so I did not move those. Let me know if it looks okay.

Comment thread internal/uvm/start.go Outdated
@katiewasnothere katiewasnothere force-pushed the cpugroup_vm_create_on_start branch from 47845df to 8e78880 Compare October 28, 2020 01:58
Comment thread internal/uvm/create.go Outdated
Comment thread internal/uvm/host_information.go
Comment thread test/cri-containerd/runpodsandbox_test.go
Comment thread internal/cpugroup/cpugroup.go
Comment thread internal/cpugroup/cpugroup.go Outdated
Comment thread test/cri-containerd/runpodsandbox_test.go
@katiewasnothere katiewasnothere force-pushed the cpugroup_vm_create_on_start branch 2 times, most recently from b8689b3 to b08f737 Compare November 19, 2020 01:18
Comment thread internal/cpugroup/cpugroup.go Outdated
LogicalProcessorCount: uint32(len(logicalProcessors)),
}
if err := modifyCPUGroupRequest(ctx, operation, details); err != nil {
return fmt.Errorf("failed to make cpugroups CreateGroup request with details %v with: %s", details, err)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can we just make this

return errors.Wrapf(err, "failed to create CPU group with details %v")

the "with details x with y" is odd to read

)

// hostProcessorInfo queries HCS for the UVM hosts processor information, including topology
// HostProcessorInfo queries HCS for the UVM hosts processor information, including topology
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can omit the part of the comment that mentions this is for the UVMs host as this is in a more general package now.

Copy link
Copy Markdown
Contributor

@dcantah dcantah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. 2 nitpicky comments

Comment thread internal/uvm/cpugroups.go
Signed-off-by: Kathryn Baldauf <kabaldau@microsoft.com>
@katiewasnothere katiewasnothere force-pushed the cpugroup_vm_create_on_start branch from b08f737 to bac6480 Compare December 15, 2020 21:25
Copy link
Copy Markdown
Contributor

@anmaxvl anmaxvl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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.

4 participants