git: 98b0b0a08d89 - main - tests/sys/pmc: Pass pmcstat -n before -P in pmc_callchain_ur_test

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Tue, 17 Nov 2026 13:49:13 UTC
The branch main has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=98b0b0a08d896f74b7f630145592c489fe14c987

commit 98b0b0a08d896f74b7f630145592c489fe14c987
Author:     Osvaldo Janeri Filho <ojanerif@amd.com>
AuthorDate: 2026-11-17 13:40:38 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2026-11-17 13:49:08 +0000

    tests/sys/pmc: Pass pmcstat -n before -P in pmc_callchain_ur_test
    
    pmcstat -n sets the sampling rate only for the sampling PMCs that follow
    it on the command line.  pmc_callchain_ur_test passed it after -P, so
    UR_RATE was never applied and the PMC sampled at the default rate from
    pmc_pmu_sample_rate_get(): 65536 on AMD, and 2000003 for
    inst_retired.any on Intel, about 20 times fewer samples than intended.
    
    Move -n ahead of -P in both pmcstat invocations.
    
    Reported by:    llm-postcr
    Reviewed by:    mhorne
    Fixes:          546a76463123
    Sponsored by:   Advanced Micro Devices, Inc.
    Signed-off-by:  Osvaldo Janeri Filho <ojanerif@amd.com>
    Differential Revision:  https://reviews.freebsd.org/D61458
---
 tests/sys/pmc/pmc_callchain_ur_test.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/sys/pmc/pmc_callchain_ur_test.sh b/tests/sys/pmc/pmc_callchain_ur_test.sh
index eb4dafe8ce5d..489c6f3185a9 100644
--- a/tests/sys/pmc/pmc_callchain_ur_test.sh
+++ b/tests/sys/pmc/pmc_callchain_ur_test.sh
@@ -54,7 +54,7 @@ ur_pick_event()
 	local ev
 
 	for ev in $UR_EVENTS; do
-		if pmcstat -P "$ev" -n "$UR_RATE" -O ur_probe.pmc \
+		if pmcstat -n "$UR_RATE" -P "$ev" -O ur_probe.pmc \
 		    -- /usr/bin/true >/dev/null 2>&1; then
 			printf '%s\n' "$ev"
 			return 0
@@ -85,7 +85,7 @@ pmcstat_U_survives_and_samples_body()
 	    "(tried: $UR_EVENTS)"
 
 	atf_check -s exit:0 -o ignore -e ignore \
-	    pmcstat -U -P "$ev" -n "$UR_RATE" -O ur_capture.pmc \
+	    pmcstat -U -n "$UR_RATE" -P "$ev" -O ur_capture.pmc \
 	    -- ./ur_load.sh 4
 
 	after=$(sysctl -n kern.hwpmc.stats.merges)