Skip to content

Commit cf667a8

Browse files
committed
Tweak TXF tracing to be a bit more more reliable
1 parent 7b6603f commit cf667a8

File tree

4 files changed

+58
-28
lines changed

4 files changed

+58
-28
lines changed

hstructs.h

+2
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,8 @@ struct REGS { /* Processor registers */
458458

459459
U16 txf_pifctab[ MAX_TXF_TND ]; /* PIFC control table */
460460

461+
TXFTRACE txf_trace; /* Saved values for tracing */
462+
461463
#endif /* defined( _FEATURE_073_TRANSACT_EXEC_FACILITY ) */
462464

463465
/* ------------------------------------------------------------ */

msgenu.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -2520,8 +2520,7 @@ LOGM_DLL_IMPORT int panel_command_capture( char* cmd, char** resp );
25202520
#define HHC17719 "TXF: %s%02X: %s%s transaction retry #%d FAILED!"
25212521
#define HHC17720 "TXF: %s%02X: %sAbort set by %s at %s"
25222522
#define HHC17721 "TXF: %s%02X: %s%s"
2523-
#define HHC17722 "TXF: %s%02X: %sabort_transaction called from %s"
2524-
//efine HHC17723 - HHC17729 (available)
2523+
//efine HHC17722 - HHC17729 (available)
25252524
#define HHC17730 "Total %s Transactions =%12"PRIu64
25262525
#define HHC17731 "Retries for ANY/ALL reason(s):"
25272526
#define HHC17732 "%1d%cretries =%12"PRIu64" (%4.1f%%)"

transact.c

+28-20
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,25 @@
1414
/* description of the "Transactional-Execution Facility". */
1515
/*-------------------------------------------------------------------*/
1616

17+
/*-------------------------------------------------------------------*/
18+
/* Credit where credit is due */
19+
/*-------------------------------------------------------------------*/
20+
/* The overall design of Hercules's Transactional-Execution Facility */
21+
/* was originally designed by Bob Wood so he gets most of the credit */
22+
/* for what you see. Fish only gets credit for minor corrections and */
23+
/* enhancements to Bob's design. I just wanted to make that clear. */
24+
/* It was only Fish which then -- along with LOTS of help from MANY */
25+
/* other fellow Hercules developers -- that made various minor fixes */
26+
/* and enhancements to Bob's original design to reach the point of */
27+
/* what you see here. But it is Bob Wood that is the TRUE HERCULEAN */
28+
/* that should get the bulk of the credit for Hercules's overall TXF */
29+
/* (Transactional Execution Facility) implementation. THANKS BOB! */
30+
/* And a special THANK YOU to Peter J. and Jürgen W. too for all of */
31+
/* the MANY long hours each of you put in testing and bug hunting! */
32+
/* Thank you all! You're the greatest! The Hercules project is truly */
33+
/* indebted to each and every one of you! Thank you! :`) */
34+
/*-------------------------------------------------------------------*/
35+
1736
#include "hstdinc.h"
1837

1938
#define _TRANSACT_C_
@@ -266,6 +285,8 @@ int txf_tnd, txf_tac, slot;
266285
}
267286
RELEASE_TXFLOCK( regs );
268287

288+
TXF_TRACE_INIT( regs );
289+
269290
/* Still in transaction-execution mode? */
270291
if (txf_tnd)
271292
{
@@ -288,7 +309,7 @@ int txf_tnd, txf_tac, slot;
288309
{
289310
// "TXF: %s%02X: %sSuccessful %s Nested TEND for TND %d => %d"
290311
WRMSG( HHC17700, "D", TXF_CPUAD( regs ), TXF_QSIE( regs ),
291-
regs->txf_contran ? "Cons" : "Uncons", txf_tnd + 1, txf_tnd );
312+
TXF_CONSTRAINED( regs->txf_contran ), txf_tnd + 1, txf_tnd );
292313
}
293314

294315
/* If we're now at or below the highest nesting level
@@ -426,7 +447,7 @@ int txf_tnd, txf_tac, slot;
426447
{
427448
// "TXF: %s%02X: %sSuccessful Outermost %s TEND"
428449
WRMSG( HHC17701, "D", TXF_CPUAD( regs ), TXF_QSIE( regs ),
429-
txf_contran ? "Cons" : "Uncons" );
450+
TXF_CONSTRAINED( txf_contran ));
430451
}
431452

432453
/* Commit all of our transactional changes */
@@ -724,6 +745,8 @@ TPAGEMAP *pmap;
724745
/* set cc=0 at transaction start */
725746
regs->psw.cc = TXF_CC_SUCCESS;
726747

748+
TXF_TRACE_INIT( regs );
749+
727750
/* first/outermost transaction? */
728751
if (regs->txf_tnd == 1)
729752
{
@@ -922,7 +945,7 @@ TPAGEMAP *pmap;
922945
}
923946

924947
/*--------------------------------------------------------------*/
925-
/* Report failed CONSTRAINED transaction retries */
948+
/* Report failed transaction retries */
926949
/*--------------------------------------------------------------*/
927950
if (1
928951
&& MLVL( VERBOSE )
@@ -972,7 +995,6 @@ static const int tac2cc[20] =
972995
};
973996
#endif /* defined( _FEATURE_073_TRANSACT_EXEC_FACILITY ) */
974997

975-
976998
/*-------------------------------------------------------------------*/
977999
/* abort_transaction */
9781000
/*-------------------------------------------------------------------*/
@@ -1036,20 +1058,7 @@ int retry; /* Actual retry code */
10361058
if (!regs->txf_tac)
10371059
regs->txf_tac = txf_tac;
10381060

1039-
/* Identify who called us (if appropriate) */
1040-
if (1
1041-
&& TXF_TRACING() // (debug tracing enabled?)
1042-
&& MLVL( VERBOSE ) // (verbose debug messages?)
1043-
// (non-specific tracing or
1044-
// tracing matches specifics...)
1045-
&& TXF_TRACE_CPU( regs )
1046-
&& TXF_TRACE_TND( regs )
1047-
&& TXF_TRACE_WHY( regs )
1048-
&& TXF_TRACE_TAC( regs )
1049-
&& TXF_TRACE_FAILS( regs )
1050-
)
1051-
// "TXF: %s%02X: %sabort_transaction called from %s"
1052-
WRMSG( HHC17722, "D", TXF_CPUAD( regs ), TXF_QSIE( regs ), TRIMLOC( loc ));
1061+
TXF_TRACE_INIT( regs );
10531062

10541063
// LOGIC ERROR if CPU not in transactional-execution mode
10551064
if (!regs->txf_tnd)
@@ -1144,7 +1153,7 @@ int retry; /* Actual retry code */
11441153
// "TXF: %s%02X: %sFailed %s %s Transaction for TND %d: %s = %s, why =%s"
11451154
WRMSG( HHC17703, "D", TXF_CPUAD( regs ), TXF_QSIE( regs ),
11461155
txf_tnd > 1 ? "Nested" : "Outermost",
1147-
txf_contran ? "Cons" : "Uncons", txf_tnd,
1156+
TXF_CONSTRAINED( txf_contran ), txf_tnd,
11481157
tac2short( txf_tac ), tac2long( txf_tac ), why );
11491158

11501159
/* If this is a delayed abort, log who detected/requested it */
@@ -2044,7 +2053,6 @@ DLL_EXPORT BYTE* txf_maddr_l( const U64 vaddr, const size_t len,
20442053
regs->txf_why |= TXF_WHY_MAX_PAGES;
20452054

20462055
PTT_TXF( "*TXF mad max", txf_tac, regs->txf_contran, regs->txf_tnd );
2047-
regs->txf_why |= TXF_WHY_MAX_PAGES;
20482056
ABORT_TRANS( regs, ABORT_RETRY_CC, txf_tac );
20492057
UNREACHABLE_CODE( return maddr );
20502058
}

transact.h

+27-6
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,30 @@ struct TXFSTATS
156156
typedef struct TXFSTATS TXFSTATS; // TXF Statisics
157157

158158
/*-------------------------------------------------------------------*/
159-
/* TXF tracing macros and functions */
159+
/* TXF debug tracing */
160160
/*-------------------------------------------------------------------*/
161161

162+
struct TXFTRACE
163+
{
164+
U32 txf_why;
165+
int cpuad;
166+
int txf_tnd;
167+
int txf_tac;
168+
int txf_aborts;
169+
};
170+
typedef struct TXFTRACE TXFTRACE; // TXF Tracing
171+
172+
#define TXF_TRACE_INIT( _regs ) \
173+
do \
174+
{ \
175+
(_regs)->txf_trace.txf_why = (_regs)->txf_why; \
176+
(_regs)->txf_trace.cpuad = (int)(S16)(_regs)->cpuad; \
177+
(_regs)->txf_trace.txf_tnd = (_regs)->txf_tnd; \
178+
(_regs)->txf_trace.txf_tac = (_regs)->txf_tac; \
179+
(_regs)->txf_trace.txf_aborts = (_regs)->txf_aborts; \
180+
} \
181+
while (0)
182+
162183
#define TXF_TRACING() (sysblk.txf_tracing)
163184

164185
/*-------------------------------------------------------------------*/
@@ -167,31 +188,31 @@ typedef struct TXFSTATS TXFSTATS; // TXF Statisics
167188
#define TXF_TRACE_CPU( _regs ) \
168189
(0 \
169190
|| !(sysblk.txf_tracing & TXF_TR_CPU) \
170-
|| ((_regs)->cpuad == sysblk.txf_cpuad ) \
191+
|| ((_regs)->txf_trace.cpuad == sysblk.txf_cpuad ) \
171192
)
172193

173194
#define TXF_TRACE_TND( _regs ) \
174195
(0 \
175196
|| !(sysblk.txf_tracing & TXF_TR_TND) \
176-
|| ((_regs)->txf_tnd >= sysblk.txf_tnd ) \
197+
|| ((_regs)->txf_trace.txf_tnd >= sysblk.txf_tnd ) \
177198
)
178199

179200
#define TXF_TRACE_WHY( _regs ) \
180201
(0 \
181202
|| !(sysblk.txf_tracing & TXF_TR_WHY) \
182-
|| ((_regs)->txf_why & sysblk.txf_why_mask ) \
203+
|| ((_regs)->txf_trace.txf_why & sysblk.txf_why_mask ) \
183204
)
184205

185206
#define TXF_TRACE_TAC( _regs ) \
186207
(0 \
187208
|| !(sysblk.txf_tracing & TXF_TR_TAC) \
188-
|| ((_regs)->txf_tac == sysblk.txf_tac ) \
209+
|| ((_regs)->txf_trace.txf_tac == sysblk.txf_tac ) \
189210
)
190211

191212
#define TXF_TRACE_FAILS( _regs ) \
192213
(0 \
193214
|| !(sysblk.txf_tracing & TXF_TR_FAILS) \
194-
|| ((_regs)->txf_aborts >= sysblk.txf_fails ) \
215+
|| ((_regs)->txf_trace.txf_aborts >= sysblk.txf_fails ) \
195216
)
196217

197218
//--------------------------------------------------------------------

0 commit comments

Comments
 (0)