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

[kernel] Change grub cmdline to set c-states to 0 for "Intel" CPUs #6051

Merged
merged 3 commits into from
Dec 7, 2020
Merged

[kernel] Change grub cmdline to set c-states to 0 for "Intel" CPUs #6051

merged 3 commits into from
Dec 7, 2020

Conversation

shlomibitton
Copy link
Contributor

Signed-off-by: Shlomi Bitton shlomibi@nvidia.com

- Why I did it
Usually for a use case like networking - should not be configured to reach c6, the maximum used is c1e – due to the added latency getting in & out of states (bad for networking).

Following a recommendation by Intel, networking system should avoid getting in & out of states which introduce latency. The recommended state is c1e and no state change enabling.

In addition, c-state sole purpose is to save power and when inside a networking switch its really negligent being such a tiny consumer vs. the whole cluster.

- How I did it
Added a new argument to the grub cmdline to set c-states to 0.

- How to verify it

  • install 'linux-cpupower' tool.
  • Run 'turbostat --debug' command
  • Observe the c-states is constantly on state 1.

- Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

Signed-off-by: Shlomi Bitton <shlomibi@nvidia.com>
@lguohan
Copy link
Collaborator

lguohan commented Nov 26, 2020

retest vsimage please

@lguohan
Copy link
Collaborator

lguohan commented Nov 26, 2020

what if the platform uses non intel cpu? like amd cpu or arm cpu?

@liat-grozovik
Copy link
Collaborator

@shlomibitton please check if we can read a parameter which identify this is intel cpu and add it only for it.

@shlomibitton
Copy link
Contributor Author

shlomibitton commented Nov 30, 2020

@lguohan I added a condition to change it only for 'Intel' CPUs.
can you please review the change?

@shlomibitton shlomibitton changed the title [kernel] Change grub cmdline to set c-states to 0 [kernel] Change grub cmdline to set c-states to 0 for "Intel" CPUs Dec 1, 2020
installer/x86_64/install.sh Outdated Show resolved Hide resolved
Copy link
Collaborator

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

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

As comment

@lguohan
Copy link
Collaborator

lguohan commented Dec 3, 2020

Observe the c-states is constantly on state 1.

is this incorrect? state should be 0, right?

@lguohan
Copy link
Collaborator

lguohan commented Dec 3, 2020

check out this one. why do they set both processor.max-cstate=1 and intel_idle.max_cstate=0? why do you only set intel_idle.max_cstate?

https://gist.github.com/wmealing/2dd2b543c4d3cff6cab7

@shlomibitton
Copy link
Contributor Author

shlomibitton commented Dec 3, 2020

@lguohan

Observe the c-states is constantly on state 1.

is this incorrect? state should be 0, right?

No, state 0 means the CPU is currently active.
by the turbostat tool man page:
Busy% percent of the measurement interval that the CPU executes instructions, aka. % of time in "C0" state.
This is an example of an output when running the tool with c-states = 0.
As you can see when it is not "busy" i.e. "idle" it is in state C1, which is expected and desired.

image

check out this one. why do they set both processor.max-cstate=1 and intel_idle.max_cstate=0? why do you only set intel_idle.max_cstate?

https://gist.github.com/wmealing/2dd2b543c4d3cff6cab7

by using "processor.max-cstate=1" we limit the c-states level to a certain level, but this is not needed when using "intel_idle.max_cstate=0" because this is disables the driver, forcing it to stay active all the time.
you can check in the kernel code base the file "drivers/idle/intel_idle.c" there is an indication for it:
/* intel_idle.max_cstate=0 disables driver */

@qiluo-msft qiluo-msft dismissed their stale review December 4, 2020 01:52

Unblock, and LGTM

@lguohan lguohan merged commit 43a32e6 into sonic-net:master Dec 7, 2020
abdosi pushed a commit that referenced this pull request Dec 10, 2020
…6051)

Usually for a use case like networking - should not be configured to reach c6, the maximum used is c1e – due to the added latency getting in & out of states (bad for networking).

Following a recommendation by Intel, networking system should avoid getting in & out of states which introduce latency. The recommended state is c1e and no state change enabling.

In addition, c-state sole purpose is to save power and when inside a networking switch its really negligent being such a tiny consumer vs. the whole cluster.

Signed-off-by: Shlomi Bitton <shlomibi@nvidia.com>
@shlomibitton shlomibitton deleted the shlomi_disable_cstates branch March 24, 2021 20:37
liat-grozovik pushed a commit that referenced this pull request Apr 4, 2021
The motivation of these changes is to fix (#6051):

- Why I did it
To fix CPU cstates configuration

- How I did it
Updated code to be POSIX compatible

- How to verify it
root@sonic:/home/admin# sonic_installer install sonic-mellanox.bin

Signed-off-by: Nazarii Hnydyn <nazariig@nvidia.com>
daall pushed a commit that referenced this pull request Apr 5, 2021
The motivation of these changes is to fix (#6051):

- Why I did it
To fix CPU cstates configuration

- How I did it
Updated code to be POSIX compatible

- How to verify it
root@sonic:/home/admin# sonic_installer install sonic-mellanox.bin

Signed-off-by: Nazarii Hnydyn <nazariig@nvidia.com>
abdosi pushed a commit that referenced this pull request Apr 8, 2021
The motivation of these changes is to fix (#6051):

- Why I did it
To fix CPU cstates configuration

- How I did it
Updated code to be POSIX compatible

- How to verify it
root@sonic:/home/admin# sonic_installer install sonic-mellanox.bin

Signed-off-by: Nazarii Hnydyn <nazariig@nvidia.com>
raphaelt-nvidia pushed a commit to raphaelt-nvidia/sonic-buildimage that referenced this pull request May 23, 2021
The motivation of these changes is to fix (sonic-net#6051):

- Why I did it
To fix CPU cstates configuration

- How I did it
Updated code to be POSIX compatible

- How to verify it
root@sonic:/home/admin# sonic_installer install sonic-mellanox.bin

Signed-off-by: Nazarii Hnydyn <nazariig@nvidia.com>
carl-nokia pushed a commit to carl-nokia/sonic-buildimage that referenced this pull request Aug 7, 2021
The motivation of these changes is to fix (sonic-net#6051):

- Why I did it
To fix CPU cstates configuration

- How I did it
Updated code to be POSIX compatible

- How to verify it
root@sonic:/home/admin# sonic_installer install sonic-mellanox.bin

Signed-off-by: Nazarii Hnydyn <nazariig@nvidia.com>
yxieca pushed a commit that referenced this pull request Aug 31, 2023
Why I did it
This is a fix for PR [kernel] Change grub cmdline to set c-states to 0 for "Intel" CPUs by shlomibitton · Pull Request #6051 · sonic-net/sonic-buildimage (github.com)

The original PR will disable intel idle driver but it cannot limit the max c-state to 1 due to system will fall back to acpi idle driver.

Currently intel_idle.max_cstate=0 is already present, which will disable intel idle driver. With the added option, common idle driver will be disabled as well, so there will not be idle management. This is to prevent a bug that can be triggered by idle instruction on intel platform.

How I did it
Add the option to installer file beside intel_idle.max_cstate=0
mssonicbld pushed a commit to mssonicbld/sonic-buildimage that referenced this pull request Aug 31, 2023
Why I did it
This is a fix for PR [kernel] Change grub cmdline to set c-states to 0 for "Intel" CPUs by shlomibitton · Pull Request sonic-net#6051 · sonic-net/sonic-buildimage (github.com)

The original PR will disable intel idle driver but it cannot limit the max c-state to 1 due to system will fall back to acpi idle driver.

Currently intel_idle.max_cstate=0 is already present, which will disable intel idle driver. With the added option, common idle driver will be disabled as well, so there will not be idle management. This is to prevent a bug that can be triggered by idle instruction on intel platform.

How I did it
Add the option to installer file beside intel_idle.max_cstate=0
mssonicbld pushed a commit that referenced this pull request Aug 31, 2023
Why I did it
This is a fix for PR [kernel] Change grub cmdline to set c-states to 0 for "Intel" CPUs by shlomibitton · Pull Request #6051 · sonic-net/sonic-buildimage (github.com)

The original PR will disable intel idle driver but it cannot limit the max c-state to 1 due to system will fall back to acpi idle driver.

Currently intel_idle.max_cstate=0 is already present, which will disable intel idle driver. With the added option, common idle driver will be disabled as well, so there will not be idle management. This is to prevent a bug that can be triggered by idle instruction on intel platform.

How I did it
Add the option to installer file beside intel_idle.max_cstate=0
lguohan pushed a commit that referenced this pull request Sep 1, 2023
…tel cpu (#16371)

This is a fix for PR #6051

The original PR will disable intel idle driver but it cannot limit the max c-state to 1 due to system will fall back to acpi idle driver.

Currently intel_idle.max_cstate=0 is already present, which will disable intel idle driver. With the added option, common idle driver will be disabled as well, so there will not be idle management. This is to prevent a bug that can be triggered by idle instruction on intel platform.

Work item tracking
Microsoft ADO (number only): 24867921

How I did it
Add the option to installer file beside intel_idle.max_cstate=0

Signed-off-by: Xichen Lin <lukelin0907@gmail.com>
mssonicbld pushed a commit to mssonicbld/sonic-buildimage that referenced this pull request Sep 3, 2023
Why I did it
This is a fix for PR [kernel] Change grub cmdline to set c-states to 0 for "Intel" CPUs by shlomibitton · Pull Request sonic-net#6051 · sonic-net/sonic-buildimage (github.com)

The original PR will disable intel idle driver but it cannot limit the max c-state to 1 due to system will fall back to acpi idle driver.

Currently intel_idle.max_cstate=0 is already present, which will disable intel idle driver. With the added option, common idle driver will be disabled as well, so there will not be idle management. This is to prevent a bug that can be triggered by idle instruction on intel platform.

How I did it
Add the option to installer file beside intel_idle.max_cstate=0
sonic-otn pushed a commit to sonic-otn/sonic-buildimage that referenced this pull request Sep 20, 2023
Why I did it
This is a fix for PR [kernel] Change grub cmdline to set c-states to 0 for "Intel" CPUs by shlomibitton · Pull Request sonic-net#6051 · sonic-net/sonic-buildimage (github.com)

The original PR will disable intel idle driver but it cannot limit the max c-state to 1 due to system will fall back to acpi idle driver.

Currently intel_idle.max_cstate=0 is already present, which will disable intel idle driver. With the added option, common idle driver will be disabled as well, so there will not be idle management. This is to prevent a bug that can be triggered by idle instruction on intel platform.

How I did it
Add the option to installer file beside intel_idle.max_cstate=0
lguohan pushed a commit that referenced this pull request Sep 23, 2023
This is a fix for PR [kernel] Change grub cmdline to set c-states to 0 for "Intel" CPUs by shlomibitton · Pull Request #6051 · sonic-net/sonic-buildimage (github.com)

The original PR will disable intel idle driver but it cannot limit the max c-state to 1 due to system will fall back to acpi idle driver.

Currently intel_idle.max_cstate=0 is already present, which will disable intel idle driver. With the added option, common idle driver will be disabled as well, so there will not be idle management. This is to prevent a bug that can be triggered by idle instruction on intel platform.

Work item tracking
Microsoft ADO (number only): 24867921
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants