linux-cpupower-5.1-rc1

This cpupower update for Linux 5.1-rc1 consists of a patch to add
 support to display boost frequency separately from Abhishek Goel.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEPZKym/RZuOCGeA/kCwJExA0NQxwFAlx5WkwACgkQCwJExA0N
 Qxw3wg//XtQ1DlqA9PWF0ikQHgmaKkFPLWAO3i4hR+tJu8atDOaBePTyJiWUXarr
 xwsi2cmPtSagd7SMO1pgrdx6VBMXlhr13l05yyRE5DyDz/hX442Rj4zmS9S3DAmS
 MbeoQzvwZ8aw6s/UkeUl146som7NPH336X4qQMO31kBxp78nHw4AYmT0/CKCfo1v
 /nd6DBZSvuyIgLa+Nw+y/jLwZLpQruvN9eYB6tPy8EwiaUbnFj9iLYGy6qoyq+Py
 fd4N7PnmYVBLpxipQw/o2YKLUYYApzKXLiRiCssVBohi3g3aB9sM5zemp01m2iyU
 yubPfHgoazxIAqm5cfPpgPtBjc6njxdMulWEXIQHxWMHvNtBwwLiLcmT/GyIAgWy
 R/qL+WCCXAKn6trm1yyJWy9HksZ/yHucN75IeQ6l5EtDrk5Xn85bu8cSWNZy8mu1
 azIOUhS/n+8dlRAGLThSgcqqLRw4iFhsTfRywj0cy4GK2UZtym8zdHei5zxngMOH
 a7WsPqY/xYI2eKNBs8qU3r+633EvBM7PSjhRvW/Shu4JFwQDxSC2k06VnnDK/0En
 JJBHUg4RhA2Rwc0f+mSethKNkiOvFLHF0VLbpwTMKG6awkvCNj5j/mAYNCoJHTkM
 NGZB1mjIjrTokM7AGXvr7Eu4xKpPk03GnU5jDfX+5rnzbV26t/U=
 =Gmfv
 -----END PGP SIGNATURE-----

Merge tag 'linux-cpupower-5.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux

Pull cpupower updates for 5.1-rc1 from Shuah Khan:

"This cpupower update for Linux 5.1-rc1 consists of a patch to add
 support to display boost frequency separately from Abhishek Goel."

* tag 'linux-cpupower-5.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux:
  tools/power/cpupower: Display boost frequency separately
This commit is contained in:
Rafael J. Wysocki 2019-03-06 10:40:23 +01:00
commit 2c0bf86c7c
3 changed files with 50 additions and 27 deletions

View File

