Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'turbostat' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux

Pull turbostat fweaks and fixes from Len Brown:
"Leprechaun sized fixes and tweaks touching only turbostat.

'Keeping happy users happy since 2010'"

* 'turbostat' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux:
tools/power turbostat: version 2023.03.17
tools/power turbostat: fix decoding of HWP_STATUS
tools/power turbostat: Introduce support for EMR
tools/power turbostat: remove stray newlines from warn/warnx strings
tools/power turbostat: Fix /dev/cpu_dma_latency warnings
tools/power turbostat: Provide better debug messages for failed capabilities accesses
tools/power turbostat: update dump of SECONDARY_TURBO_RATIO_LIMIT

+15 -13
+3 -1
tools/power/x86/turbostat/turbostat.8
··· 340 340 must be run as root. 341 341 Alternatively, non-root users can be enabled to run turbostat this way: 342 342 343 - # setcap cap_sys_admin,cap_sys_rawio,cap_sys_nice=+ep ./turbostat 343 + # setcap cap_sys_admin,cap_sys_rawio,cap_sys_nice=+ep path/to/turbostat 344 344 345 345 # chmod +r /dev/cpu/*/msr 346 + 347 + # chmod +r /dev/cpu_dma_latency 346 348 347 349 .B "turbostat " 348 350 reads hardware counters, but doesn't write them.
+12 -12
tools/power/x86/turbostat/turbostat.c
··· 3 3 * turbostat -- show CPU frequency and C-state residency 4 4 * on modern Intel and AMD processors. 5 5 * 6 - * Copyright (c) 2022 Intel Corporation. 6 + * Copyright (c) 2023 Intel Corporation. 7 7 * Len Brown <len.brown@intel.com> 8 8 */ 9 9 ··· 670 670 /* counter for cpu_num, including user + kernel and all processes */ 671 671 fd = perf_event_open(&pea, -1, cpu_num, -1, 0); 672 672 if (fd == -1) { 673 - warn("cpu%d: perf instruction counter", cpu_num); 673 + warnx("capget(CAP_PERFMON) failed, try \"# setcap cap_sys_admin=ep %s\"", progname); 674 674 BIC_NOT_PRESENT(BIC_IPC); 675 675 } 676 676 ··· 2538 2538 2539 2539 get_msr(base_cpu, trl_msr_offset, &msr); 2540 2540 fprintf(outf, "cpu%d: MSR_%sTURBO_RATIO_LIMIT: 0x%08llx\n", 2541 - base_cpu, trl_msr_offset == MSR_SECONDARY_TURBO_RATIO_LIMIT ? "SECONDARY" : "", msr); 2541 + base_cpu, trl_msr_offset == MSR_SECONDARY_TURBO_RATIO_LIMIT ? "SECONDARY_" : "", msr); 2542 2542 2543 2543 if (has_turbo_ratio_group_limits(family, model)) { 2544 2544 get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT1, &core_counts); ··· 3502 3502 /* 3503 3503 * set_my_sched_priority(pri) 3504 3504 * return previous 3505 - * 3506 - * if non-root, do this: 3507 - * # /sbin/setcap cap_sys_rawio,cap_sys_nice=+ep /usr/bin/turbostat 3508 3505 */ 3509 3506 int set_my_sched_priority(int priority) 3510 3507 { ··· 3515 3518 3516 3519 retval = setpriority(PRIO_PROCESS, 0, priority); 3517 3520 if (retval) 3518 - err(retval, "setpriority(%d)", priority); 3521 + errx(retval, "capget(CAP_SYS_NICE) failed,try \"# setcap cap_sys_nice=ep %s\"", progname); 3519 3522 3520 3523 errno = 0; 3521 3524 retval = getpriority(PRIO_PROCESS, 0); ··· 4423 4426 4424 4427 fprintf(outf, "cpu%d: MSR_HWP_STATUS: 0x%08llx " 4425 4428 "(%sGuaranteed_Perf_Change, %sExcursion_Min)\n", 4426 - cpu, msr, ((msr) & 0x1) ? "" : "No-", ((msr) & 0x2) ? "" : "No-"); 4429 + cpu, msr, ((msr) & 0x1) ? "" : "No-", ((msr) & 0x4) ? "" : "No-"); 4427 4430 4428 4431 return 0; 4429 4432 } ··· 5460 5463 5461 5464 case INTEL_FAM6_ICELAKE_D: 5462 5465 return INTEL_FAM6_ICELAKE_X; 5466 + 5467 + case INTEL_FAM6_EMERALDRAPIDS_X: 5468 + return INTEL_FAM6_SAPPHIRERAPIDS_X; 5463 5469 } 5464 5470 return model; 5465 5471 } ··· 5476 5476 5477 5477 fd = open(path, O_RDONLY); 5478 5478 if (fd < 0) { 5479 - warn("fopen %s\n", path); 5479 + warnx("capget(CAP_SYS_ADMIN) failed, try \"# setcap cap_sys_admin=ep %s\"", progname); 5480 5480 return; 5481 5481 } 5482 5482 5483 5483 retval = read(fd, (void *)&value, sizeof(int)); 5484 5484 if (retval != sizeof(int)) { 5485 - warn("read %s\n", path); 5485 + warn("read failed %s", path); 5486 5486 close(fd); 5487 5487 return; 5488 5488 } ··· 5543 5543 edx_flags = edx; 5544 5544 5545 5545 if (get_msr(sched_getcpu(), MSR_IA32_UCODE_REV, &ucode_patch)) 5546 - warnx("get_msr(UCODE)\n"); 5546 + warnx("get_msr(UCODE)"); 5547 5547 5548 5548 /* 5549 5549 * check max extended function levels of CPUID. ··· 6225 6225 6226 6226 void print_version() 6227 6227 { 6228 - fprintf(outf, "turbostat version 2022.10.04 - Len Brown <lenb@kernel.org>\n"); 6228 + fprintf(outf, "turbostat version 2023.03.17 - Len Brown <lenb@kernel.org>\n"); 6229 6229 } 6230 6230 6231 6231 #define COMMAND_LINE_SIZE 2048