Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] btrace, testsuite: fix spurious gdb.btrace/tsx.exp fails
@ 2015-09-18  8:36 Markus Metzger
  2015-09-18 11:44 ` Pedro Alves
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Metzger @ 2015-09-18  8:36 UTC (permalink / raw)
  To: palves; +Cc: gdb-patches

If the atomic section in x86-tsx.S is aborted, the tsx.exp test will fail
even if the traced output is actually correct.

Consider abort scenarios in the test.

2015-09-18  Markus Metzger <markus.t.metzger@intel.com>

testsuite/
	* gdb.btrace/tsx.exp: Consider multiple correct outputs in the record
	instruction-history test.
---
 gdb/testsuite/gdb.btrace/tsx.exp | 38 +++++++++++++++++++++++++++++++-------
 1 file changed, 31 insertions(+), 7 deletions(-)

diff --git a/gdb/testsuite/gdb.btrace/tsx.exp b/gdb/testsuite/gdb.btrace/tsx.exp
index 525d4d2..cc493a1 100644
--- a/gdb/testsuite/gdb.btrace/tsx.exp
+++ b/gdb/testsuite/gdb.btrace/tsx.exp
@@ -32,10 +32,34 @@ gdb_test_no_output "record btrace pt"
 gdb_test "next"
 
 # look at the instruction trace
-gdb_test "record instruction-history" [multi_line \
-  ".*" \
-  "\[0-9\]*\t\\?  0x\[0-9a-f\]+ <test\\+\[0-9\]+>:\txbegin\[^\\\r\\\n\]*" \
-  "\[0-9\]*\t\\?  0x\[0-9a-f\]+ <test\\+\[0-9\]+>:\tmov\[^\\\r\\\n\]*" \
-  "\[0-9\]*\t   0x\[0-9a-f\]+ <test\\+\[0-9\]+>:\txend\[^\\\r\\\n\]*" \
-  ".*" \
-  ]
+set begin_to_end [multi_line \
+    ".*" \
+    "\[0-9\]*\t\\?  0x\[0-9a-f\]+ <test\\+\[0-9\]+>:\txbegin\[^\\\r\\\n\]*" \
+    "\[0-9\]*\t\\?  0x\[0-9a-f\]+ <test\\+\[0-9\]+>:\tmov\[^\\\r\\\n\]*" \
+    "\[0-9\]*\t   0x\[0-9a-f\]+ <test\\+\[0-9\]+>:\txend\[^\\\r\\\n\]*" \
+    ]
+set abort_1 [multi_line \
+    ".*" \
+    "\[0-9\]*\t\\?  0x\[0-9a-f\]+ <test\\+\[0-9\]+>:\txbegin\[^\\\r\\\n\]*" \
+    "\[0-9\]*\t   0x\[0-9a-f\]+ <test\\+\[0-9\]+>:\tmov\[^\\\r\\\n\]*" \
+    "\[0-9\]*\t   0x\[0-9a-f\]+ <test\\+\[0-9\]+>:\tret\[^\\\r\\\n\]*" \
+    ]
+set abort_2 [multi_line \
+    ".*" \
+    "\[0-9\]*\t\\?  0x\[0-9a-f\]+ <test\\+\[0-9\]+>:\txbegin\[^\\\r\\\n\]*" \
+    "\[0-9\]*\t\\?  0x\[0-9a-f\]+ <test\\+\[0-9\]+>:\tmov\[^\\\r\\\n\]*" \
+    "\[0-9\]*\t   0x\[0-9a-f\]+ <test\\+\[0-9\]+>:\tmov\[^\\\r\\\n\]*" \
+    "\[0-9\]*\t   0x\[0-9a-f\]+ <test\\+\[0-9\]+>:\tret\[^\\\r\\\n\]*" \
+    ]
+
+gdb_test_multiple "record instruction-history" "speculation indication" {
+    -re "$abort_1.*$gdb_prompt $" {
+        pass "speculation indication: abort"
+    }
+    -re "$abort_2.*$gdb_prompt $" {
+        pass "speculation indication: abort"
+    }
+    -re  "$begin_to_end.*$gdb_prompt $" {
+        pass "speculation indication: begin..end"
+    }
+}
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] btrace, testsuite: fix spurious gdb.btrace/tsx.exp fails
  2015-09-18  8:36 [PATCH] btrace, testsuite: fix spurious gdb.btrace/tsx.exp fails Markus Metzger
@ 2015-09-18 11:44 ` Pedro Alves
  2015-09-18 12:13   ` Metzger, Markus T
  0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2015-09-18 11:44 UTC (permalink / raw)
  To: Markus Metzger; +Cc: gdb-patches

On 09/18/2015 09:36 AM, Markus Metzger wrote:
> If the atomic section in x86-tsx.S is aborted, 

When can that happen?  Is it normal that the test sees this?

> the tsx.exp test will fail
> even if the traced output is actually correct.
> 
> Consider abort scenarios in the test.
> 
> 2015-09-18  Markus Metzger <markus.t.metzger@intel.com>
> 
> testsuite/
> 	* gdb.btrace/tsx.exp: Consider multiple correct outputs in the record
> 	instruction-history test.

Thanks,
Pedro Alves


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] btrace, testsuite: fix spurious gdb.btrace/tsx.exp fails
  2015-09-18 11:44 ` Pedro Alves
@ 2015-09-18 12:13   ` Metzger, Markus T
  2015-09-18 12:56     ` Pedro Alves
  0 siblings, 1 reply; 5+ messages in thread
From: Metzger, Markus T @ 2015-09-18 12:13 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] On Behalf Of Pedro Alves
> Sent: Friday, September 18, 2015 1:44 PM
> To: Metzger, Markus T
> Cc: gdb-patches@sourceware.org
> Subject: Re: [PATCH] btrace, testsuite: fix spurious gdb.btrace/tsx.exp fails
> 
> On 09/18/2015 09:36 AM, Markus Metzger wrote:
> > If the atomic section in x86-tsx.S is aborted,
> 
> When can that happen?  Is it normal that the test sees this?

A transaction can be aborted for various reasons.  One such reason is an
interrupt, which can happen at any time.

This occurs very infrequently.  After I saw this the first time, I had to re-run
the test several dozen times to reproduce it again.

Regards,
Markus.

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Prof. Dr. Hermann Eul
Chairperson of the Supervisory Board: Tiffany Doon Silva
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] btrace, testsuite: fix spurious gdb.btrace/tsx.exp fails
  2015-09-18 12:13   ` Metzger, Markus T
@ 2015-09-18 12:56     ` Pedro Alves
  2015-09-21  6:31       ` Metzger, Markus T
  0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2015-09-18 12:56 UTC (permalink / raw)
  To: Metzger, Markus T; +Cc: gdb-patches

On 09/18/2015 01:12 PM, Metzger, Markus T wrote:
>> -----Original Message-----
>> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
>> owner@sourceware.org] On Behalf Of Pedro Alves
>> Sent: Friday, September 18, 2015 1:44 PM
>> To: Metzger, Markus T
>> Cc: gdb-patches@sourceware.org
>> Subject: Re: [PATCH] btrace, testsuite: fix spurious gdb.btrace/tsx.exp fails
>>
>> On 09/18/2015 09:36 AM, Markus Metzger wrote:
>>> If the atomic section in x86-tsx.S is aborted,
>>
>> When can that happen?  Is it normal that the test sees this?
> 
> A transaction can be aborted for various reasons.  One such reason is an
> interrupt, which can happen at any time.

I was under the impression that the hardware or kernel would retry
the transaction and that that would be transparent to
userspace, but sounds like not then.

> This occurs very infrequently.  After I saw this the first time, I had to re-run
> the test several dozen times to reproduce it again.

+gdb_test_multiple "record instruction-history" "speculation indication" {
+    -re "$abort_1.*$gdb_prompt $" {
+        pass "speculation indication: abort"
+    }
+    -re "$abort_2.*$gdb_prompt $" {
+        pass "speculation indication: abort"
+    }
+    -re  "$begin_to_end.*$gdb_prompt $" {
+        pass "speculation indication: begin..end"
+    }
+}

Note this will cause ping-ponging of PASS messages, resulting
in spurious changes in test result diffing.  I'd suggest using
the same message in all cases.

Thanks,
Pedro Alves


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] btrace, testsuite: fix spurious gdb.btrace/tsx.exp fails
  2015-09-18 12:56     ` Pedro Alves
@ 2015-09-21  6:31       ` Metzger, Markus T
  0 siblings, 0 replies; 5+ messages in thread
From: Metzger, Markus T @ 2015-09-21  6:31 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] On Behalf Of Pedro Alves
> Sent: Friday, September 18, 2015 2:57 PM
> To: Metzger, Markus T
> Cc: gdb-patches@sourceware.org
> Subject: Re: [PATCH] btrace, testsuite: fix spurious gdb.btrace/tsx.exp fails


> > A transaction can be aborted for various reasons.  One such reason is an
> > interrupt, which can happen at any time.
> 
> I was under the impression that the hardware or kernel would retry
> the transaction and that that would be transparent to
> userspace, but sounds like not then.

For RTM you have to provide the abort handler, yourself.  You may retry
the transaction or fall back to more heavy-weight synchronization.


> > This occurs very infrequently.  After I saw this the first time, I had to re-run
> > the test several dozen times to reproduce it again.
> 
> +gdb_test_multiple "record instruction-history" "speculation indication" {
> +    -re "$abort_1.*$gdb_prompt $" {
> +        pass "speculation indication: abort"
> +    }
> +    -re "$abort_2.*$gdb_prompt $" {
> +        pass "speculation indication: abort"
> +    }
> +    -re  "$begin_to_end.*$gdb_prompt $" {
> +        pass "speculation indication: begin..end"
> +    }
> +}
> 
> Note this will cause ping-ponging of PASS messages, resulting
> in spurious changes in test result diffing.  I'd suggest using
> the same message in all cases.

OK.

I'll send an updated patch.

Regards,
Markus.
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Prof. Dr. Hermann Eul
Chairperson of the Supervisory Board: Tiffany Doon Silva
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-09-21  6:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-18  8:36 [PATCH] btrace, testsuite: fix spurious gdb.btrace/tsx.exp fails Markus Metzger
2015-09-18 11:44 ` Pedro Alves
2015-09-18 12:13   ` Metzger, Markus T
2015-09-18 12:56     ` Pedro Alves
2015-09-21  6:31       ` Metzger, Markus T

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox