From nobody Sun Feb 19 00:48:01 2023 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PK6NK5Jlyz3s8ms; Sun, 19 Feb 2023 00:48:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PK6NK4lgsz42tY; Sun, 19 Feb 2023 00:48:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676767681; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kb7hAFm9GGCufprEeqRxKhaKxUdZIiWlspeh6B3KkKA=; b=ItgbMmLOUc6hH/2rxIDRm0T3HjQQHeNlGATFTXO4xeYeTsrarqPGeG3j8DyW0DrtIrLp56 Ih/4Lwoz9leJRWbPd02YT9S7/sAXz5DLl/2fWaDk36N19DtDpKzOIRX+5qTlV7V3X9G7dS Ndo18QMZryJNa5GEUqLKnR+MNtQmgh6J+HbotJAmfOST3yvkCKytt7IeO5ikJTWVPEZ99I sXVbJPuFkA4uamWnO2rBQgjMBvEHwdfMFubXlovkGWUBMuwaQffwuya/YhC0ykNSBlPooi pHmXVvSTfkrZ70P47dRpNOz7YoScOQqEOAvjSuPVUXT8xFNBshhm+QX3LNBfRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676767681; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kb7hAFm9GGCufprEeqRxKhaKxUdZIiWlspeh6B3KkKA=; b=Acki71czy71fHPhhKPAPbYz1Dny1ASbLmdCHNkiFeW9484+b1ixDoQ0hno8YzRZe1hjqmi NmFZ3x7VH39E4bC69zyCDNvfuNU7Scbi6VWGs5eBytuhR1CaktebFOAe2/BUBzVrJDAryn HshglwkwfFjlqJrtUpWJwC3ZpwAV9ov7VX6fVbCj8KHQaQNqPhsDsTvevTgRigK1FtfrXH rmkdMx+l2JbwTshhRAk1llyjZDtghU0S9c1G2Hmtm+NuXc4VwFBezRwj79ZwXIuAVj21tW W0ZMfpKeXS6YSfF9vDaBgBftc31gqnbHnjPXOyi7ZKTAngDKj9kOtKINa98rQA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676767681; a=rsa-sha256; cv=none; b=q5QtaqIn++yTQUkyDOrTfjJdROnpGJPfvtgoox58wIkk1W+jBzhkXLnw2fqyzd2LbVSWxg jH6CO489nytOsweuJzKwJjCaQ1XawB3lg1zZeTcgJjt+TxdAtHVm5TWFcpqxhzlQ+doGzO PrDnYTl2gJODJLGi5AE/Lxz0sv2MHjbCZz2QkxvzOuUjO6qipRH/NC6YVkVCX+JmyA4GI+ JbE9HcztOMHh4mNOtnkmUQYNPZJUz05KzY+fIDeX7LiHSHnT7M9Ba7iKxbsLnnmC1eHgGb QonZe3ArJkDXF7Ap/F2p4aTkD3l/CggBWd4aTaHFcTUM8bUkait/ctVZ0Vc+wg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PK6NK3nrjzjbp; Sun, 19 Feb 2023 00:48:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J0m1U8069371; Sun, 19 Feb 2023 00:48:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J0m1JR069370; Sun, 19 Feb 2023 00:48:01 GMT (envelope-from git) Date: Sun, 19 Feb 2023 00:48:01 GMT Message-Id: <202302190048.31J0m1JR069370@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Jan Beich Subject: git: b27279cba1ca - main - sysutils/turbostat: unbreak runtime on FreeBSD >= 13.1 List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jbeich X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b27279cba1cad5a4f00237ddfffe11789e1c2053 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jbeich: URL: https://cgit.FreeBSD.org/ports/commit/?id=b27279cba1cad5a4f00237ddfffe11789e1c2053 commit b27279cba1cad5a4f00237ddfffe11789e1c2053 Author: Jan Beich AuthorDate: 2023-02-19 00:28:44 +0000 Commit: Jan Beich CommitDate: 2023-02-19 00:44:25 +0000 sysutils/turbostat: unbreak runtime on FreeBSD >= 13.1 $ turbostat turbostat version 17.06.23 - Len Brown Segmentation fault * thread #1, name = 'turbostat', stop reason = signal SIGSEGV: invalid address (fault address: 0x0) frame #0: 0x0000000000216992 turbostat`topology_probe at turbostat.c:4685:7 4682 * Validate that all cpus in cpu_subset are also in cpu_present_set 4683 */ 4684 for (i = 0; i < CPU_SUBSET_MAXCPUS; ++i) { -> 4685 if (CPU_ISSET_S(i, cpu_subset_size, cpu_subset)) 4686 if (!CPU_ISSET_S(i, cpu_present_setsize, cpu_present_set)) 4687 err(1, "cpu%d not present", i); 4688 } (lldb) bt * thread #1, name = 'turbostat', stop reason = signal SIGSEGV: invalid address (fault address: 0x0) * frame #0: 0x0000000000216992 turbostat`topology_probe at turbostat.c:4685:7 frame #1: 0x00000000002111c9 turbostat`setup_all_buffers at turbostat.c:4853:2 frame #2: 0x0000000000217909 turbostat`turbostat_init at turbostat.c:4888:2 frame #3: 0x0000000000218f3f turbostat`main(argc=1, argv=0x0000000820444710) at turbostat.c:5447:2 frame #4: 0x0000000000207160 turbostat`_start(ap=, cleanup=) at crt1_c.c:73:7 (lldb) p cpu_subset (cpu_set_t *) $0 = NULL PR: 262866 --- sysutils/turbostat/Makefile | 2 +- sysutils/turbostat/files/patch-turbostat.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/sysutils/turbostat/Makefile b/sysutils/turbostat/Makefile index b2784d3b2542..3815b4d3b8bd 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= 2 +PORTREVISION= 3 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 cbfdcb22ddda..ae33628083e8 100644 --- a/sysutils/turbostat/files/patch-turbostat.c +++ b/sysutils/turbostat/files/patch-turbostat.c @@ -23,7 +23,7 @@ +#define CPU_ALLOC(_ign) ({(cpuset_t*)malloc(sizeof(cpuset_t));}) +#define CPU_ALLOC_SIZE(_ign) sizeof(cpuset_t) +#define CPU_FREE free -+#define CPU_ISSET_S(cpu, _ign, set) (set && CPU_ISSET(cpu, set)) ++#define CPU_ISSET_S(cpu, _ign, set) CPU_ISSET(cpu, set) +#define CPU_SET_S(cpu, _ign, set) CPU_SET(cpu, set) +#define CPU_ZERO_S(_ign, set) CPU_ZERO(set) +#define sched_setaffinity(_x, _y, set) cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, sizeof(cpuset_t), set) @@ -445,6 +445,15 @@ /* * NHM adds support for additional MSRs: +@@ -4343,7 +4682,7 @@ void topology_probe() + * Validate that all cpus in cpu_subset are also in cpu_present_set + */ + for (i = 0; i < CPU_SUBSET_MAXCPUS; ++i) { +- if (CPU_ISSET_S(i, cpu_subset_size, cpu_subset)) ++ if (cpu_subset && CPU_ISSET_S(i, cpu_subset_size, cpu_subset)) + 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) for_all_proc_cpus(initialize_counters); }