From nobody Sun Feb 19 00:50:08 2023 X-Original-To: dev-commits-ports-branches@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 4PK6Qn1Jq3z3s8bw; Sun, 19 Feb 2023 00:50:09 +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 4PK6Qn0p11z44KW; Sun, 19 Feb 2023 00:50:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676767809; 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=m8lzLTVZ9EHowCeYzcGl2z9AbSyGL43jYUkqLtnLoJk=; b=PaLXCIpuzI3bu11czQeftojsIJ842UCU/rRbTedgU2rMHXnzCYTLnazOrIetgHR7lKzgeL CoHJe2h31Pg5lsRVgpYtF6FEEgaR4B+KFrIcHwhgSRpcAXdwy7TKCxvB9q0vXBjp9kIwB0 PVGY//KTnXcaKDiVhs7cjyTD4LlTJNg53kuo2HTWL9JPIc8zeAXmubvpdsi/ggA8//uF6F MBNOOzCxV288QZIDQgzCo/aC2KaJfaKkRM7KzSOHfKF6QC4dCiUQu5lKKgl3AWfiw0Vqx3 FA3g5aU10uwo8Vmx8h4HL77qRqXZZyu/qDTZARvsoeMsq8hFtDZoUIIAFh8hdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676767809; 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=m8lzLTVZ9EHowCeYzcGl2z9AbSyGL43jYUkqLtnLoJk=; b=A4CvE0gmRRzShebHlP54izt6PTNM4/XkVojd3rMBnq+M9q2ZXGfeCcCVtpJcWd8NiU37Gb MT6iEwKvKgjLpRCOzs32gZKRtaBtsHPRmA7fIjQUvIHGXM6WA8LO9EKC4qY7tLvwvcFMu2 QTlD+inNhukBirLMt1rOO1icdXaGIzxN1WIVJyN8s1H59iXtlj1K7CZwcN4ndyyNiQnjjV kShWgJXiXWBpcKPhNu/Ou00IMtfPr7Sq9tbo4wme3xUMj1XaJ/CWL7EIgQxaQ6BD+4SKij tCmldWiJIrUqNdArsrMo6QQNX6g1tumaYKEFZgF7BHzwOdavEkVzVtnct3HXEw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676767809; a=rsa-sha256; cv=none; b=ywlgi1JtE8t3Ssv9z3jOiBgsAmGIVBfaGgTUCcF/SBk85Ra8Rr1Irirc611UQSbnzKeelc gtmFPFAbpTIPCAbiGNXFIcs/JS9eXCd3CNJF5pQtTRMasN9/2FiVd2o2ocqC0SgDliPJQO wTjLSF2feHxUur8r5CW5k5Gi9uMlQn/tc/8s/Ibtj8S9sQH/Wlxbldp6N8UgzO2TKZB+91 2FentaQH2QkB2sFWzARgaM4O+fziRgCM8t7wSVo1zSKwYSD/Q91PmYQQfH45Ewdx5QzLia MswxhEeJFK2w5pIvIqwsQsbFZc+H85Ar7bL9jLEBSPo2qoyTgt5bpREBbRwkjw== 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 4PK6Qm6yqCzjdb; Sun, 19 Feb 2023 00:50:08 +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 31J0o81T073410; Sun, 19 Feb 2023 00:50:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J0o8UZ073407; Sun, 19 Feb 2023 00:50:08 GMT (envelope-from git) Date: Sun, 19 Feb 2023 00:50:08 GMT Message-Id: <202302190050.31J0o8UZ073407@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-branches@FreeBSD.org From: Jan Beich Subject: git: c89319e9c7b0 - 2023Q1 - sysutils/turbostat: unbreak runtime on FreeBSD >= 13.1 List-Id: Commits to the quarterly branches of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-branches@freebsd.org X-BeenThere: dev-commits-ports-branches@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/2023Q1 X-Git-Reftype: branch X-Git-Commit: c89319e9c7b0e184ebbd82549788279b04a9cf76 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch 2023Q1 has been updated by jbeich: URL: https://cgit.FreeBSD.org/ports/commit/?id=c89319e9c7b0e184ebbd82549788279b04a9cf76 commit c89319e9c7b0e184ebbd82549788279b04a9cf76 Author: Jan Beich AuthorDate: 2023-02-19 00:28:44 +0000 Commit: Jan Beich CommitDate: 2023-02-19 00:49:22 +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 (cherry picked from commit b27279cba1cad5a4f00237ddfffe11789e1c2053) --- 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); }