@ -333,17 +333,20 @@ void cpufreq_put_available_governors(struct cpufreq_available_governors *any)
}
struct cpufreq_available_frequencies
*cpufreq_get_available_frequencies(unsigned int cpu)
struct cpufreq_frequencies
*cpufreq_get_frequencies(const char *type, unsigned int cpu)
{
struct cpufreq_available_frequencies *first = NULL;
struct cpufreq_available_frequencies *current = NULL;
struct cpufreq_frequencies *first = NULL;
struct cpufreq_frequencies *current = NULL;
char one_value[SYSFS_PATH_MAX];
char linebuf[MAX_LINE_LEN];
char fname[MAX_LINE_LEN];
unsigned int pos, i;
unsigned int len;
len = sysfs_cpufreq_read_file(cpu, "scaling_available_frequencies",
snprintf(fname, MAX_LINE_LEN, "scaling_%s_frequencies", type);
len = sysfs_cpufreq_read_file(cpu, fname,
linebuf, sizeof(linebuf));
if (len == 0)
return NULL;
@ -389,9 +392,9 @@ struct cpufreq_available_frequencies
return NULL;
}
void cpufreq_put_available_frequencies(struct cpufreq_available_frequencies
*any) {
struct cpufreq_available_frequencies *tmp, *next;
void cpufreq_put_frequencies(struct cpufreq_frequencies *any)
{
struct cpufreq_frequencies *tmp, *next;
if (!any)
return;

View File

@ -28,10 +28,10 @@ struct cpufreq_available_governors {
struct cpufreq_available_governors *first;
};
struct cpufreq_available_frequencies {
struct cpufreq_frequencies {
unsigned long frequency;
struct cpufreq_available_frequencies *next;
struct cpufreq_available_frequencies *first;
struct cpufreq_frequencies *next;
struct cpufreq_frequencies *first;
};
@ -129,14 +129,14 @@ void cpufreq_put_available_governors(
*
* Only present on _some_ ->target() cpufreq drivers. For information purposes
* only. Please free allocated memory by calling
* cpufreq_put_available_frequencies after use.
* cpufreq_put_frequencies after use.
*/
struct cpufreq_available_frequencies
*cpufreq_get_available_frequencies(unsigned int cpu);
struct cpufreq_frequencies
*cpufreq_get_frequencies(const char *type, unsigned int cpu);
void cpufreq_put_available_frequencies(
struct cpufreq_available_frequencies *first);
void cpufreq_put_frequencies(
struct cpufreq_frequencies *first);
/* determine affected CPUs

View File

@ -161,19 +161,12 @@ static void print_duration(unsigned long duration)
return;
}
/* --boost / -b */
static int get_boost_mode(unsigned int cpu)
static int get_boost_mode_x86(unsigned int cpu)
{
int support, active, b_states = 0, ret, pstate_no, i;
/* ToDo: Make this more global */
unsigned long pstates[MAX_HW_PSTATES] = {0,};
if (cpupower_cpu_info.vendor != X86_VENDOR_AMD &&
cpupower_cpu_info.vendor != X86_VENDOR_HYGON &&
cpupower_cpu_info.vendor != X86_VENDOR_INTEL)
return 0;
ret = cpufreq_has_boost_support(cpu, &support, &active, &b_states);
if (ret) {
printf(_("Error while evaluating Boost Capabilities"
@ -248,6 +241,33 @@ static int get_boost_mode(unsigned int cpu)
return 0;
}
/* --boost / -b */
static int get_boost_mode(unsigned int cpu)
{
struct cpufreq_frequencies *freqs;
if (cpupower_cpu_info.vendor == X86_VENDOR_AMD ||
cpupower_cpu_info.vendor == X86_VENDOR_HYGON ||
cpupower_cpu_info.vendor == X86_VENDOR_INTEL)
return get_boost_mode_x86(cpu);
freqs = cpufreq_get_frequencies("boost", cpu);
if (freqs) {
printf(_(" boost frequency steps: "));
while (freqs->next) {
print_speed(freqs->frequency);
printf(", ");
freqs = freqs->next;
}
print_speed(freqs->frequency);
printf("\n");
cpufreq_put_frequencies(freqs);
}
return 0;
}
/* --freq / -f */
static int get_freq_kernel(unsigned int cpu, unsigned int human)
@ -456,7 +476,7 @@ static int get_latency(unsigned int cpu, unsigned int human)
static void debug_output_one(unsigned int cpu)
{
struct cpufreq_available_frequencies *freqs;
struct cpufreq_frequencies *freqs;
get_driver(cpu);
get_related_cpus(cpu);
@ -464,7 +484,7 @@ static void debug_output_one(unsigned int cpu)
get_latency(cpu, 1);
get_hardware_limits(cpu, 1);
freqs = cpufreq_get_available_frequencies(cpu);
freqs = cpufreq_get_frequencies("available", cpu);
if (freqs) {
printf(_(" available frequency steps: "));
while (freqs->next) {
@ -474,7 +494,7 @@ static void debug_output_one(unsigned int cpu)
}
print_speed(freqs->frequency);
printf("\n");
cpufreq_put_available_frequencies(freqs);
cpufreq_put_frequencies(freqs);
}
get_available_governors(cpu);