Skip to content
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

design-proposal: Support isolateEmulatorThread with SMT enabled Nodes #247

Merged
merged 2 commits into from Feb 22, 2024

Conversation

RamLavi
Copy link
Contributor

@RamLavi RamLavi commented Oct 16, 2023

This design proposal is proposing a fix to BZ#2228103.

@kubevirt-bot kubevirt-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 16, 2023
@kubevirt-bot
Copy link

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@kubevirt-bot kubevirt-bot added the dco-signoff: yes Indicates the PR's author has DCO signed all their commits. label Oct 16, 2023
@RamLavi RamLavi force-pushed the dpdk_isolate_emulator_short_fix branch 4 times, most recently from d24e552 to 3febc99 Compare October 16, 2023 08:23
@RamLavi
Copy link
Contributor Author

RamLavi commented Oct 17, 2023

/cc @vladikr @iholder101
could you take a look?

@RamLavi RamLavi marked this pull request as ready for review October 17, 2023 07:26
@kubevirt-bot kubevirt-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 17, 2023
@RamLavi RamLavi force-pushed the dpdk_isolate_emulator_short_fix branch from 3febc99 to 0f35e2f Compare October 17, 2023 07:29
@RamLavi
Copy link
Contributor Author

RamLavi commented Oct 17, 2023

/cc @xpivarc
could you also take a look?

@orelmisan
Copy link
Member

/cc @iholder101

Copy link
Member

@orelmisan orelmisan left a comment

Choose a reason for hiding this comment

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

Thank you for the PR @RamLavi
Please see the inline comments.

@RamLavi
Copy link
Contributor Author

RamLavi commented Oct 29, 2023

Change: Changed annotation to @vladikr's suggestion: kubevirt.io/CPUManagerPolicyBetaOptions:full-pcpus-only

Copy link
Contributor

@enp0s3 enp0s3 left a comment

Choose a reason for hiding this comment

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

@RamLavi Hi! Thank you raising this issue, I have a few questions below.

* We’re adding yet another semi alpha knob to an already complicated set of knobs.

# Fix Alternatives
## Alternative #1 Adding `full-pcpus-only` option as a global configuration
Copy link
Contributor

Choose a reason for hiding this comment

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

@RamLavi I am not sure whether we can consider it as alternative, because it depends on the main proposal. It can rather be an option in the implementation details, to enhance the kubevirt CR with the option to annotate every VM with the suggested annotation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@RamLavi I am not sure whether we can consider it as alternative, because it depends on the main proposal. It can rather be an option in the implementation details, to enhance the kubevirt CR with the option to annotate every VM with the suggested annotation.

I don't mean that this global option will annotate every VM once it is enabled.
I mean that this will be a global behavior, in a similar way that defaultRuntimeClass sets the runtimeClass without changing the VM manifest (metadata or spec API) at all.
It is in that sense - that it is a different alternative.

Cons:
* The suggested annotation is waisting a CPU when used on nodes with hyperthreading disabled. A cluster-wide configuration may be wasteful for heterogeneous clusters, where node-level granularity is needed.

## Alternative #2 Configure both pod and Guest
Copy link
Contributor

Choose a reason for hiding this comment

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

@RamLavi This is also doesn't look like an alternative solution, but a suggestion to how to implement the addition of the core so that it will be even.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I kinda agree with you here.
If this alternative is chosen then the Action item is no-op in kubevirt's perspective. I just wanted this option to be heard, as it has its advantages.

Copy link
Member

Choose a reason for hiding this comment

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

Thank you for putting it writing, as this is my favorite alternative.

* Similar to the way default runtimeclass is configured on Kubevirt.

Cons:
* The suggested annotation is waisting a CPU when used on nodes with hyperthreading disabled. A cluster-wide configuration may be wasteful for heterogeneous clusters, where node-level granularity is needed.
Copy link
Contributor

Choose a reason for hiding this comment

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

@RamLavi IIUC the main proposal also has this disadvantage. I can annotate the VM and it can still be scheduled on a non-SMT node in case the cluster is heterogeneous

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes but notice the scope - iIn the main proposal the scope is per VM, hence minimal (only when necessary), whereas on this alternative the impact is every VM on the cluster (!).
Considering that a standard Node has a few dozens of CPUs, this change of scope is what makes this Con - a very big and waistfull one (CPU wise).

