From nobody Sun Aug 23 08:11:34 2026 X-Original-To: dev-commits-src-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 4hSRZz6GL2z6q09g for ; Sun, 23 Aug 2026 08:11:39 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hSRZz3FCdz4LG5 for ; Sun, 23 Aug 2026 08:11:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1787472699; 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=8+BhPo4Lm19ZC9ybFPlBnYAAqCXlRs3Rcpd6vu/ds90=; b=PkNvGuVOWksg7e6fDMya7Q7eJhSz93qn0Zs1DUG3DtOM8II6mOoyK01cBT2cGXufaXBaQQ gCU44RNSOMWyOxZIBNtOnHXuSxuJHXD449JwdLyDcEXRk6P67R4d+k49FIpeH/dFllNUua UP/ErTBsntj/spR9tcS+/7l8oq9Y0rMTL3eTZr3ENUl8+LKOS/v6ljquMHBIxdnPpBuX1p 0gcs77Gkz3M66EtEHq8P6smcq1Mr9pmiDtmpYBO5fBZs3CHaGytmen4VONCBBTj9889X4m rKcKrV9tBzHHTlANRKNsu0/jS8Q4vzWQeEEAdR2Hvisy8hbvZX9+lbhnNWeJ2w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1787472699; a=rsa-sha256; cv=none; b=oU/Od+fGbGu12vcqNt0WGevBGVezIUgnxz+sHQBGGCXycCB9lezrmrZxlnAp8f5qNwP9ws 0enpg64Uuus7o5fJEr1MV1DB7eY77+nsEJYFoOJN15AgetYnGBb0u4yZUZBt+uZXkHRzrY wYF7FA3zjhyXrBq0k2/kkjbZIRIZv2pWMvvAdqlUbQglstLn6WXFrkrdEyan65c0entKJT RKjNcGtf9vVLIiZeRerFqvQxuVMSPUpn52mW0rCDJZJLpU8TZN8ZLj9WqMLiUhUpavrDB9 kpVIxdgR9QbAadk7K+1EMVr4lw1c8Y0hC4MYRTQZsf6kB/F4ggtKsj+r6tyXxw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1787472699; 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=8+BhPo4Lm19ZC9ybFPlBnYAAqCXlRs3Rcpd6vu/ds90=; b=flUhs4ONT052PxvUUuc6MFqQX2+U8T52DqvArxXXoMD3HFOVcyz2/NY73CRHMLDgEfizcl 66/AFzGJFNXsoq5f6IaS7V6agydlVR2I01rIbqkJ7n3ZrkG3bFXRgAAYY4DIsJmvtq+/P7 XwvtDyEmi8G2wm1NZh92Qwny0dVvHQEiM2CuTw1jCBoqXwOmhNBbFVqVgF7HZM5d6vjF4W vhQdQ1FGdEqiBgRfbi/oozzb+SfLfVmaEW5YGbjKdKs6ShIzao1Iju10tVXyt4+QqeVcwD 50ykidIo3qe9xd3gC7ugd7Bh6bsFKTntby15V3ZAtUl6I9aJCPJPAzHyLttnfQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hSRZz0sG0z1NWp for ; Sun, 23 Aug 2026 08:11:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 409d5 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 23 Aug 2026 08:11:34 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Leidinger Subject: git: 469727f0637b - main - hwpmc: probe the RAPL unit MSR instead of faulting on it List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: netchild X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 469727f0637beec05e0478c1391e3df1e684e53c Auto-Submitted: auto-generated Date: Sun, 23 Aug 2026 08:11:34 +0000 Message-Id: <6a8aab36.409d5.73d116bc@gitrepo.freebsd.org> The branch main has been updated by netchild: URL: https://cgit.FreeBSD.org/src/commit/?id=469727f0637beec05e0478c1391e3df1e684e53c commit 469727f0637beec05e0478c1391e3df1e684e53c Author: Alexander Leidinger AuthorDate: 2026-08-21 22:29:05 +0000 Commit: Alexander Leidinger CommitDate: 2026-08-23 08:09:20 +0000 hwpmc: probe the RAPL unit MSR instead of faulting on it The RAPL probe read MSR_RAPL_POWER_UNIT with a bare rdmsr(). RAPL is not enumerated by CPUID on either vendor and the register is absent on older Intel and AMD parts and under a hypervisor that does not emulate it, so the read raises #GP and loading hwpmc panics the machine. Read it with rdmsr_safe() and return ENXIO when it is not there, as this function already does for the energy MSRs. Both callers already drop the class when the probe fails. Fixes: a99d04f39dab ("hwpmc: add RAPL energy-counter class (AMD + Intel)") Assisted-by: Claude Code (Opus 5) --- sys/dev/hwpmc/hwpmc_rapl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/hwpmc/hwpmc_rapl.c b/sys/dev/hwpmc/hwpmc_rapl.c index b4a105a86dbb..4ca76bc12403 100644 --- a/sys/dev/hwpmc/hwpmc_rapl.c +++ b/sys/dev/hwpmc/hwpmc_rapl.c @@ -532,7 +532,8 @@ pmc_rapl_initialize(struct pmc_mdep *md, int maxcpu, int classindex) } /* Decode the energy unit. */ - unit_val = rdmsr(unit_msr); + if (rdmsr_safe(unit_msr, &unit_val) != 0) + return (ENXIO); esu = (unit_val >> 8) & 0x1f; dram_unit = rapl_intel_fixed_dram_unit() ? 16 : esu;