From nobody Sat Feb 7 18:28:41 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C99DA1581E5; Wed, 10 Apr 2024 10:35:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712745326; cv=none; b=XNMIhZ/9gym1+7wLypib5VPAtfnBlSwmW6eGpd3AMuU8uZdz1jcLHWpqy02Ah/CuPJMDAqn7HKTpGUVjc01ode1Id3aIfx6YsQIYyJCs5Xlt0eHONeiz/Q8N0ivHvGKSTvv50C+kIpLIXP2syaFHvwCq1RJYeOslFl+D/r/G3eM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712745326; c=relaxed/simple; bh=A4edVE/D8u1t1sQx4i9oqjQfzNIjaTh9JSqLAHcrSms=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nkgPJ0TahU/SL6qA1x312ptKpldmP/0W3aYI6XyDPQps69ZLm1o1GUPW+ErYBsX299TmYYNHb1bxyt6WYALQjJnWhdcoNzBvqfllTngT059aYHb1/SioZyxFZJ8Mi0HY08EJgGv4V+XzJ55M5+aae3mXcGZMiYJaq78U14GijW8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1038B1480; Wed, 10 Apr 2024 03:35:54 -0700 (PDT) Received: from e127643.broadband (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A34263F6C4; Wed, 10 Apr 2024 03:35:21 -0700 (PDT) From: James Clark To: linux-perf-users@vger.kernel.org, irogers@google.com, namhyung@kernel.org Cc: James Clark , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , "Liang, Kan" , Athira Rajeev , Spoorthy S , Leo Yan , linux-kernel@vger.kernel.org Subject: [PATCH v2 1/4] perf tests: Make "test data symbol" more robust on Neoverse N1 Date: Wed, 10 Apr 2024 11:34:52 +0100 Message-Id: <20240410103458.813656-2-james.clark@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240410103458.813656-1-james.clark@arm.com> References: <20240410103458.813656-1-james.clark@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" To prevent anyone from seeing a test failure appear as a regression and thinking that it was caused by their code change, insert some noise into the loop which makes it immune to sampling bias issues (errata 1694299). The "test data symbol" test can fail with any unrelated change that shifts the loop into an unfortunate position in the Perf binary which is almost impossible to debug as the root cause of the test failure. Ultimately it's caused by the referenced errata. Fixes: 60abedb8aa90 ("perf test: Introduce script for data symbol testing") Signed-off-by: James Clark Acked-by: Namhyung Kim Reviewed-by: Ian Rogers --- tools/perf/tests/workloads/datasym.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tools/perf/tests/workloads/datasym.c b/tools/perf/tests/worklo= ads/datasym.c index ddd40bc63448..8e08fc75a973 100644 --- a/tools/perf/tests/workloads/datasym.c +++ b/tools/perf/tests/workloads/datasym.c @@ -16,6 +16,22 @@ static int datasym(int argc __maybe_unused, const char *= *argv __maybe_unused) { for (;;) { buf1.data1++; + if (buf1.data1 =3D=3D 123) { + /* + * Add some 'noise' in the loop to work around errata + * 1694299 on Arm N1. + * + * Bias exists in SPE sampling which can cause the load + * and store instructions to be skipped entirely. This + * comes and goes randomly depending on the offset the + * linker places the datasym loop at in the Perf binary. + * With an extra branch in the middle of the loop that + * isn't always taken, the instruction stream is no + * longer a continuous repeating pattern that interacts + * badly with the bias. + */ + buf1.data1++; + } buf1.data2 +=3D buf1.data1; } return 0; --=20 2.34.1 From nobody Sat Feb 7 18:28:41 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3FB501581E5; Wed, 10 Apr 2024 10:35:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712745331; cv=none; b=chuf4Z7FDo2XtthYOXWnYyzdvtIGFzvQmzByaUtylPyuk+MlMPhQgGD1ndQXyUOt/ukzhCYW6DrTRFwmWogr7XI0dtviEjLC7Fkwf9xFlDZkEtc/o9MxOTQ20PilIpw7ld1WIYKT0RrSmyWubUspedA+XF4AlcKGeBodqM8S7LQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712745331; c=relaxed/simple; bh=KeD4xL0gB/xCATWdOFUs5Nts/UM0E+U+CU8Lg6aBHO0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=d0hJ19PvPGVy4KJKFKSLA1/WxoImQjpLOYs1r9MHbysVd7oc8IBMAqFKUCGNBo/2z8ODVpa/n3J8Calwy2ZJiA/wszsaDkq+mumrqDn0LkDxNOPw2zbd5Rmlo+BgXLF7PWhjEc0siGS5m7GcBQnLQtKp+WFh4nwcXDDyPzP9/gI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CA457139F; Wed, 10 Apr 2024 03:35:59 -0700 (PDT) Received: from e127643.broadband (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6538A3F6C4; Wed, 10 Apr 2024 03:35:27 -0700 (PDT) From: James Clark To: linux-perf-users@vger.kernel.org, irogers@google.com, namhyung@kernel.org Cc: James Clark , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , "Liang, Kan" , Athira Rajeev , Spoorthy S , Leo Yan , linux-kernel@vger.kernel.org Subject: [PATCH v2 2/4] perf tests: Apply attributes to all events in object code reading test Date: Wed, 10 Apr 2024 11:34:53 +0100 Message-Id: <20240410103458.813656-3-james.clark@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240410103458.813656-1-james.clark@arm.com> References: <20240410103458.813656-1-james.clark@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" PERF_PMU_CAP_EXTENDED_HW_TYPE results in multiple events being opened on heterogeneous systems. Currently this test only sets its required attributes on the first event. Not disabling enable_on_exec on the other events causes the test to fail because the forked objdump processes are sampled. No tracking event is opened so Perf only knows about its own mappings causing the objdump samples to give the following error: $ perf test -vvv "object code reading" Reading object code for memory address: 0xffff9aaa55ec thread__find_map failed ---- end(-1) ---- 24: Object code reading : FAILED! Fixes: 251aa040244a ("perf parse-events: Wildcard most "numeric" events") Signed-off-by: James Clark Acked-by: Namhyung Kim Reviewed-by: Ian Rogers --- tools/perf/tests/code-reading.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-readin= g.c index 7a3a7bbbec71..29d2f3ee4e10 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c @@ -637,11 +637,11 @@ static int do_test_code_reading(bool try_kcore) =20 evlist__config(evlist, &opts, NULL); =20 - evsel =3D evlist__first(evlist); - - evsel->core.attr.comm =3D 1; - evsel->core.attr.disabled =3D 1; - evsel->core.attr.enable_on_exec =3D 0; + evlist__for_each_entry(evlist, evsel) { + evsel->core.attr.comm =3D 1; + evsel->core.attr.disabled =3D 1; + evsel->core.attr.enable_on_exec =3D 0; + } =20 ret =3D evlist__open(evlist); if (ret < 0) { --=20 2.34.1 From nobody Sat Feb 7 18:28:41 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 255DD159566; Wed, 10 Apr 2024 10:35:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712745337; cv=none; b=Rm+IyYd1d2aHqxws33385p91PfhtoLSVhugEBpw+xbMgM7PezH1/tl8BnWHXxmZobvYe4lF8mWRF7Uh+8N0nAKK2dvn6CFhKo2x2oYOcftJH1DH0OX+HykusEWWmbhQxpMOgC/GdrOx6PPcQffJ1WwjtNtsRKxDgEJPDYjcjek0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712745337; c=relaxed/simple; bh=ypMirJBQln4cahP5+iyf5ns4VS6WkKkpnbUKpCIXRMM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=r5SCfGFAWixfFpfFPGS23j2SYO3JUW9QnhdbW95O5ZbjAfRJ86CNnSC80+Iz5CLqFD9H5tnryVzGS2e5Gsrk+6NNQ5Keo9llUemiEwGySxv1ltTwG0NErSzr6QPE811D/RGUomnz3wxFd52U+U4S1TGyfc9WjBj+sItPW8fKufw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6F50B139F; Wed, 10 Apr 2024 03:36:05 -0700 (PDT) Received: from e127643.broadband (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 278903F6C4; Wed, 10 Apr 2024 03:35:33 -0700 (PDT) From: James Clark To: linux-perf-users@vger.kernel.org, irogers@google.com, namhyung@kernel.org Cc: James Clark , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , "Liang, Kan" , Athira Rajeev , Spoorthy S , Leo Yan , linux-kernel@vger.kernel.org Subject: [PATCH v2 3/4] perf map: Remove kernel map before updating start and end addresses Date: Wed, 10 Apr 2024 11:34:54 +0100 Message-Id: <20240410103458.813656-4-james.clark@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240410103458.813656-1-james.clark@arm.com> References: <20240410103458.813656-1-james.clark@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In a debug build there is validation that mmap lists are sorted when taking a lock. In machine__update_kernel_mmap() the start and end addresses are updated resulting in an unsorted list before the map is removed from the list. When the map is removed, the lock is taken which triggers the validation and the failure: $ perf test "object code reading" --- start --- perf: util/maps.c:88: check_invariants: Assertion `map__start(prev) <=3D = map__start(map)' failed. Aborted Fix it by updating the addresses after removal, but before insertion. The bug depends on the ordering and type of debug info on the system and doesn't reproduce everywhere. Fixes: 659ad3492b91 ("perf maps: Switch from rbtree to lazily sorted array = for addresses") Signed-off-by: James Clark Acked-by: Namhyung Kim Reviewed-by: Ian Rogers --- tools/perf/util/machine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 5eb9044bc223..a26c8bea58d0 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -1549,8 +1549,8 @@ static int machine__update_kernel_mmap(struct machine= *machine, updated =3D map__get(orig); =20 machine->vmlinux_map =3D updated; - machine__set_kernel_mmap(machine, start, end); maps__remove(machine__kernel_maps(machine), orig); + machine__set_kernel_mmap(machine, start, end); err =3D maps__insert(machine__kernel_maps(machine), updated); map__put(orig); =20 --=20 2.34.1 From nobody Sat Feb 7 18:28:41 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D7D4A159579; Wed, 10 Apr 2024 10:35:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712745343; cv=none; b=BD8SyZ1FAmfAr5MQ5Iysq+jNlvp/4PAx0szLEbstWqQQ9xWaWwRz8q+qYvqgnN3mshhlpCF3Ymsrrvudz5NFN4VYrHRiKVwOhdZfZQGoY1yguX3v6Bxc70RT4qj51gnYgauFTNxD5H6WWA+z2bPdjFYWtqSpMDOzY2o22HYn1Es= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712745343; c=relaxed/simple; bh=9aILlYrIgOm+n9CT/ZjWYY7i2lGa7W4SA++r24ozcDk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=IZVBcDfxCDjeYm9LElEnvocZUB025S49ClchMBMLIYu4JuJzT58HqQy3T1hf7fUZZn2lJorJXPffpf1+ZeXBoOeA7bVE0c3PVydLPNpduQWapNxYu/eXCAdMuJPJS4EQD7KjAong3n9+YHoTn63YHzx/gC7cmMJcArCeXN3wj/c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D8E0D1480; Wed, 10 Apr 2024 03:36:10 -0700 (PDT) Received: from e127643.broadband (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C94E53F6C4; Wed, 10 Apr 2024 03:35:38 -0700 (PDT) From: James Clark To: linux-perf-users@vger.kernel.org, irogers@google.com, namhyung@kernel.org Cc: James Clark , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , "Liang, Kan" , Athira Rajeev , Spoorthy S , Leo Yan , linux-kernel@vger.kernel.org Subject: [PATCH v2 4/4] perf tests: Remove dependency on lscpu Date: Wed, 10 Apr 2024 11:34:55 +0100 Message-Id: <20240410103458.813656-5-james.clark@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240410103458.813656-1-james.clark@arm.com> References: <20240410103458.813656-1-james.clark@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This check can be done with uname which is more portable. At the same time re-arrange it into a standard if statement so that it's more readable. Signed-off-by: James Clark Acked-by: Namhyung Kim Reviewed-by: Ian Rogers --- tools/perf/tests/shell/test_arm_callgraph_fp.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/perf/tests/shell/test_arm_callgraph_fp.sh b/tools/perf/t= ests/shell/test_arm_callgraph_fp.sh index 83b53591b1ea..61898e256616 100755 --- a/tools/perf/tests/shell/test_arm_callgraph_fp.sh +++ b/tools/perf/tests/shell/test_arm_callgraph_fp.sh @@ -6,7 +6,9 @@ shelldir=3D$(dirname "$0") # shellcheck source=3Dlib/perf_has_symbol.sh . "${shelldir}"/lib/perf_has_symbol.sh =20 -lscpu | grep -q "aarch64" || exit 2 +if [ "$(uname -m)" !=3D "aarch64" ]; then + exit 2 +fi =20 if perf version --build-options | grep HAVE_DWARF_UNWIND_SUPPORT | grep -q= OFF then --=20 2.34.1