From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 183BD3858D33; Tue, 14 Feb 2023 12:15:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 183BD3858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1676376953; bh=MaWAbzRICKs0nHODEh6rJUHc6+FOLwy2QzY10Tz5R08=; h=From:To:Subject:Date:From; b=xJeH4AwPwQpDBtQ7uYoiMcjPWvQ8V6CRDqkuoWFCvztVvuUS2aqP7OTyu8c0c6h+2 k6bSg1KPtkWoPfz1WIewlYfFUagHyylPA5IyP4rxYwaTlDPMuqhRXq1SKU5Bhkd44U vSA3Nl0iexjdY9Vy0vdgSG10jj9cctLjUpTdzn34= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Add xfail in gdb.python/py-record-btrace.exp X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 9b38b85ec31798d68633970c88921875928c4c39 X-Git-Newrev: 5bed9dc992a0136d403a7addb29a2ed822fd4fd2 Message-Id: <20230214121553.183BD3858D33@sourceware.org> Date: Tue, 14 Feb 2023 12:15:53 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D5bed9dc992a0= 136d403a7addb29a2ed822fd4fd2 commit 5bed9dc992a0136d403a7addb29a2ed822fd4fd2 Author: Tom de Vries Date: Tue Feb 14 13:15:49 2023 +0100 [gdb/testsuite] Add xfail in gdb.python/py-record-btrace.exp =20 There's a HW bug affecting Processor Trace on some Intel processors (Ice Lake to Raptor Lake microarchitectures). =20 The bug was exposed by linux kernel commit 670638477aed ("perf/x86/intel/pt: Opportunistically use single range output mode"), added in version v5.5.0, and was worked around by commit ce0d998be927 ("perf/x86/intel/pt: Fix sampling using single range output") in version 6.1.0. =20 The bug manifests (on a Performance-core of an i7-1250U, an Alder Lake = cpu) in a single test-case: ... (gdb) python insn =3D r.instruction_history^M warning: Decode error (-20) at instruction 33 (offset =3D 0x3d6a, \ pc =3D 0x400501): compressed return without call.^M (gdb) FAIL: gdb.python/py-record-btrace.exp: prepare record: \ python insn =3D r.instruction_history ... =20 Add a corresponding XFAIL. =20 Note that the i7-1250U has both Performance-cores and Efficient-cores, = and on an Efficient-Core the test-case runs without any problems, so if the te= stsuite run is not pinned to a specific cpu, the test may either PASS or XFAIL. =20 Tested on x86_64-linux: - openSUSE Leap 15.4 with linux kernel version 5.14.21 - openSUSE Tumbleweed with linux kernel version 6.1.8 =20 PR testsuite/30075 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30075 Diff: --- gdb/testsuite/gdb.python/py-record-btrace.exp | 43 +++++++++++++++++++++++= +++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.python/py-record-btrace.exp b/gdb/testsuite/= gdb.python/py-record-btrace.exp index 555b70ae336..c055a882f85 100644 --- a/gdb/testsuite/gdb.python/py-record-btrace.exp +++ b/gdb/testsuite/gdb.python/py-record-btrace.exp @@ -54,7 +54,48 @@ with_test_prefix "prepare record" { gdb_test "python print(r.method)" "btrace" gdb_test "python print(r.format)" "pt|bts" gdb_test "stepi 100" ".*" - gdb_test_no_output "python insn =3D r.instruction_history" + + # There's a HW bug affecting Processor Trace on some Intel processors. + # The bug was exposed by linux kernel commit 670638477aed + # ("perf/x86/intel/pt: Opportunistically use single range output mode"= ), + # added in version v5.5.0, and was worked around by commit ce0d998be927 + # ("perf/x86/intel/pt: Fix sampling using single range output") in ver= sion + # 6.1.0. Detect the kernel version range for which the problem may + # manifest. + set have_xfail 0 + set v [linux_kernel_version] + if { $v !=3D {} } { + set have_xfail \ + [expr [version_compare [list 5 5 0] <=3D $v] \ + && [version_compare $v < [list 6 1 0]]] + } + set nonl_re \[^\r\n\] + set xfail_re \ + [join \ + [list \ + "warning: Decode error \\($nonl_re*\\) at instruction $decimal" \ + "\\(offset =3D $hex, pc =3D $hex\\):" \ + "$nonl_re*\\."]] + + set got_xfail 0 + set cmd "python insn =3D r.instruction_history" + gdb_test_multiple $cmd "" { + -re "^[string_to_regexp $cmd]\r\n$::gdb_prompt $" { + pass $gdb_test_name + } + -re -wrap "$xfail_re" { + if { $have_xfail } { + xfail $gdb_test_name + set got_xfail 1 + } else { + fail $gdb_test_name + } + } + } + if { $got_xfail } { + return + } + gdb_test_no_output "python call =3D r.function_call_history" gdb_test_no_output "python i =3D insn\[0\]" gdb_test_no_output "python c =3D call\[0\]"