From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id s458GdVM7GCMbgAAWB0awg (envelope-from ) for ; Mon, 12 Jul 2021 10:08:21 -0400 Received: by simark.ca (Postfix, from userid 112) id 5F1021EDEC; Mon, 12 Jul 2021 10:08:21 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 815121E54D for ; Mon, 12 Jul 2021 10:08:20 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3DA903838006 for ; Mon, 12 Jul 2021 14:08:20 +0000 (GMT) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id C1D553855023 for ; Mon, 12 Jul 2021 14:05:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C1D553855023 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id E43521FFA2; Mon, 12 Jul 2021 14:05:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1626098748; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=lXTZuJS/mw5JRhQ5nuKwK5t2GXCm5iBJA/0UnyjpT44=; b=tFkvhFP6ZR1qFACX5WvSmhSOrLX4+NOGwv1oOxhKjLEWWyhQhq93wV06N+RZLeVZGL73za tvswuxkdF7AKB+ftRSS6Es5hkjZwiCaaD1mloWQeRVGDeSIljzu0/T7OpOcnADu+z5d7NT 0iNzp49nAFFjqAUSty1QFUujWG78db4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1626098748; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=lXTZuJS/mw5JRhQ5nuKwK5t2GXCm5iBJA/0UnyjpT44=; b=Byq50UHfqJ7EmygoDs/G3xTH8MzeS6rE+uIfDtCE5nYrq6QwJMH/7lFb14xEEF0cWExJRN u4wr14CmuDiv/ABw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id CED4A13AC4; Mon, 12 Jul 2021 14:05:48 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id QBDhMDxM7GD3cgAAMHmgww (envelope-from ); Mon, 12 Jul 2021 14:05:48 +0000 Subject: Re: [PATCH][gdb/testsuite] Fix gdb.btrace/tsx.exp on system with tsx disabled in microcode To: "Metzger, Markus T" References: <20210712112738.GA2111@delia> From: Tom de Vries Message-ID: <0e162414-67d4-a05c-6603-c4521b480e1c@suse.de> Date: Mon, 12 Jul 2021 16:05:48 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------A0E26A43A313D7C018F6C685" Content-Language: en-US X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "gdb-patches@sourceware.org" Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" This is a multi-part message in MIME format. --------------A0E26A43A313D7C018F6C685 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 7/12/21 1:54 PM, Metzger, Markus T wrote: > Hello Tom, > > >> diff --git a/gdb/testsuite/gdb.btrace/tsx.exp b/gdb/testsuite/gdb.btrace/tsx.exp >> index ccde1ea807e..7f96313f1b1 100644 >> --- a/gdb/testsuite/gdb.btrace/tsx.exp >> +++ b/gdb/testsuite/gdb.btrace/tsx.exp >> @@ -59,6 +59,11 @@ set abort_2 [multi_line \ >> "\[0-9\]*\t 0x\[0-9a-f\]+ :\tmov\[^\\\r\\\n\]*" \ >> "\[0-9\]*\t 0x\[0-9a-f\]+ :\tret\[^\\\r\\\n\]*" \ >> ] >> +set abort_3 \ >> + [multi_line \ >> + "$decimal\t $hex :\tcall\[^\\\r\\\n\]*" \ >> + "$decimal\t $hex :\tmov\[^\\\r\\\n\]*" \ >> + "$decimal\t $hex :\tret\[^\\\r\\\n\]*"] > > The patterns do not include the call since this is compiler-generated. The actual > TSX test is written in assembly so we know the instructions. > I see. Fixed by not requiring a specific instruction. > >> set test "speculation indication" >> gdb_test_multiple "record instruction-history" $test { >> @@ -68,6 +73,9 @@ gdb_test_multiple "record instruction-history" $test { >> -re "$abort_2.*$gdb_prompt $" { >> pass $test >> } >> + -re -wrap "$abort_3" { >> + pass $gdb_test_name >> + } > > Does this '-wrap' add ".*$gdb_prompt $"? > > Note that we need the ".*" after the pattern since this code is compiler-generated > and we don't really know when we will stop after returning from test (). The -wrap processes the pattern in exactly the same way as gdb_test does: ... if { $wrap_pattern } { # Wrap subst_item as is done for the gdb_test PATTERN # argument. lappend $current_list \ "\[\r\n\]*(?:$subst_item)\[\r\n\]+$gdb_prompt $" set wrap_pattern 0 } else { ... After running with clang, I ran into the FAIL you anticipated, which is indeed fixed by adding .* in the pattern. Updated patch attached. OK for trunk? Thanks, - Tom --------------A0E26A43A313D7C018F6C685 Content-Type: text/x-patch; charset=UTF-8; name="0001-gdb-testsuite-Fix-gdb.btrace-tsx.exp-on-system-with-tsx-disabled-in-microcode.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename*0="0001-gdb-testsuite-Fix-gdb.btrace-tsx.exp-on-system-with-tsx"; filename*1="-disabled-in-microcode.patch" [gdb/testsuite] Fix gdb.btrace/tsx.exp on system with tsx disabled in microcode Recently I started to see this fail with trunk: ... (gdb) record instruction-history^M 1 0x00000000004004ab : call 0x4004b7 ^M 2 0x00000000004004c6 : mov $0x1,%eax^M 3 0x00000000004004cb : ret ^M (gdb) FAIL: gdb.btrace/tsx.exp: speculation indication ... This is due to an intel microcode update (1) that disables Intel TSX by default. Fix this by updating the pattern. Tested on x86_64-linux, with both gcc 7.5.0 and clang 12.0.1. [1] https://www.intel.com/content/www/us/en/support/articles/000059422/processors.html gdb/testsuite/ChangeLog: 2021-07-12 Tom de Vries PR testsuite/28057 * gdb.btrace/tsx.exp: Add pattern for system with tsx disabled in microcode. --- gdb/testsuite/gdb.btrace/tsx.exp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gdb/testsuite/gdb.btrace/tsx.exp b/gdb/testsuite/gdb.btrace/tsx.exp index ccde1ea807e..66f6305e50a 100644 --- a/gdb/testsuite/gdb.btrace/tsx.exp +++ b/gdb/testsuite/gdb.btrace/tsx.exp @@ -59,6 +59,11 @@ set abort_2 [multi_line \ "\[0-9\]*\t 0x\[0-9a-f\]+ :\tmov\[^\\\r\\\n\]*" \ "\[0-9\]*\t 0x\[0-9a-f\]+ :\tret\[^\\\r\\\n\]*" \ ] +set abort_3 \ + [multi_line \ + "$decimal\t $hex :\t\[^\\\r\\\n\]*" \ + "$decimal\t $hex :\tmov\[^\\\r\\\n\]*" \ + "$decimal\t $hex :\tret\[^\\\r\\\n\]*"] set test "speculation indication" gdb_test_multiple "record instruction-history" $test { @@ -68,6 +73,9 @@ gdb_test_multiple "record instruction-history" $test { -re "$abort_2.*$gdb_prompt $" { pass $test } + -re -wrap "$abort_3.*" { + pass $gdb_test_name + } -re "$begin_to_end.*$gdb_prompt $" { pass $test } --------------A0E26A43A313D7C018F6C685--