linux-cpupower-5.6-rc1

This cpupower update for Linux 5.6-rc1 consists of a revert from
 Thomas Renninger and a manpage correction from Brahadambal Srinivasan.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEPZKym/RZuOCGeA/kCwJExA0NQxwFAl4wdGEACgkQCwJExA0N
 QxxpHA/+PpX0rTNxsWfW5zu4jk0ggJ9+Ll5Ne/82VOSYEWgW6kchg6s0tDc2CcUk
 cW2Y88VFy5JA6rybi/ivVlEbjdDUej62fUjMgmMEWtkIBo7C7VrKoS7LX4rz5Hqb
 ry3B604LLwRprLcy9eEqRtdmW6NNRGkC0lkjCMgFEtt6/TFKOnEPasnP3+Dd9KlF
 M1bubMxipfjIAROFj5lR6W9zy+yuiID/NP8VneTkjB9IQwaMR5zShO+3xQ4iLimP
 WGjNhpF8aNIAD+gk+7Cu7OcczVcqgj2R/Atu+0i2mgZDdTFDR0XSegUsBXTmzEla
 2YPDO4qAXQK3HXFRC1yNW4SnA93PNtGOAJTxRL4HGCznwiO/mF8wfhP3x5hrlGqg
 OSoVIah5QERilH9TGyw+AEpzafYGgYK478537H16PSxcGKj1egjFeaC/6Rt9VOtr
 q2pOyLjx552xugsjgNTG5O706pFw2JMPDgd9qlRQgf4Bn6q97vw2aDq1wnK6OAkK
 QwB3zkPrdjkLspDNBfEj/rXYjsFiayvZY2QCydRouM7T8UeGZuoQFqk7mbfx3gA9
 oXC8jlivKT0LYJGVBkibGfiyNAYF2bvnXrlyEk5Y4anHZ8GSeA0krkLBTxDDz6GN
 YjbHH+6LpItgyp9ItUyoGOVDDxx7mUVEtRjlltdQmYZHu7yRrCY=
 =CjtJ
 -----END PGP SIGNATURE-----

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

Pull cpupower utility updates for v5.6 from Shuah Khan:

"This cpupower update for Linux 5.6-rc1 consists of a revert
 from Thomas Renninger and a manpage correction from Brahadambal
 Srinivasan."

* tag 'linux-cpupower-5.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux:
  Correction to manpage of cpupower
  cpupower: Revert library ABI changes from commit ae2917093f
This commit is contained in:
Rafael J. Wysocki 2020-01-28 23:38:45 +01:00
commit a7aebdeb13
4 changed files with 91 additions and 27 deletions

View File

@ -332,21 +332,18 @@ void cpufreq_put_available_governors(struct cpufreq_available_governors *any)
}
struct cpufreq_frequencies
*cpufreq_get_frequencies(const char *type, unsigned int cpu)
struct cpufreq_available_frequencies
*cpufreq_get_available_frequencies(unsigned int cpu)
{
struct cpufreq_frequencies *first = NULL;
struct cpufreq_frequencies *current = NULL;
struct cpufreq_available_frequencies *first = NULL;
struct cpufreq_available_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;
snprintf(fname, MAX_LINE_LEN, "scaling_%s_frequencies", type);
len = sysfs_cpufreq_read_file(cpu, fname,
linebuf, sizeof(linebuf));
len = sysfs_cpufreq_read_file(cpu, "scaling_available_frequencies",
linebuf, sizeof(linebuf));
if (len == 0)
return NULL;
@ -391,9 +388,65 @@ struct cpufreq_frequencies
return NULL;
}
void cpufreq_put_frequencies(struct cpufreq_frequencies *any)
struct cpufreq_available_frequencies
*cpufreq_get_boost_frequencies(unsigned int cpu)
{
struct cpufreq_frequencies *tmp, *next;
struct cpufreq_available_frequencies *first = NULL;
struct cpufreq_available_frequencies *current = NULL;
char one_value[SYSFS_PATH_MAX];
char linebuf[MAX_LINE_LEN];
unsigned int pos, i;
unsigned int len;
len = sysfs_cpufreq_read_file(cpu, "scaling_boost_frequencies",
linebuf, sizeof(linebuf));
if (len == 0)
return NULL;
pos = 0;
for (i = 0; i < len; i++) {
if (linebuf[i] == ' ' || linebuf[i] == '\n') {
if (i - pos < 2)
continue;
if (i - pos >= SYSFS_PATH_MAX)
goto error_out;
if (current) {
current->next = malloc(sizeof(*current));
if (!current->next)
goto error_out;
current = current->next;
} else {
first = malloc(sizeof(*first));
if (!first)
goto error_out;
current = first;
}
current->first = first;
current->next = NULL;
memcpy(one_value, linebuf + pos, i - pos);
one_value[i - pos] = '\0';
if (sscanf(one_value, "%lu", &current->frequency) != 1)
goto error_out;
pos = i + 1;
}
}
return first;
error_out:
while (first) {
current = first->next;
free(first);
first = current;
}
return NULL;
}
void cpufreq_put_available_frequencies(struct cpufreq_available_frequencies *any)
{
struct cpufreq_available_frequencies *tmp, *next;
if (!any)
return;
@ -406,6 +459,11 @@ void cpufreq_put_frequencies(struct cpufreq_frequencies *any)
}
}
void cpufreq_put_boost_frequencies(struct cpufreq_available_frequencies *any)
{
cpufreq_put_available_frequencies(any);
}
static struct cpufreq_affected_cpus *sysfs_get_cpu_list(unsigned int cpu,
const char *file)
{

View File

@ -20,10 +20,10 @@ struct cpufreq_available_governors {
struct cpufreq_available_governors *first;
};
struct cpufreq_frequencies {
struct cpufreq_available_frequencies {
unsigned long frequency;
struct cpufreq_frequencies *next;
struct cpufreq_frequencies *first;
struct cpufreq_available_frequencies *next;
struct cpufreq_available_frequencies *first;
};
@ -124,11 +124,17 @@ void cpufreq_put_available_governors(
* cpufreq_put_frequencies after use.
*/
struct cpufreq_frequencies
*cpufreq_get_frequencies(const char *type, unsigned int cpu);
struct cpufreq_available_frequencies
*cpufreq_get_available_frequencies(unsigned int cpu);
void cpufreq_put_frequencies(
struct cpufreq_frequencies *first);
void cpufreq_put_available_frequencies(
struct cpufreq_available_frequencies *first);
struct cpufreq_available_frequencies
*cpufreq_get_boost_frequencies(unsigned int cpu);
void cpufreq_put_boost_frequencies(
struct cpufreq_available_frequencies *first);
/* determine affected CPUs

View File

@ -62,9 +62,9 @@ all cores
Print the package name and version number.
.SH "SEE ALSO"
cpupower-set(1), cpupower-info(1), cpupower-idle(1),
cpupower-frequency-set(1), cpupower-frequency-info(1), cpupower-monitor(1),
powertop(1)
cpupower-set(1), cpupower-info(1), cpupower-idle-info(1),
cpupower-idle-set(1), cpupower-frequency-set(1), cpupower-frequency-info(1),
cpupower-monitor(1), powertop(1)
.PP
.SH AUTHORS
.nf

View File

@ -244,14 +244,14 @@ static int get_boost_mode_x86(unsigned int cpu)
static int get_boost_mode(unsigned int cpu)
{
struct cpufreq_frequencies *freqs;
struct cpufreq_available_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);
freqs = cpufreq_get_boost_frequencies(cpu);
if (freqs) {
printf(_(" boost frequency steps: "));
while (freqs->next) {
@ -261,7 +261,7 @@ static int get_boost_mode(unsigned int cpu)
}
print_speed(freqs->frequency);
printf("\n");
cpufreq_put_frequencies(freqs);
cpufreq_put_available_frequencies(freqs);
}
return 0;
@ -475,7 +475,7 @@ static int get_latency(unsigned int cpu, unsigned int human)
static void debug_output_one(unsigned int cpu)
{
struct cpufreq_frequencies *freqs;
struct cpufreq_available_frequencies *freqs;
get_driver(cpu);
get_related_cpus(cpu);
@ -483,7 +483,7 @@ static void debug_output_one(unsigned int cpu)
get_latency(cpu, 1);
get_hardware_limits(cpu, 1);
freqs = cpufreq_get_frequencies("available", cpu);
freqs = cpufreq_get_available_frequencies(cpu);
if (freqs) {
printf(_(" available frequency steps: "));
while (freqs->next) {
@ -493,7 +493,7 @@ static void debug_output_one(unsigned int cpu)
}
print_speed(freqs->frequency);
printf("\n");
cpufreq_put_frequencies(freqs);
cpufreq_put_available_frequencies(freqs);
}
get_available_governors(cpu);