Date: Mon, 16 Dec 2024 16:39:21 GMT From: Michael Zhilin <mizhka@FreeBSD.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org Subject: git: f79bebc91f4a - main - sysutils/turbostat: fix bus error on Intel(R) Core(TM) Ultra 7 155H Message-ID: <202412161639.4BGGdL2d061527@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by mizhka: URL: https://cgit.FreeBSD.org/ports/commit/?id=f79bebc91f4aa4ba68dc60bd44c4483c9b5272eb commit f79bebc91f4aa4ba68dc60bd44c4483c9b5272eb Author: Michael Zhilin <mizhka@FreeBSD.org> AuthorDate: 2024-12-16 16:30:29 +0000 Commit: Michael Zhilin <mizhka@FreeBSD.org> CommitDate: 2024-12-16 16:33:41 +0000 sysutils/turbostat: fix bus error on Intel(R) Core(TM) Ultra 7 155H This patch makes turbostat working on Intel(R) Core(TM) Ultra 7 155H Patch is straighforward to avoid "-1" as argument for cpuset PR: 283007 Reviewed by: fuz Sponsored by: Postgres Professional --- sysutils/turbostat/Makefile | 2 +- sysutils/turbostat/files/patch-turbostat.c | 48 ++++++++++++++++++++---------- 2 files changed, 34 insertions(+), 16 deletions(-) diff --git a/sysutils/turbostat/Makefile b/sysutils/turbostat/Makefile index 89857796c7e2..e571e70b8455 100644 --- a/sysutils/turbostat/Makefile +++ b/sysutils/turbostat/Makefile @@ -1,6 +1,6 @@ PORTNAME= turbostat PORTVERSION= 4.17 # Turbostat itself has a version, but we don't bother -PORTREVISION= 4 +PORTREVISION= 5 CATEGORIES= sysutils MASTER_SITES= https://raw.githubusercontent.com/torvalds/linux/v${PORTVERSION}/tools/power/x86/turbostat/ \ https://raw.githubusercontent.com/torvalds/linux/v${PORTVERSION}/arch/x86/include/asm/ diff --git a/sysutils/turbostat/files/patch-turbostat.c b/sysutils/turbostat/files/patch-turbostat.c index ae33628083e8..3f6e965c71bb 100644 --- a/sysutils/turbostat/files/patch-turbostat.c +++ b/sysutils/turbostat/files/patch-turbostat.c @@ -1,4 +1,4 @@ ---- turbostat.c.orig 2020-11-13 21:55:04 UTC +--- turbostat.c.orig 2024-11-27 14:24:16 UTC +++ turbostat.c @@ -41,7 +41,34 @@ #include <sched.h> @@ -35,7 +35,7 @@ #include <errno.h> char *proc_stat = "/proc/stat"; -@@ -132,7 +156,9 @@ unsigned int has_misc_feature_control; +@@ -132,7 +159,9 @@ unsigned int has_misc_feature_control; #define RAPL_CORES (RAPL_CORES_ENERGY_STATUS | RAPL_CORES_POWER_LIMIT) #define TJMAX_DEFAULT 100 @@ -45,7 +45,16 @@ /* * buffer size used by sscanf() for added column names -@@ -309,6 +335,7 @@ int cpu_migrate(int cpu) +@@ -285,7 +314,7 @@ int for_all_cpus(int (func)(struct thread_data *, stru + + t = GET_THREAD(thread_base, thread_no, core_no, pkg_no); + +- if (cpu_is_not_present(t->cpu_id)) ++ if (((int)t->cpu_id) < 0 || cpu_is_not_present(t->cpu_id)) + continue; + + c = GET_CORE(core_base, core_no, pkg_no); +@@ -309,6 +338,7 @@ int cpu_migrate(int cpu) else return 0; } @@ -53,7 +62,7 @@ int get_msr_fd(int cpu) { char pathname[32]; -@@ -319,18 +346,39 @@ int get_msr_fd(int cpu) +@@ -319,18 +349,39 @@ int get_msr_fd(int cpu) if (fd) return fd; @@ -94,7 +103,7 @@ ssize_t retval; retval = pread(get_msr_fd(cpu), msr, sizeof(*msr), offset); -@@ -340,6 +388,7 @@ int get_msr(int cpu, off_t offset, unsigned long long +@@ -340,6 +391,7 @@ int get_msr(int cpu, off_t offset, unsigned long long return 0; } @@ -102,7 +111,7 @@ /* * Each string in this array is compared in --show and --hide cmdline. -@@ -2239,6 +2288,181 @@ int parse_int_file(const char *fmt, ...) +@@ -2239,6 +2291,181 @@ int parse_int_file(const char *fmt, ...) return value; } @@ -284,7 +293,7 @@ /* * get_cpu_position_in_core(cpu) * return the position of the CPU among its HT siblings in the core -@@ -2326,6 +2546,7 @@ int get_num_ht_siblings(int cpu) +@@ -2326,6 +2553,7 @@ int get_num_ht_siblings(int cpu) fclose(filep); return matches+1; } @@ -292,7 +301,16 @@ /* * run func(thread, core, package) in topology order -@@ -2371,6 +2592,22 @@ int for_all_cpus_2(int (func)(struct thread_data *, st +@@ -2351,7 +2579,7 @@ int for_all_cpus_2(int (func)(struct thread_data *, st + + t = GET_THREAD(thread_base, thread_no, core_no, pkg_no); + +- if (cpu_is_not_present(t->cpu_id)) ++ if (((int)t->cpu_id) < 0 || cpu_is_not_present(t->cpu_id)) + continue; + + t2 = GET_THREAD(thread_base2, thread_no, core_no, pkg_no); +@@ -2371,6 +2599,22 @@ int for_all_cpus_2(int (func)(struct thread_data *, st return 0; } @@ -315,7 +333,7 @@ /* * run func(cpu) on every cpu in /proc/stat * return max_cpu number -@@ -2401,6 +2638,7 @@ int for_all_proc_cpus(int (func)(int)) +@@ -2401,6 +2645,7 @@ int for_all_proc_cpus(int (func)(int)) fclose(fp); return 0; } @@ -323,7 +341,7 @@ void re_initialize(void) { -@@ -2428,6 +2666,85 @@ int mark_cpu_present(int cpu) +@@ -2428,6 +2673,85 @@ int mark_cpu_present(int cpu) return 0; } @@ -409,7 +427,7 @@ /* * snapshot_proc_interrupts() * -@@ -2491,6 +2808,8 @@ int snapshot_proc_interrupts(void) +@@ -2491,6 +2815,8 @@ int snapshot_proc_interrupts(void) } return 0; } @@ -418,7 +436,7 @@ /* * snapshot_gfx_rc6_ms() * -@@ -2629,6 +2948,18 @@ restart: +@@ -2629,6 +2955,18 @@ restart: } } @@ -437,7 +455,7 @@ void check_dev_msr() { struct stat sb; -@@ -2677,6 +3008,7 @@ void check_permissions() +@@ -2677,6 +3015,7 @@ void check_permissions() if (do_exit) exit(-6); } @@ -454,7 +472,7 @@ if (!CPU_ISSET_S(i, cpu_present_setsize, cpu_present_set)) err(1, "cpu%d not present", i); } -@@ -4520,8 +4852,21 @@ void setup_all_buffers(void) +@@ -4520,8 +4859,21 @@ void setup_all_buffers(void) for_all_proc_cpus(initialize_counters); } @@ -476,7 +494,7 @@ base_cpu = sched_getcpu(); if (base_cpu < 0) err(-ENODEV, "No valid cpus found"); -@@ -4529,6 +4874,7 @@ void set_base_cpu(void) +@@ -4529,6 +4881,7 @@ void set_base_cpu(void) if (debug > 1) fprintf(outf, "base_cpu = %d\n", base_cpu); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202412161639.4BGGdL2d061527>