From nobody Wed Nov 04 17:40:05 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 4jKXlG54qDz6yZpH for ; Wed, 04 Nov 2026 17:40:10 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jKXlG3qYWz50rG for ; Wed, 04 Nov 2026 17:40:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793814010; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3EsyrjouG+/q/iEKRCs7rdCzgEKJG6jmVpcucDMwDdM=; b=Pw7Z8qzMkQ4AQdmRoIOOqL2jEub76BkHXDwGUpI1D99pfPVKov1/VKYP1kAycWXGAQxeEG +BSZpM26b3btH7nuDbGE0Tz3S6/lBoapX7gBTfQbqJmyrkyJFPjp1KBJaxUfP0jACuNUtk uYNyDeujdIn0sUHKDGC5YIA5+e7p40coKZyedmNJHZqRsTTCSuxm6TEkRlXnordVDS9mKH lnvUFoCErW4KnsmTi+DgQISVoLa8GYgcNaQPtU54rVetJ0CpuppSwBCI+ff6N2LdRfbktE dOE7I55FuJNw1CboPNMkDBlEGBZI+/KLsDVHpT/Fl5vBV2KRomTWvfhhHHAGIA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1793814010; b=rjTkiMZYwBnaoUr/4Bh6gOKt1IJFy+1k4JiFtKhsBT6rcT8/dtjSZBnW7lUAom78YqNNyv 9+BVBIfsevEzYXONu5jTGbjeF6JWDhItAySMsdIJAq2SVExhNke93IM3TEAp8CAZ1m8WWU ghKUHIgIwjaXqv633Fc4xtNsbcEW+eLmRjtsx4DOdVCaFkj+4SU2JQ+Pu3FiDp6tksXZNo Fkf/HcT2pOl8SI94zLk7Ntyx8bTLRkNOtmLk7/rD/m9HdGRqlgNuKdTven9IRBM0EIPflU oTLBrgryjJDXHdvYzreZ9Zz5q+1e+R8NM37+nDgWSma0ZH/bqy+brqdG90FiCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793814010; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3EsyrjouG+/q/iEKRCs7rdCzgEKJG6jmVpcucDMwDdM=; b=pJbLgqi+TGD0Zts9ptJnnPNmZqjXBrCpklYIJHhqAte8PGGfIkqPbKxbwxP6N6xQ5Xnt9+ lF/5tU1A9NG4/R94F9tL7mWaVEJcHr2fIVbOuWFsDQeah368AFkfJNaaZJoNGmWZOid7Aq nZHLdBvKKJuyxwLqKcVXX4JpUVWSX/1onyLSBBWjjFfY4EurY7Ln6HL6jSGU1oNG0kLIUh N8qSqmlH70dp8E75QiZxvKtMFm9+pEDR8M+PuPQbsJYjMHZqq5xIsDC2Ez6F0U+D2n9fIm QivYxyb9c1mZbgLcyBsCj1Jh2xRzjQ0BPoA5vkUsz2HwJyhVHBQoSp9NN/y/wg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jKXlG38mtz1Blx for ; Wed, 04 Nov 2026 17:40:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 27ff1 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 04 Nov 2026 17:40:05 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Andre Silva From: Mitchell Horne Subject: git: 1504307c4891 - stable/14 - hwpmc: fix false runcount assertion in user callchain capture List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: Commit messages for all branches of the src repository 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: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 1504307c4891c2f5e2efd441c2d7e94d41985141 Auto-Submitted: auto-generated Date: Wed, 04 Nov 2026 17:40:05 +0000 Message-Id: <6aeb6df5.27ff1.36cdcd5@gitrepo.freebsd.org> The branch stable/14 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=1504307c4891c2f5e2efd441c2d7e94d41985141 commit 1504307c4891c2f5e2efd441c2d7e94d41985141 Author: Andre Silva AuthorDate: 2026-08-11 16:16:20 +0000 Commit: Mitchell Horne CommitDate: 2026-11-04 17:36:03 +0000 hwpmc: fix false runcount assertion in user callchain capture pmc_capture_user_callchain() checks a PMC's runcount before walking the user stack, but reads it without holding the spinlock that protects it. hardclock() can run on the same CPU during the capture and drop the runcount to zero in between, tripping the assertion and panicking INVARIANTS kernels under load. Move the check inside the existing spinlock, right where the code already confirms the sample is still valid. No functional change on kernels built without INVARIANTS. Signed-off-by: Andre Silva Reviewed by: mhorne MFC after: 1 week Sponsored by: AMD Differential Revision: https://reviews.freebsd.org/D58571 (cherry picked from commit 66118c3f1011d7852bce8b659899179a83781897) --- sys/dev/hwpmc/hwpmc_mod.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/dev/hwpmc/hwpmc_mod.c b/sys/dev/hwpmc/hwpmc_mod.c index 0a5ee8c18e13..5495c9f793dc 100644 --- a/sys/dev/hwpmc/hwpmc_mod.c +++ b/sys/dev/hwpmc/hwpmc_mod.c @@ -4857,9 +4857,6 @@ restart: KASSERT(pm->pm_flags & PMC_F_CALLCHAIN, ("[pmc,%d] Retrieving callchain for PMC that doesn't " "want it", __LINE__)); - KASSERT(counter_u64_fetch(pm->pm_runcount) > 0, - ("[pmc,%d] runcount %ju", __LINE__, - (uintmax_t)counter_u64_fetch(pm->pm_runcount))); if (ring == PMC_UR) { nsamples = ps->ps_nsamples_actual; @@ -4886,6 +4883,10 @@ restart: * Verify that the sample hasn't been dropped in the meantime. */ if (ps->ps_nsamples == PMC_USER_CALLCHAIN_PENDING) { + KASSERT(counter_u64_fetch(pm->pm_runcount) > 0, + ("[pmc,%d] runcount %ju", __LINE__, + (uintmax_t)counter_u64_fetch(pm->pm_runcount))); + ps->ps_nsamples = nsamples; /* * If we couldn't get a sample, simply drop the