s5z / zsim

A fast and scalable x86-64 multicore simulator
GNU General Public License v2.0
337 stars 186 forks source link

why one instance runs well, two instances crash? #242

Closed qianlong-zhang closed 4 years ago

qianlong-zhang commented 4 years ago

Hi, I add a prefetcher into zsim, using all g_vector/g_map, when running one program instance it will finish normally, but when running two same instances zsim will crash. I checked the crash point, it's in one vector inserting that created by the [S 0] thread. So it sames that the structures created by init.cpp can not be touched by the second instance. detail info is as follow:

[S 1] In file: build/debug/zsim.cpp, In func: FFThread line 1325: FF control Thread TID 32032 [S 1] [0] Internal exception detected: [S 1] [0] Code: 1 [S 1] [0] Address: 0x7ffff6199cc7 [S 1] [0] Description: Exception Code: ACCESS_INVALID_ADDRESS. Exception Address = 0x7ffff6199cc7. Access Type: UNKNOWN. Access Address = 0xf0f45b6e1 [S 1] [0] Caused by invalid access to address 0xf0f45b6e1 [S 1] [0] Backtrace (22/40 max frames) [S 1] [0] /home/zhangqianlong/MyPHD/backup/longCache_FHT/build/debug/zsim.cpp:1392 / InternalExceptionHandler(unsigned int, LEVEL_BASE::EXCEPTION_INFO, LEVEL_VM::PHYSICAL_CONTEXT, void) [S 1] [0] :? / LEVEL_PINCLIENT::IEH_CALLBACKS::NotifyInternalException(unsigned int, LEVEL_BASE::EXCEPTION_INFO, LEVEL_VM::CONTEXT*) [S 1] [0] /home/zhangqianlong/MyPHD/longCache/ext_lib/pin-2.14-71313-gcc.4.4.7-linux/intel64/bin/pinbin(_ZN8LEVEL_VM12SIGNALS_IMPL19InternalHandlerSyncEiPN7BARECRT8SIGXINFOEPN5PINVM11ISIGCONTEXTEPPKNS_14SCT_ATTRIBUTESEPNS_5PCTXTEPj+0x444) [0x3043a9454] [S 1] [0] /home/zhangqianlong/MyPHD/longCache/ext_lib/pin-2.14-71313-gcc.4.4.7-linux/intel64/bin/pinbin(_ZN8LEVEL_VM12SIGNALS_IMPL20HandlePhysicalSignalEPN7BARECRT8SIGXINFOEPN5PINVM11ISIGCONTEXTE+0x124) [0x3043aa1f4] [S 1] [0] /home/zhangqianlong/MyPHD/longCache/ext_lib/pin-2.14-71313-gcc.4.4.7-linux/intel64/bin/pinbin(_ZN5PINVM28SIGNAL_DETAILS_LINUX_INTEL6415InternalHandlerEiPN7BARECRT8SIGXINFOEPv+0xe8) [0x304438c88] [S 1] [0] /home/zhangqianlong/MyPHD/longCache/ext_lib/pin-2.14-71313-gcc.4.4.7-linux/intel64/bin/pinbin(BARECRT_SigReturnRt+0) [0x30446603c] [S 1] [0] /usr/include/c++/5/bits/hashtable.h:1417 / std::_Hashtable<unsigned long, std::pair<unsigned long const, int>, std::allocator<std::pair<unsigned long const, int> >, std::detail::_Select1st, std::equal_to, std::hash, std::detail::_Mod_range_hashing, std::detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::detail::_Hashtable_traits<false, false, true> >::_M_find_before_node(unsigned long, unsigned long const&, unsigned long) const [S 1] [0] /usr/include/c++/5/bits/hashtable.h:632 / std::_Hashtable<unsigned long, std::pair<unsigned long const, int>, std::allocator<std::pair<unsigned long const, int> >, std::detail::_Select1st, std::equal_to, std::hash, std::detail::_Mod_range_hashing, std::detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::detail::_Hashtable_traits<false, false, true> >::_M_find_node(unsigned long, unsigned long const&, unsigned long) const [S 1] [0] /usr/include/c++/5/bits/hashtable.h:1298 / std::_Hashtable<unsigned long, std::pair<unsigned long const, int>, std::allocator<std::pair<unsigned long const, int> >, std::detail::_Select1st, std::equal_to, std::hash, std::detail::_Mod_range_hashing, std::detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::detail::_Hashtable_traits<false, false, true> >::find(unsigned long const&) [S 1] [0] /usr/include/c++/5/bits/unordered_map.h:615 / std::unordered_map<unsigned long, int, std::hash, std::equal_to, std::allocator<std::pair<unsigned long const, int> > >::find(unsigned long const&) [S 1] [0] /home/xxx/MyPHD/backup/longCache_FHT/build/debug/prefetcher.h:327 / SetAssociativeCache::find(unsigned long) [S 1] [0] /home/xxx/MyPHD/backup/longCache_FHT/build/debug/prefetcher.h:462 / AccumulationTable::set_pattern(unsigned long, int)