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

Include support for Intel HWP #158

Merged
merged 1 commit into from
Feb 4, 2023
Merged

Include support for Intel HWP #158

merged 1 commit into from
Feb 4, 2023

Conversation

marmarek
Copy link
Member

Hardware-managed P-states (when supported) results significantly smaller
power consumption according to some user reports.

Fixes QubesOS/qubes-issues#4604

@jandryuk thanks for making the patches (2 years ago...)!
I made some minor changes, especially:

  • dropped "fast MSR" thing, as it appears to apply to Ice Lake only, and has
    no reliable discovery method on others
  • dropped bumping XEN_SYSCTL_INTERFACE_VERSION, as the new union member is guarded with governor name anyway, and the overall structure size hasn't changed
  • fixed default state in documentation

@marmarek
Copy link
Member Author

PipelineRetry

@marmarek
Copy link
Member Author

openQArun

@marmarek
Copy link
Member Author

PipelineRetry

1 similar comment
@marmarek
Copy link
Member Author

PipelineRetry

+ uint8_t maximum;
+ uint8_t desired;
+ uint8_t energy_perf;
+};
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if padding is an issue, but if it is:

Suggested change
+};
+ uint16_t padding;
+};

Copy link

Choose a reason for hiding this comment

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

@DemiMarie I don't think padding matters - hwp_drv_data is a xen-internal struct to track HWP capabilities and current settings.

@marmarek It looks like you picked up v1 of my patchset. My v2 addressed some feedback, and dropped the "fast MSR" support. There aren't too many changes though. The 0634-cpufreq-Add-Hardware-P-State-HWP-driver.patch v1 commit message says "it hardcodes the default 0x80 (out of 0x0-0xff) energy/performance preference.", but the v2 message correctly states "It will run with the default values, which should be the default 0x80 (out of 0x0-0xff) energy/performance preference." That is, it just uses the current values the system booted with unless they are changed by the user.

https://lore.kernel.org/xen-devel/[email protected]/#T

I am hoping to resubmit a v3 for upstream after I take care of some other pending work.

@marmarek
Copy link
Member Author

openQArun

@marmarek
Copy link
Member Author

marmarek commented Feb 1, 2023

Thanks for the comment @jandryuk . I'm not sure how I missed v2... Anyway, I tried now, and I got a panic on boot :/
I'll look into it.

@marmarek
Copy link
Member Author

marmarek commented Feb 1, 2023

Ok, that was easy, missing cf_check on cpufreq_gov_hwp_init().

@marmarek
Copy link
Member Author

marmarek commented Feb 1, 2023

I tried xenpm set-scaling-governor hwp-internal, when booted without cpufreq=xen:hwp. I don't think it's supposed to work, but it seemingly succeeded. And now xenpm get-cpufreq-para fails.

Hardware-managed P-states (when supported) results significantly smaller
power consumption according to some user reports.

Fixes QubesOS/qubes-issues#4604
@jandryuk
Copy link

jandryuk commented Feb 1, 2023 via email

@marmarek
Copy link
Member Author

marmarek commented Feb 1, 2023

openQArun

@marmarek
Copy link
Member Author

marmarek commented Feb 3, 2023

PipelineRetry

@marmarek
Copy link
Member Author

marmarek commented Feb 3, 2023

openQArun

+
+ if ( boot_cpu_data.cpuid_level < 0x16 )
+ {
+ hwp_info("HWP disabled: cpuid_level %x < 0x16 lacks CPU freq info\n",
Copy link
Member Author

Choose a reason for hiding this comment

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

@jandryuk 0x%x ?

Copy link

Choose a reason for hiding this comment

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

Yes, good catch. Thanks. I'll also change the cpuid_level printing a few lines up from %u to %#x for consistency.

@marmarek marmarek merged commit 4e7bc22 into QubesOS:main Feb 4, 2023
@marmarek marmarek deleted the hwp branch August 1, 2024 12:03
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.

Intel CPU Frequency Scaling Broken
3 participants