cpu_stepping = fms & 0xf; /* only three CascadeLake-N models are supported */ if (is_clx_n_platform()) {
FILE *fp;
size_t n = 0; char *line = NULL; int ret = 1;
fp = fopen("/proc/cpuinfo", "r"); if (!fp)
err(-1, "cannot open /proc/cpuinfo\n");
while (getline(&line, &n, fp) > 0) { if (strstr(line, "model name")) { if (strstr(line, "6252N") ||
strstr(line, "6230N") ||
strstr(line, "5218N"))
ret = 0; break;
}
}
free(line);
fclose(fp); return ret;
} return 0;
}
int api_version(void)
{ return isst_platform_info.api_version;
}
/* Open a file, and exit on failure */ static FILE *fopen_or_exit(constchar *path, constchar *mode)
{
FILE *filep = fopen(path, mode);
if (!filep)
err(1, "%s: open failed", path);
return filep;
}
/* Parse a file containing a single int */ staticint parse_int_file(int fatal, constchar *fmt, ...)
{
va_list args; char path[PATH_MAX];
FILE *filep; int value;
va_start(args, fmt);
vsnprintf(path, sizeof(path), fmt, args);
va_end(args); if (fatal) {
filep = fopen_or_exit(path, "r");
} else {
filep = fopen(path, "r"); if (!filep) return -1;
} if (fscanf(filep, "%d", &value) != 1)
err(1, "%s: failed to parse number from file", path);
fclose(filep);
return value;
}
int cpufreq_sysfs_present(void)
{
DIR *dir;
dir = opendir("/sys/devices/system/cpu/cpu0/cpufreq"); if (dir) {
closedir(dir); return 1;
}
return 0;
}
int out_format_is_json(void)
{ return out_format_json;
}
staticint get_stored_topology_info(int cpu, int *core_id, int *pkg_id, int *die_id)
{ constchar *pathname = "/var/run/isst_cpu_topology.dat"; struct cpu_topology cpu_top;
FILE *fp; int ret;
fp = fopen(pathname, "rb"); if (!fp) return -1;
ret = fseek(fp, cpu * sizeof(cpu_top), SEEK_SET); if (ret) goto err_ret;
ret = fread(&cpu_top, sizeof(cpu_top), 1, fp); if (ret != 1) {
ret = -1; goto err_ret;
}
fd = open(buffer, O_WRONLY); if (fd < 0) { if (!cpu) {
fprintf(stderr, "This system is not configured for CPU 0 online/offline\n");
fprintf(stderr, "Will use cgroup v2\n");
cpu_0_workaround(!state); return;
}
err(-1, "%s open failed", buffer);
}
if (state)
ret = write(fd, "1\n", 2); else
ret = write(fd, "0\n", 2);
if (ret == -1)
perror("Online/Offline: Operation failed\n");
close(fd);
}
staticvoid force_all_cpus_online(void)
{ int i;
fprintf(stderr, "Forcing all CPUs online\n");
for (i = 0; i < topo_max_cpus; ++i)
set_cpu_online_offline(i, 1);
unlink("/var/run/isst_cpu_topology.dat");
}
void for_each_online_power_domain_in_set(void (*callback)(struct isst_id *, void *, void *, void *, void *), void *arg1, void *arg2, void *arg3, void *arg4)
{ struct isst_id id; int cpus[MAX_PACKAGE_COUNT][MAX_DIE_PER_PACKAGE][MAX_PUNIT_PER_DIE]; int valid_mask[MAX_PACKAGE_COUNT][MAX_DIE_PER_PACKAGE] = {0}; int i, j, k;
memset(cpus, -1, sizeof(cpus));
for (i = 0; i < topo_max_cpus; ++i) { int online;
if (!CPU_ISSET_S(i, present_cpumask_size, present_cpumask)) continue;
online = parse_int_file(
i != 0, "/sys/devices/system/cpu/cpu%d/online", i); if (online < 0)
online = 1; /* online entry for CPU 0 needs some special configs */
if (cpus[id.pkg][id.die][id.punit] == -1)
cpus[id.pkg][id.die][id.punit] = i;
}
for (i = 0; i < MAX_PACKAGE_COUNT; i++) { if (max_die_id > max_pkg_id) { for (k = 0; k < MAX_PUNIT_PER_DIE && k < MAX_DIE_PER_PACKAGE; k++) {
id.cpu = cpus[i][k][k];
id.pkg = i;
id.die = get_physical_die_id(id.cpu);
id.punit = k; if (isst_is_punit_valid(&id))
callback(&id, arg1, arg2, arg3, arg4);
} continue;
}
for (j = 0; j < MAX_DIE_PER_PACKAGE; j++) { /* * Fix me: * How to check a non-cpu die for a package/die with all cpu offlined?
*/ if (!valid_mask[i][j]) continue; for (k = 0; k < MAX_PUNIT_PER_DIE; k++) {
id.cpu = cpus[i][j][k];
id.pkg = i; if (id.cpu >= 0)
id.die = get_physical_die_id(id.cpu); else
id.die = id.pkg;
id.punit = k; if (isst_is_punit_valid(&id))
callback(&id, arg1, arg2, arg3, arg4);
}
}
}
}
if (!CPU_ISSET_S(i, target_cpumask_size, target_cpumask)) continue; if (i)
online = parse_int_file(
1, "/sys/devices/system/cpu/cpu%d/online", i); else
online =
1; /* online entry for CPU 0 needs some special configs */
set_isst_id(&id, i); if (online && callback) {
callback(&id, arg1, arg2, arg3, arg4);
found = 1;
}
}
if (!found)
fprintf(stderr, "No valid CPU in the list\n");
}
int get_cpu_count(struct isst_id *id)
{ if (id->pkg < 0 || id->die < 0 || id->punit < 0) return 0;
return cpu_cnt[id->pkg][id->die][id->punit];
}
staticvoid update_punit_cpu_info(__u32 physical_cpu, struct _cpu_map *cpu_map)
{ if (api_version() > 1) { /* * MSR 0x54 format * [15:11] PM_DOMAIN_ID * [10:3] MODULE_ID (aka IDI_AGENT_ID) * [2:0] LP_ID (We don't care about these bits we only * care die and core id * For Atom: * [2] Always 0 * [1:0] core ID within module * For Core * [2:1] Always 0 * [0] thread ID
*/
cpu_map->punit_id = (physical_cpu >> 11) & 0x1f;
cpu_map->punit_cpu_core = (physical_cpu >> 3) & 0xff;
cpu_map->punit_cpu = physical_cpu & 0x7ff;
} else { int punit_id;
/* * MSR 0x53 format * Format * Bit 0 – thread ID * Bit 8:1 – core ID * Bit 13:9 – punit ID
*/
cpu_map->punit_cpu = physical_cpu & 0x1ff;
cpu_map->punit_cpu_core = (cpu_map->punit_cpu >> 1); // shift to get core id
punit_id = (physical_cpu >> 9) & 0x1f;
if (punit_id >= MAX_PUNIT_PER_DIE)
punit_id = 0;
cpu_map->punit_id = punit_id;
}
}
staticvoid create_cpu_map(void)
{ constchar *pathname = "/dev/isst_interface";
size_t size;
DIR *dir; int i, fd = 0; struct isst_if_cpu_maps map;
/* Use calloc to make sure the memory is initialized to Zero */
cpu_map = calloc(topo_max_cpus, sizeof(*cpu_map)); if (!cpu_map)
err(3, "cpumap");
fd = open(pathname, O_RDWR); if (fd < 0 && !is_clx_n_platform())
err(-1, "%s open failed", pathname);
for (i = 0; i < topo_max_cpus; ++i) { char buffer[256]; int pkg_id, die_id, core_id, punit_id;
/* check if CPU is online */
snprintf(buffer, sizeof(buffer), "/sys/devices/system/cpu/cpu%d", i);
dir = opendir(buffer); if (!dir) continue;
closedir(dir);
size = alloc_cpu_set(&target_cpumask);
target_cpumask_size = size; for (i = 0; i < max_target_cpus; ++i) { if (!CPU_ISSET_S(target_cpus[i], present_cpumask_size,
present_cpumask)) continue;
int find_phy_core_num(int logical_cpu)
{ if (logical_cpu < topo_max_cpus) return cpu_map[logical_cpu].punit_cpu_core;
return -EINVAL;
}
int use_cgroupv2(void)
{ return cgroupv2;
}
int enable_cpuset_controller(void)
{ int fd, ret;
fd = open("/sys/fs/cgroup/cgroup.subtree_control", O_RDWR, 0); if (fd < 0) {
debug_printf("Can't activate cpuset controller\n");
debug_printf("Either you are not root user or CGroup v2 is not supported\n"); return fd;
}
ret = write(fd, " +cpuset", strlen(" +cpuset"));
close(fd);
int isolate_cpus(struct isst_id *id, int mask_size, cpu_set_t *cpu_mask, int level, int cpu_0_only)
{ int i, first, curr_index, index, ret, fd; staticchar str[512], dir_name[64]; staticchar cpuset_cpus[128]; int str_len = sizeof(str);
DIR *dir;
snprintf(dir_name, sizeof(dir_name), "/sys/fs/cgroup/%d-%d-%d", id->pkg, id->die, id->punit);
dir = opendir(dir_name); if (!dir) {
ret = mkdir(dir_name, 0744); if (ret) {
debug_printf("Can't create dir:%s errno:%d\n", dir_name, errno); return ret;
}
}
closedir(dir);
if (!level) {
sprintf(cpuset_cpus, "%s/cpuset.cpus.partition", dir_name);
ret = write(fd, "isolated", strlen("isolated")); if (ret == -1) {
debug_printf("Can't update to isolated\n");
ret = write(fd, "root", strlen("root")); if (ret == -1)
debug_printf("Can't update to root\n");
}
debug_printf("isolate CPU 0 state: %d\n", isolate);
if (isolate) goto isolate;
/* First check if CPU 0 was isolated to remove isolation. */
/* If the cpuset.cpus doesn't exist, that means that none of the CPUs are isolated*/
fd = open("/sys/fs/cgroup/0-0-0/cpuset.cpus", O_RDONLY, 0); if (fd < 0) return 0;
len = read(fd, str, sizeof(str)); /* Error check, but unlikely to fail. If fails that means that not isolated */ if (len == -1) return 0;
/* Is CPU 0 is in isolate list, the display is sorted so first element will be CPU 0*/ if (str[0] != '0') {
close(fd); return 0;
}
fd1 = open("/sys/fs/cgroup/0-0-0/cpuset.cpus.partition", O_RDONLY, 0); /* Unlikely that, this attribute is not present, but handle error */ if (fd1 < 0) {
close(fd); return 0;
}
/* Is CPU 0 already changed partition to "member" */
len = read(fd1, str, sizeof(str)); if (len != -1 && str[0] == 'm') {
close(fd1);
close(fd); return 0;
}
close(fd1);
close(fd);
debug_printf("CPU 0 was isolated before, so remove isolation\n");
isolate:
ret = enable_cpuset_controller(); if (ret) goto isolate_fail;
if (isst_platform_info.api_version > supported_api_ver) {
printf("Incompatible API versions; Upgrade of tool is required\n"); return -1;
}
set_platform_ops: if (isst_set_platform_ops(isst_platform_info.api_version)) {
fprintf(stderr, "Failed to set platform callbacks\n"); exit(0);
} return 0;
}
if (mask & BIT(0)) {
fprintf(outf, "Intel(R) SST-PP (feature perf-profile) is supported\n");
} else {
fprintf(outf, "Intel(R) SST-PP (feature perf-profile) is not supported\n");
fprintf(outf, "Only performance level 0 (base level) is present\n");
}
if (mask & BIT(1))
fprintf(outf, "TDP level change control is locked\n"); else
fprintf(outf, "TDP level change control is unlocked, max level: %d\n", max_level);
if (mask & BIT(2))
fprintf(outf, "Intel(R) SST-TF (feature turbo-freq) is supported\n"); else
fprintf(outf, "Intel(R) SST-TF (feature turbo-freq) is not supported\n");
if (mask & BIT(3))
fprintf(outf, "Intel(R) SST-BF (feature base-freq) is supported\n"); else
fprintf(outf, "Intel(R) SST-BF (feature base-freq) is not supported\n");
if (isst_read_pm_config(&id, &cp_state, &cp_cap)) {
fprintf(outf, "Intel(R) SST-CP (feature core-power) status is unknown\n"); return;
}
if (cp_cap)
fprintf(outf, "Intel(R) SST-CP (feature core-power) is supported\n"); else
fprintf(outf, "Intel(R) SST-CP (feature core-power) is not supported\n");
}
staticvoid isst_print_platform_information(void)
{ if (is_clx_n_platform()) {
fprintf(stderr, "\nThis option in not supported on this platform\n"); exit(0);
}
/* Early initialization to create working cpu_map */
set_max_cpu_num();
create_cpu_map();
fprintf(outf, "Platform: API version : %d\n",
isst_platform_info.api_version);
fprintf(outf, "Platform: Driver version : %d\n",
isst_platform_info.driver_version);
fprintf(outf, "Platform: mbox supported : %d\n",
isst_platform_info.mbox_supported);
fprintf(outf, "Platform: mmio supported : %d\n",
isst_platform_info.mmio_supported);
isst_print_extended_platform_info();
fp = fopen("/proc/cpuinfo", "r"); if (!fp)
err(-1, "cannot open /proc/cpuinfo\n");
while (getline(&line, &n, fp) > 0) { if (strstr(line, "model name")) { /* this is true for CascadeLake-N */
begin = strstr(line, "@ ") + 2;
end = strstr(line, "GHz");
strncpy(number, begin, end - begin);
value = atof(number) * 10; break;
}
}
free(line);
fclose(fp);
return (int)(value);
}
staticint clx_n_config(struct isst_id *id)
{ int i, ret; unsignedlong cpu_bf; struct isst_pkg_ctdp_level_info *ctdp_level; struct isst_pbf_info *pbf_info;
/* find the frequency base ratio */
ctdp_level->tdp_ratio = clx_n_get_base_ratio(); if (ctdp_level->tdp_ratio == 0) {
debug_printf("CLX: cn base ratio is zero\n");
ret = -1; goto error_ret;
}
/* find the high and low priority frequencies */
pbf_info->p1_high = 0;
pbf_info->p1_low = ~0;
for (i = 0; i < topo_max_cpus; i++) { if (!CPU_ISSET_S(i, present_cpumask_size, present_cpumask)) continue;
cpu_bf = parse_int_file(1, "/sys/devices/system/cpu/cpu%d/cpufreq/base_frequency",
i); if (cpu_bf > pbf_info->p1_high)
pbf_info->p1_high = cpu_bf; if (cpu_bf < pbf_info->p1_low)
pbf_info->p1_low = cpu_bf;
}
if (pbf_info->p1_high == ~0UL) {
debug_printf("CLX: maximum base frequency not set\n");
ret = -1; goto error_ret;
}
if (pbf_info->p1_low == 0) {
debug_printf("CLX: minimum base frequency not set\n");
ret = -1; goto error_ret;
}
/* convert frequencies back to ratios */
pbf_info->p1_high = pbf_info->p1_high / 100000;
pbf_info->p1_low = pbf_info->p1_low / 100000;
/* create high priority cpu mask */
pbf_info->core_cpumask_size = alloc_cpu_set(&pbf_info->core_cpumask); for (i = 0; i < topo_max_cpus; i++) { if (!CPU_ISSET_S(i, present_cpumask_size, present_cpumask)) continue;
memset(&pkg_dev, 0, sizeof(pkg_dev));
ret = isst_get_process_ctdp(id, tdp_level, &pkg_dev); if (ret) {
isst_display_error_info_message(1, "Failed to get perf-profile info on cpu", 1, id->cpu);
isst_ctdp_display_information_end(outf); exit(1);
} else {
isst_ctdp_display_information(id, outf, tdp_level, &pkg_dev);
isst_get_process_ctdp_complete(id, &pkg_dev);
}
}
staticvoid dump_isst_config(int arg)
{ void *fn;
if (cmd_help) {
fprintf(stderr, "Print Intel(R) Speed Select Technology Performance profile configuration\n");
fprintf(stderr, "including base frequency and turbo frequency configurations\n");
fprintf(stderr, "Optional: -l|--level : Specify tdp level\n");
fprintf(stderr, "\tIf no arguments, dump information for all TDP levels\n"); exit(0);
}
if (!is_clx_n_platform())
fn = dump_isst_config_for_cpu; else
fn = dump_clx_n_config_for_cpu;
/* Wait for updated base frequencies */
usleep(2000);
/* Adjusting uncore freq */ if (!is_dmr_plus_platform())
isst_adjust_uncore_freq(id, tdp_level, &ctdp_level);
fprintf(stderr, "Option is set to online/offline\n");
ctdp_level.core_cpumask_size =
alloc_cpu_set(&ctdp_level.core_cpumask);
ret = isst_get_coremask_info(id, tdp_level, &ctdp_level); if (ret) {
isst_display_error_info_message(1, "Can't get coremask, online/offline option is ignored", 0, 0); goto free_mask;
}
if (use_cgroupv2()) { int ret;
fprintf(stderr, "Using cgroup v2 in lieu of online/offline\n");
ret = enable_cpuset_controller(); if (ret) goto use_offline;
ret = isolate_cpus(id, ctdp_level.core_cpumask_size,
ctdp_level.core_cpumask, tdp_level, 0); if (ret) goto use_offline;
goto free_mask;
}
use_offline: if (ctdp_level.cpu_count) { int i, max_cpus = get_topo_max_cpus(); for (i = 0; i < max_cpus; ++i) { if (!is_cpu_in_power_domain(i, id)) continue; if (CPU_ISSET_S(i, ctdp_level.core_cpumask_size, ctdp_level.core_cpumask)) {
fprintf(stderr, "online cpu %d\n", i);
set_cpu_online_offline(i, 1);
adjust_scaling_max_from_base_freq(i);
} else {
fprintf(stderr, "offline cpu %d\n", i);
set_cpu_online_offline(i, 0);
}
}
}
free_mask:
free_cpu_set(ctdp_level.core_cpumask);
}
}
staticvoid set_tdp_level(int arg)
{ if (cmd_help) {
fprintf(stderr, "Set Config TDP level\n");
fprintf(stderr, "\t Arguments: -l|--level : Specify tdp level\n");
fprintf(stderr, "\t Optional Arguments: -o | online : online/offline for the tdp level\n");
fprintf(stderr, "\t online/offline operation has limitations, refer to Linux hotplug documentation\n"); exit(0);
}
ret = isst_get_pbf_info(id, tdp_level, &pbf_info); if (ret) {
isst_display_error_info_message(1, "Failed to get base-freq info at this level", 1, tdp_level);
isst_ctdp_display_information_end(outf); exit(1);
} else {
isst_pbf_display_information(id, outf, tdp_level, &pbf_info);
free_cpu_set(pbf_info.core_cpumask);
}
}
staticvoid dump_pbf_config(int arg)
{ void *fn;
if (cmd_help) {
fprintf(stderr, "Print Intel(R) Speed Select Technology base frequency configuration for a TDP level\n");
fprintf(stderr, "\tArguments: -l|--level : Specify tdp level\n"); exit(0);
}
ret = isst_get_ctdp_levels(id, &pkg_dev); if (ret) {
isst_display_error_info_message(1, "Failed to get number of levels", 0, 0); goto disp_result;
}
ret = isst_get_ctdp_control(id, pkg_dev.current_level, &ctdp_level); if (ret) {
isst_display_error_info_message(1, "Failed to get current level", 0, 0); goto disp_result;
}
if (!ctdp_level.pbf_support) {
isst_display_error_info_message(1, "base-freq feature is not present at this level", 1, pkg_dev.current_level);
ret = -1; goto disp_result;
}
if (auto_mode && status) {
ret = set_pbf_core_power(id); if (ret) goto disp_result;
}
ret = isst_set_pbf_fact_status(id, 1, status); if (ret) {
debug_printf("isst_set_pbf_fact_status failed"); if (auto_mode)
isst_pm_qos_config(id, 0, 0);
} else { if (auto_mode) { if (status)
set_scaling_min_to_cpuinfo_max(id); else
set_scaling_min_to_cpuinfo_min(id);
}
}
if (auto_mode && !status)
isst_pm_qos_config(id, 0, 1);
staticvoid set_pbf_enable(int arg)
{ int enable = arg;
if (cmd_help) { if (enable) {
fprintf(stderr, "Enable Intel Speed Select Technology base frequency feature\n"); if (is_clx_n_platform()) {
fprintf(stderr, "\tOn this platform this command doesn't enable feature in the hardware.\n");
fprintf(stderr, "\tIt updates the cpufreq scaling_min_freq to match cpufreq base_frequency.\n"); exit(0);
}
fprintf(stderr, "\tOptional Arguments: -a|--auto : Use priority of cores to set core-power associations\n");
} else {
if (is_clx_n_platform()) {
fprintf(stderr, "\tOn this platform this command doesn't disable feature in the hardware.\n");
fprintf(stderr, "\tIt updates the cpufreq scaling_min_freq to match cpuinfo_min_freq\n"); exit(0);
}
fprintf(stderr, "Disable Intel Speed Select Technology base frequency feature\n");
fprintf(stderr, "\tOptional Arguments: -a|--auto : Also disable core-power associations\n");
} exit(0);
}
staticvoid set_fact_for_cpu(struct isst_id *id, void *arg1, void *arg2, void *arg3, void *arg4)
{ struct isst_pkg_ctdp_level_info ctdp_level; struct isst_pkg_ctdp pkg_dev; int ret; int status = *(int *)arg4;
if (status && no_turbo()) {
isst_display_error_info_message(1, "Turbo mode is disabled", 0, 0);
ret = -1; goto disp_results;
}
ret = isst_get_ctdp_levels(id, &pkg_dev); if (ret) {
isst_display_error_info_message(1, "Failed to get number of levels", 0, 0); goto disp_results;
}
ret = isst_get_ctdp_control(id, pkg_dev.current_level, &ctdp_level); if (ret) {
isst_display_error_info_message(1, "Failed to get current level", 0, 0); goto disp_results;
}
if (!ctdp_level.fact_support) {
isst_display_error_info_message(1, "turbo-freq feature is not present at this level", 1, pkg_dev.current_level);
ret = -1; goto disp_results;
}
if (status) {
ret = isst_pm_qos_config(id, 1, 1); if (ret) goto disp_results;
}
ret = isst_set_pbf_fact_status(id, 0, status); if (ret) {
debug_printf("isst_set_pbf_fact_status failed"); if (auto_mode)
isst_pm_qos_config(id, 0, 0);
goto disp_results;
}
/* Set TRL */ if (status) { struct isst_pkg_ctdp pkg_dev;
ret = isst_get_ctdp_levels(id, &pkg_dev); if (!ret && id->cpu >= 0)
ret = isst_set_trl(id, fact_trl); if (ret && auto_mode)
isst_pm_qos_config(id, 0, 0);
} else { if (auto_mode)
isst_pm_qos_config(id, 0, 0);
}
disp_results: if (status) {
isst_display_result(id, outf, "turbo-freq", "enable", ret); if (ret)
fact_enable_fail = ret;
} else { /* Since we modified TRL during Fact enable, restore it */
isst_set_trl_from_current_tdp(id, fact_trl);
isst_display_result(id, outf, "turbo-freq", "disable", ret);
}
}
staticvoid set_fact_enable(int arg)
{ int i, ret, enable = arg; struct isst_id id;
if (cmd_help) { if (enable) {
fprintf(stderr, "Enable Intel Speed Select Technology Turbo frequency feature\n");
fprintf(stderr, "Optional: -t|--trl : Specify turbo ratio limit in hex starting with 0x\n");
fprintf(stderr, "\tOptional Arguments: -a|--auto : Designate specified target CPUs with");
fprintf(stderr, "-C|--cpu option as as high priority using core-power feature\n");
} else {
fprintf(stderr, "Disable Intel Speed Select Technology turbo frequency feature\n");
fprintf(stderr, "Optional: -t|--trl : Specify turbo ratio limit in hex starting with 0x\n");
fprintf(stderr, "\tOptional Arguments: -a|--auto : Also disable core-power associations\n");
} exit(0);
}
if (!fact_enable_fail && enable && auto_mode) { /* * When we adjust CLOS param, we have to set for siblings also. * So for the each user specified CPU, also add the sibling * in the present_cpu_mask.
*/ for (i = 0; i < get_topo_max_cpus(); ++i) { char buffer[128], sibling_list[128], *cpu_str; int fd, len;
if (!CPU_ISSET_S(i, target_cpumask_size, target_cpumask)) continue;
staticvoid set_clos_config(int arg)
{ if (cmd_help) {
fprintf(stderr, "Set core-power configuration for one of the four clos ids\n");
fprintf(stderr, "\tSpecify targeted clos id with [--clos|-c]\n"); if (!is_skx_based_platform()) {
fprintf(stderr, "\tSpecify clos EPP with [--epp|-e]\n");
fprintf(stderr, "\tSpecify clos Proportional Priority [--weight|-w]\n");
}
fprintf(stderr, "\tSpecify clos min in MHz with [--min|-n]\n");
fprintf(stderr, "\tSpecify clos max in MHz with [--max|-m]\n"); exit(0);
}
if (current_clos < 0 || current_clos > 3) {
isst_display_error_info_message(1, "Invalid clos id\n", 0, 0); exit(0);
} if (!is_skx_based_platform() && (clos_epp < 0 || clos_epp > 0x0F)) {
fprintf(stderr, "clos epp is not specified or invalid, default: 0\n");
clos_epp = 0;
} if (!is_skx_based_platform() && (clos_prop_prio < 0 || clos_prop_prio > 0x0F)) {
fprintf(stderr, "clos frequency weight is not specified or invalid, default: 0\n");
clos_prop_prio = 0;
} if (clos_min < 0) {
fprintf(stderr, "clos min is not specified, default: 0\n");
clos_min = 0;
} if (clos_max < 0) {
fprintf(stderr, "clos max is not specified, default: Max frequency (ratio 0xff)\n");
clos_max = 0xff;
} if (clos_desired) {
fprintf(stderr, "clos desired is not supported on this platform\n");
clos_desired = 0x00;
}
ret = isst_clos_associate(id, current_clos); if (ret)
debug_printf("isst_clos_associate failed"); else
isst_display_result(id, outf, "core-power", "assoc", ret);
}
staticvoid set_clos_assoc(int arg)
{ if (cmd_help) {
fprintf(stderr, "Associate a clos id to a CPU\n");
fprintf(stderr, "\tSpecify targeted clos id with [--clos|-c]\n");
fprintf(stderr, "\tFor example to associate clos 1 to CPU 0: issue\n");
fprintf(stderr, "\tintel-speed-select --cpu 0 core-power assoc --clos 1\n"); exit(0);
}
ret = isst_clos_get_assoc_status(id, &clos); if (ret)
isst_display_error_info_message(1, "isst_clos_get_assoc_status failed", 0, 0); else
isst_clos_display_assoc_information(id, outf, clos);
}
staticvoid get_clos_assoc(int arg)
{ if (cmd_help) {
fprintf(stderr, "Get associate clos id to a CPU\n");
fprintf(stderr, "\tSpecify targeted cpu id with [--cpu|-c]\n"); exit(0);
}
if (!max_target_cpus) {
isst_display_error_info_message(1, "Invalid target cpu. Specify with [-c|--cpu]", 0, 0); exit(0);
}
staticvoid set_turbo_mode(int arg)
{ int i, disable = arg; struct isst_id id;
if (cmd_help) { if (disable)
fprintf(stderr, "Set turbo mode disable\n"); else
fprintf(stderr, "Set turbo mode enable\n"); exit(0);
}
isst_ctdp_display_information_start(outf);
for (i = 0; i < topo_max_cpus; ++i) { int online;
if (i)
online = parse_int_file(
1, "/sys/devices/system/cpu/cpu%d/online", i); else
online =
1; /* online entry for CPU 0 needs some special configs */
if (online) {
set_isst_id(&id, i);
set_turbo_mode_for_cpu(&id, disable);
}
}
isst_ctdp_display_information_end(outf);
}
staticvoid get_set_trl(struct isst_id *id, void *arg1, void *arg2, void *arg3, void *arg4)
{ unsignedlonglong trl; int set = *(int *)arg4; int ret;
if (id->cpu < 0) return;
if (set && !fact_trl) {
isst_display_error_info_message(1, "Invalid TRL. Specify with [-t|--trl]", 0, 0); exit(0);
}
if (set) {
ret = isst_set_trl(id, fact_trl);
isst_display_result(id, outf, "turbo-mode", "set-trl", ret); return;
}
ret = isst_get_trl(id, &trl); if (ret)
isst_display_result(id, outf, "turbo-mode", "get-trl", ret); else
isst_trl_display_information(id, outf, trl);
}
staticvoid process_trl(int arg)
{ if (cmd_help) { if (arg) {
fprintf(stderr, "Set TRL (turbo ratio limits)\n");
fprintf(stderr, "\t t|--trl: Specify turbo ratio limit for setting TRL in hex starting with 0x\n");
} else {
fprintf(stderr, "Get TRL (turbo ratio limits)\n");
} exit(0);
}
/* * parse cpuset with following syntax * 1,2,4..6,8-10 and set bits in cpu_subset
*/ void parse_cpu_command(char *optarg)
{ unsignedint start, end, invalid_count; char *next;
next = optarg;
invalid_count = 0;
while (next && *next) { if (*next == '-') /* no negative cpu numbers */
--> --------------------
--> maximum size reached
--> --------------------
Messung V0.5
¤ Dauer der Verarbeitung: 0.43 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.