RamLavi added a commit to RamLavi/kubevirt that referenced this pull request Dec 17, 2023
Currently the VMI is blocked if the
`kubevirt.io/CPUManagerPolicyBetaOptions` annotation set on the VMI and
the
CPUManagerPolicyBetaOptions feature-gate is not enabled.
Removing this logic from the webhook in order to align with the design
proposal [0]
The meaning of this change is that if the annotation is set on the VMI
manually - then the CPUManagerPolicyBetaOptions:full-pcpu-only behavior
will take place in spite of the feature gate being disabled.

[0] kubevirt/community#247

Signed-off-by: Ram Lavi <ralavi@redhat.com>
RamLavi added a commit to RamLavi/kubevirt that referenced this pull request Dec 19, 2023
Currently the VMI is blocked if the
`kubevirt.io/CPUManagerPolicyBetaOptions` annotation set on the VMI and
the
CPUManagerPolicyBetaOptions feature-gate is not enabled.
Removing this logic from the webhook in order to align with the design
proposal [0]
The meaning of this change is that if the annotation is set on the VMI
manually - then the CPUManagerPolicyBetaOptions:full-pcpu-only behavior
will take place in spite of the feature gate being disabled.

[0] kubevirt/community#247

Signed-off-by: Ram Lavi <ralavi@redhat.com>
RamLavi added a commit to RamLavi/hyperconverged-cluster-operator that referenced this pull request Dec 21, 2023
The AlignCPUs feature gate is proposed [0] and introduced [1][2][3][4]
on Kubevirt in order to allow support in SMT enabled nodes while using
IsolateEmulatorThread on the VMI [5].
The configuration is set cluster-wide, using the kubevirt CR (annotation
+ kubevirt feature gate).
This commit is enabling the feature-gate on the kubevirt CR when the new
HCO AlignCPUs is set to true.

[0] kubevirt/community#247
[1] kubevirt/kubevirt#10593
[2] kubevirt/kubevirt#10783
[3] kubevirt/kubevirt#10839
[4] kubevirt/kubevirt#10872
[5] https://bugzilla.redhat.com/show_bug.cgi?id=2228103

Signed-off-by: Ram Lavi <ralavi@redhat.com>
RamLavi added a commit to RamLavi/hyperconverged-cluster-operator that referenced this pull request Dec 21, 2023
… annotation

The alpha.kubevirt.io/EmulatorThreadCompleteToEvenParity annotation is
proposed [0] and introduced [1][2][3][4] on Kubevirt in order to allow
support in SMT enabled nodes while using IsolateEmulatorThread on the
VMI [5].
The configuration is set cluster-wide, using the kubevirt CR (annotation
+ kubevirt feature gate set in previous commit).
This commit is setting the annotation on the kubevirt CR if the HCO
AlignCPUs feature gate is set to true.

[0] kubevirt/community#247
[1] kubevirt/kubevirt#10593
[2] kubevirt/kubevirt#10783
[3] kubevirt/kubevirt#10839
[4] kubevirt/kubevirt#10872
[5] https://bugzilla.redhat.com/show_bug.cgi?id=2228103

Signed-off-by: Ram Lavi <ralavi@redhat.com>
<img src="smt-slignment-error-diagram.png">

## Goals
Fix [BZ#2228103](https://bugzilla.redhat.com/show_bug.cgi?id=2228103) on the Kubevirt scope.
Copy link
Member

Choose a reason for hiding this comment

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

nit: The BZ was migrated to https://issues.redhat.com/browse/CNV-31584.

When the following conditions are met:
1. The feature gate is enabled on the Kubevirt CR
2. Kubevirt CR has the annotation.
3. VMI is configured with `isolateEmulatorThread: true` and `dedicatedCpuPlacement: true`
Copy link
Member

@orelmisan orelmisan Dec 31, 2023

Choose a reason for hiding this comment

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

The actual implementation only took isolateEmulatorThread into account, since there is a validating webhook that runs after the mutating webhook to verity both exist.

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Dec 31, 2023
@orelmisan
Copy link
Member

@vladikr @xpivarc can we move forward with this PR?
The code changes were merged.

@xpivarc
Copy link
Member

xpivarc commented Feb 21, 2024

/cc @aburdenthehand

@aburdenthehand
Copy link
Contributor

/approve

@kubevirt-bot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aburdenthehand

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 22, 2024
@kubevirt-bot kubevirt-bot merged commit 82423b6 into kubevirt:main Feb 22, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants