Re: [Gems-users] Ruby Segmentation Fault


Date: Fri, 13 Feb 2009 15:03:19 +0200
From: Konstantinos Nikas <knikas@xxxxxxxxxxxxxxxxx>
Subject: Re: [Gems-users] Ruby Segmentation Fault
Hi,

in order to get a better idea of what is going on, I added a magic call inside the tm_log_unroll function of the software handler. The magic instruction accesses the TransactionInterfaceManager and prints the xact_level and log_size of the calling thread. I have actually added 2 calls one just after the while loop has finished and one just before the tm_log_unroll function returns. Here is a portion of the output:


Release Isolation for thread 0 of proc 1 ----> CALL TO tm_release_isolation in the software handler.
1 [1,0] RELEASE ISOLATION AT XACT LEVEL: 1
41361099 1 [1,0] SETTING FILTERS to XACT LEVEL: 0
41361112 2 [2,0] ISOLATE XACT STORE [0x27002dc0, line 0x27002dc0] XACT LEVEL: 1 PC = [0x12dcc, line 0x12dc0] 41361112 2 [2,0] LOGGING STORE: [0x2aedc0, line 0x2aedc0] 1 PC = [0x12dcc, line 0x12dc0]
**** Log. proc. num: 2:  m_logSize: 816 m_maxLogSize: 781
41361112 2 [2,0] ADD UNDO LOG ENTRY: [0x2aedc0, line 0x2aedc0] [0x27002dc0, line 0x27002dc0] LogAddress: [0x3a130c, line 0x3a1300] 1 41361117 2 [2,0] ISOLATE XACT STORE [0x27002dc0, line 0x27002dc0] XACT LEVEL: 1 PC = [0x12dd0, line 0x12dc0]

******************* OMITTED LOG ENTRIES FOR 2 [2,0] ************************

41361532 2 [2,0] LOGGING STORE: [0x2cc680, line 0x2cc680] 1 PC = [0x12db0, line 0x12d80]
**** Log. proc. num: 2:  m_logSize: 1156 m_maxLogSize: 781
41361532 2 [2,0] ADD UNDO LOG ENTRY: [0x2cc680, line 0x2cc680] [0x27020680, line 0x27020680] LogAddress: [0x3a1460, line 0x3a1440] 1 41361537 2 [2,0] ISOLATE XACT LOAD VA: [0x2ae340, line 0x2ae340] PA: [0x27002340, line 0x27002340] XACT LEVEL: 1 PC = [0x12db4, line 0x12d80]

PRINT_TRANS_STRUCT 1 [1,0] TID 0 XACT_LEVEL: 1 LOG_SIZE: 1088 ---> MY MAGIC CALL just after the while loop has finished. The values are not updated yet.

41361542 2 [2,0] ISOLATE XACT LOAD VA: [0x2ae4c0, line 0x2ae4c0] PA: [0x270024c0, line 0x270024c0] XACT LEVEL: 1 PC = [0x12db8, line 0x12d80] 41361547 2 [2,0] ISOLATE XACT LOAD VA: [0x2ae4c0, line 0x2ae4c0] PA: [0x270024c0, line 0x270024c0] XACT LEVEL: 1 PC = [0x12dbc, line 0x12d80] 41361552 2 [2,0] ISOLATE XACT STORE [0x270024c0, line 0x270024c0] XACT LEVEL: 1 PC = [0x12dc0, line 0x12dc0] 41361552 2 [2,0] LOGGING STORE: [0x2ae4c0, line 0x2ae4c0] 0 PC = [0x12dc0, line 0x12dc0] 41361557 2 [2,0] ISOLATE XACT LOAD VA: [0x2ae340, line 0x2ae340] PA: [0x27002340, line 0x27002340] XACT LEVEL: 1 PC = [0x12dc4, line 0x12dc0]

******************* OMITTED LOG ENTRIES FOR 2 [2,0] ************************

41361806 2 [2,0] ISOLATE XACT STORE [0x27002200, line 0x27002200] XACT LEVEL: 1 PC = [0x12dd0, line 0x12dc0] 41361806 2 [2,0] LOGGING STORE: [0x2ae200, line 0x2ae200] 0 PC = [0x12dd0, line 0x12dc0] 41361815 2 [2,0] ISOLATE XACT LOAD VA: [0xfeffbec0, line 0xfeffbec0] PA: [0x3c543ec0, line 0x3c543ec0] XACT LEVEL: 1 PC = [0x13244, line 0x13240]

PRINT_TRANS_STRUCT 1 [1,0] TID 0 XACT_LEVEL: 0 LOG_SIZE: 0 ---> MY MAGIC CALL just before tm_log_unroll returns. The values have been correctly updated.

41361826 2 [2,0] ISOLATE XACT LOAD VA: [0x2ae1c0, line 0x2ae1c0] PA: [0x270021c0, line 0x270021c0] XACT LEVEL: 1 PC = [0x13260, line 0x13240] 41361833 2 [2,0] ISOLATE XACT STORE [0x3c543ec0, line 0x3c543ec0] XACT LEVEL: 1 PC = [0x1326c, line 0x13240] 41361833 2 [2,0] LOGGING STORE: [0xfeffbec0, line 0xfeffbec0] 0 PC = [0x1326c, line 0x13240]
End exposed action for thread 0 of proc 1 PC [0x1b3e4, line 0x1b3c0]
41361838 1 [1,0] END ESCAPE ACTION - ESCAPE DEPTH: 1 PC [0x1b3e4, line 0x1b3c0]
Restart transaction for thread 0 of proc 1
restartTransactionCallback proc = 1 thread = 0 time = 41361839
41361839 1 [1,0] END ESCAPE ACTION - ESCAPE DEPTH: 0 PC [0x1b3ec, line 0x1b3c0] 1 [1,0] TID 0 RESTART TRANSACTION AT XACT LEVEL: 0 LOG_SIZE: 0 1 [1,0] SET LOG POINTER: [0x2d9020, line 0x2d9000] LOGFRAME POINTER: [0x2d9020, line 0x2d9000] LOG SIZE: 0


So in this case, everything works fine. Later however, this occurs :

Release Isolation for thread 0 of proc 1 ----> CALL TO tm_release_isolation in the software handler.
1 [1,0] RELEASE ISOLATION AT XACT LEVEL: 1
41517018 1 [1,0] SETTING FILTERS to XACT LEVEL: 0
41517019 2 [2,0] ISOLATE XACT STORE [0x3c543f40, line 0x3c543f40] XACT LEVEL: 1 PC = [0x142dc, line 0x142c0] 41517019 2 [2,0] LOGGING STORE: [0xfeffbf40, line 0xfeffbf40] 1 PC = [0x142dc, line 0x142c0]
**** Log. proc. num: 2:  m_logSize: 136 m_maxLogSize: 781
41517019 2 [2,0] ADD UNDO LOG ENTRY: [0xfeffbf40, line 0xfeffbf40] [0x3c543f40, line 0x3c543f40] LogAddress: [0x3a1064, line 0x3a1040] 1 41517024 2 [2,0] ISOLATE XACT LOAD VA: [0xfeffbf40, line 0xfeffbf40] PA: [0x3c543f40, line 0x3c543f40] XACT LEVEL: 1 PC = [0x142e0, line 0x142c0] 41517029 2 [2,0] ISOLATE XACT LOAD VA: [0x16fb40, line 0x16fb40] PA: [0x3cec3b40, line 0x3cec3b40] XACT LEVEL: 1 PC = [0x142e4, line 0x142c0] 41517034 2 [2,0] ISOLATE XACT LOAD VA: [0xfeffbf40, line 0xfeffbf40] PA: [0x3c543f40, line 0x3c543f40] XACT LEVEL: 1 PC = [0x142e8, line 0x142c0] 41517040 2 [2,0] ISOLATE XACT STORE [0x3c543f40, line 0x3c543f40] XACT LEVEL: 1 PC = [0x142f0, line 0x142c0] 41517040 2 [2,0] LOGGING STORE: [0xfeffbf40, line 0xfeffbf40] 0 PC = [0x142f0, line 0x142c0] 41517045 2 [2,0] ISOLATE XACT LOAD VA: [0xfeffbf40, line 0xfeffbf40] PA: [0x3c543f40, line 0x3c543f40] XACT LEVEL: 1 PC = [0x142f4, line 0x142c0] 41517050 2 [2,0] ISOLATE XACT LOAD VA: [0xfeffbf40, line 0xfeffbf40] PA: [0x3c543f40, line 0x3c543f40] XACT LEVEL: 1 PC = [0x142f8, line 0x142c0]
Commit CLOSED transaction for thread 0 of proc 2 XID 21
41517056 2 [2,0] COMMIT SET XACT FRAME oldLogFramePointer: [0x3a1020, line 0x3a1000] newLogFramePointer: [0x3a1020, line 0x3a1000]
41517056 2 [2,0] SETTING FILTERS to XACT LEVEL: 0
41517056 2 [2,0] COMMIT XACT: TID 1 XID 21 XACT_LEVEL: 0 PC: [0x14384, line 0x14380]
Begin CLOSED transaction for thread 0 of proc 2 XID 21
**** Log. proc. num: 2:  m_logSize: 68 m_maxLogSize: 781
41517092 2 [2,0] ADD XACT FRAME oldLogFramePointer: [0x3a1020, line 0x3a1000] newLogFramePointer: [0x3a1020, line 0x3a1000] 1 41517092 2 [2,0] BEGIN XACT: TID 1 XID 21 XACT_LEVEL: 1 PC: [0x142a4, line 0x14280]

PRINT_TRANS_STRUCT 1 [1,0] TID 0 XACT_LEVEL: 1 LOG_SIZE: 1224 ---> MY MAGIC CALL just after the while loop has finished. The values are not updated yet.

41517099 2 [2,0] ISOLATE XACT LOAD VA: [0x30100, line 0x30100] PA: [0x3c584100, line 0x3c584100] XACT LEVEL: 1 PC = [0x142b0, line 0x14280] 41517107 2 [2,0] ISOLATE XACT LOAD VA: [0xfeffbf40, line 0xfeffbf40] PA: [0x3c543f40, line 0x3c543f40] XACT LEVEL: 1 PC = [0x142c8, line 0x142c0] 41517112 2 [2,0] ISOLATE XACT LOAD VA: [0x16fb40, line 0x16fb40] PA: [0x3cec3b40, line 0x3cec3b40] XACT LEVEL: 1 PC = [0x142cc, line 0x142c0] 41517118 2 [2,0] ISOLATE XACT LOAD VA: [0xfeffbf80, line 0xfeffbf80] PA: [0x3c543f80, line 0x3c543f80] XACT LEVEL: 1 PC = [0x142d4, line 0x142c0] 41517123 2 [2,0] ISOLATE XACT LOAD VA: [0x298a40, line 0x298a40] PA: [0x3b7eca40, line 0x3b7eca40] XACT LEVEL: 1 PC = [0x142d8, line 0x142c0] 41517128 2 [2,0] ISOLATE XACT STORE [0x3c543f40, line 0x3c543f40] XACT LEVEL: 1 PC = [0x142dc, line 0x142c0] 41517128 2 [2,0] LOGGING STORE: [0xfeffbf40, line 0xfeffbf40] 1 PC = [0x142dc, line 0x142c0]
**** Log. proc. num: 2:  m_logSize: 136 m_maxLogSize: 781
41517128 2 [2,0] ADD UNDO LOG ENTRY: [0xfeffbf40, line 0xfeffbf40] [0x3c543f40, line 0x3c543f40] LogAddress: [0x3a1064, line 0x3a1040] 1 41517133 2 [2,0] ISOLATE XACT LOAD VA: [0xfeffbf40, line 0xfeffbf40] PA: [0x3c543f40, line 0x3c543f40] XACT LEVEL: 1 PC = [0x142e0, line 0x142c0] 41517138 2 [2,0] ISOLATE XACT LOAD VA: [0x16fb40, line 0x16fb40] PA: [0x3cec3b40, line 0x3cec3b40] XACT LEVEL: 1 PC = [0x142e4, line 0x142c0] 41517143 2 [2,0] ISOLATE XACT LOAD VA: [0xfeffbf40, line 0xfeffbf40] PA: [0x3c543f40, line 0x3c543f40] XACT LEVEL: 1 PC = [0x142e8, line 0x142c0] 41517149 2 [2,0] ISOLATE XACT STORE [0x3c543f40, line 0x3c543f40] XACT LEVEL: 1 PC = [0x142f0, line 0x142c0] 41517149 2 [2,0] LOGGING STORE: [0xfeffbf40, line 0xfeffbf40] 0 PC = [0x142f0, line 0x142c0] 41517154 2 [2,0] ISOLATE XACT LOAD VA: [0xfeffbf40, line 0xfeffbf40] PA: [0x3c543f40, line 0x3c543f40] XACT LEVEL: 1 PC = [0x142f4, line 0x142c0] 41517159 2 [2,0] ISOLATE XACT LOAD VA: [0xfeffbf40, line 0xfeffbf40] PA: [0x3c543f40, line 0x3c543f40] XACT LEVEL: 1 PC = [0x142f8, line 0x142c0]
Commit CLOSED transaction for thread 0 of proc 2 XID 21
41517165 2 [2,0] COMMIT SET XACT FRAME oldLogFramePointer: [0x3a1020, line 0x3a1000] newLogFramePointer: [0x3a1020, line 0x3a1000]
41517165 2 [2,0] SETTING FILTERS to XACT LEVEL: 0
41517165 2 [2,0] COMMIT XACT: TID 1 XID 21 XACT_LEVEL: 0 PC: [0x14384, line 0x14380]
Begin CLOSED transaction for thread 0 of proc 2 XID 21
**** Log. proc. num: 2:  m_logSize: 68 m_maxLogSize: 781
41517201 2 [2,0] ADD XACT FRAME oldLogFramePointer: [0x3a1020, line 0x3a1000] newLogFramePointer: [0x3a1020, line 0x3a1000] 1 41517201 2 [2,0] BEGIN XACT: TID 1 XID 21 XACT_LEVEL: 1 PC: [0x142a4, line 0x14280] 41517208 2 [2,0] ISOLATE XACT LOAD VA: [0x30100, line 0x30100] PA: [0x3c584100, line 0x3c584100] XACT LEVEL: 1 PC = [0x142b0, line 0x14280] 41517216 2 [2,0] ISOLATE XACT LOAD VA: [0xfeffbf40, line 0xfeffbf40] PA: [0x3c543f40, line 0x3c543f40] XACT LEVEL: 1 PC = [0x142c8, line 0x142c0] 41517221 2 [2,0] ISOLATE XACT LOAD VA: [0x16fb40, line 0x16fb40] PA: [0x3cec3b40, line 0x3cec3b40] XACT LEVEL: 1 PC = [0x142cc, line 0x142c0] 41517227 2 [2,0] ISOLATE XACT LOAD VA: [0xfeffbf80, line 0xfeffbf80] PA: [0x3c543f80, line 0x3c543f80] XACT LEVEL: 1 PC = [0x142d4, line 0x142c0] 41517232 2 [2,0] ISOLATE XACT LOAD VA: [0x295b80, line 0x295b80] PA: [0x3dfe9b80, line 0x3dfe9b80] XACT LEVEL: 1 PC = [0x142d8, line 0x142c0] 41517237 2 [2,0] ISOLATE XACT STORE [0x3c543f40, line 0x3c543f40] XACT LEVEL: 1 PC = [0x142dc, line 0x142c0] 41517237 2 [2,0] LOGGING STORE: [0xfeffbf40, line 0xfeffbf40] 1 PC = [0x142dc, line 0x142c0]
**** Log. proc. num: 2:  m_logSize: 136 m_maxLogSize: 781
41517237 2 [2,0] ADD UNDO LOG ENTRY: [0xfeffbf40, line 0xfeffbf40] [0x3c543f40, line 0x3c543f40] LogAddress: [0x3a1064, line 0x3a1040] 1 41517242 2 [2,0] ISOLATE XACT LOAD VA: [0xfeffbf40, line 0xfeffbf40] PA: [0x3c543f40, line 0x3c543f40] XACT LEVEL: 1 PC = [0x142e0, line 0x142c0] 41517247 2 [2,0] ISOLATE XACT LOAD VA: [0x16fb40, line 0x16fb40] PA: [0x3cec3b40, line 0x3cec3b40] XACT LEVEL: 1 PC = [0x142e4, line 0x142c0] 41517252 2 [2,0] ISOLATE XACT LOAD VA: [0xfeffbf40, line 0xfeffbf40] PA: [0x3c543f40, line 0x3c543f40] XACT LEVEL: 1 PC = [0x142e8, line 0x142c0] 41517258 2 [2,0] ISOLATE XACT STORE [0x3c543f40, line 0x3c543f40] XACT LEVEL: 1 PC = [0x142f0, line 0x142c0] 41517258 2 [2,0] LOGGING STORE: [0xfeffbf40, line 0xfeffbf40] 0 PC = [0x142f0, line 0x142c0] 41517263 2 [2,0] ISOLATE XACT LOAD VA: [0xfeffbf40, line 0xfeffbf40] PA: [0x3c543f40, line 0x3c543f40] XACT LEVEL: 1 PC = [0x142f4, line 0x142c0] 41517268 2 [2,0] ISOLATE XACT LOAD VA: [0xfeffbf40, line 0xfeffbf40] PA: [0x3c543f40, line 0x3c543f40] XACT LEVEL: 1 PC = [0x142f8, line 0x142c0]
Commit CLOSED transaction for thread 0 of proc 2 XID 21
41517274 2 [2,0] COMMIT SET XACT FRAME oldLogFramePointer: [0x3a1020, line 0x3a1000] newLogFramePointer: [0x3a1020, line 0x3a1000]
41517274 2 [2,0] SETTING FILTERS to XACT LEVEL: 0
41517274 2 [2,0] COMMIT XACT: TID 1 XID 21 XACT_LEVEL: 0 PC: [0x14384, line 0x14380]

PRINT_TRANS_STRUCT 1 [1,0] TID 0 XACT_LEVEL: 1 LOG_SIZE: 1224 ---> MY MAGIC CALL just before tm_log_unroll returns. The values still not updated!!!!

End exposed action for thread 0 of proc 1 PC [0x1b3e4, line 0x1b3c0]
41517388 1 [1,0] END ESCAPE ACTION - ESCAPE DEPTH: 1 PC [0x1b3e4, line 0x1b3c0]
Restart transaction for thread 0 of proc 1
restartTransactionCallback proc = 1 thread = 0 time = 41517389
41517389 1 [1,0] END ESCAPE ACTION - ESCAPE DEPTH: 0 PC [0x1b3ec, line 0x1b3c0] 1 [1,0] TID 0 RESTART TRANSACTION AT XACT LEVEL: 1 LOG_SIZE: 1224 ----> Thread 1 restarts its transaction with wrong values and we get a SEG FAULT!!!
Segmentation fault (SIGSEGV) in main thread


So I am completely baffled! It seems like there is some memory race and the values that the softwrea handler tries to write are lost. However, I though that the threadTransContext[threadID] structures are private per thread, so there shouldn't be any race problems!!!!


Any ideas?????

Kind regards,

Kostis


new_xact_level = g_system_ptr->getDriver()->readPhysicalMemory(logical_proc_no, tm_log_base + s_softwareXactStructMap[XACT_LEVEL].offset, 4);

This is the line that returns the wrong value. If we haven't misunderstood this should return 0 instead of 1.

Correct. Unfortunately debugging the software handlers is hard
and might require single-stepping simics after it gets into the
handler.

Jayaram
_______________________________________________
Gems-users mailing list
Gems-users@xxxxxxxxxxx
https://lists.cs.wisc.edu/mailman/listinfo/gems-users
Use Google to search the GEMS Users mailing list by adding "site:https://lists.cs.wisc.edu/archive/gems-users/"; to your search.

[← Prev in Thread] Current Thread [Next in Thread→]