1 / 13

Synchronization Aware Conflict Resolution for Runtime Monitoring using Transactional Memory

Synchronization Aware Conflict Resolution for Runtime Monitoring using Transactional Memory. Chen Tian, Vijay Nagarajan, Rajiv Gupta April 6, 2008. load A, R1. Mem. store ins Meta-data for A. Shadow Mem. store R2, B. store ins Meta-data for B. Actual instruction sequence.

althea-hill
Download Presentation

Synchronization Aware Conflict Resolution for Runtime Monitoring using Transactional Memory

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Synchronization Aware Conflict Resolution for Runtime Monitoring using Transactional Memory Chen Tian, Vijay Nagarajan, Rajiv Gupta April 6, 2008

  2. load A, R1 Mem. storeinsMeta-data for A Shadow Mem. store R2, B storeinsMeta-data for B Actual instruction sequence Runtime Monitoring • Useful in many places • debugging, profiling, security • Dynamic binary translation tools -DBT • Example: Pin, Valgrind • Main task: instrumentation

  3. start_tranx start_tranx Core 2 end_tranx end_tranx load2 … Monitoring on Multicore Machine • Race problem Core 1 load1 … loadins r1, X incins r1, 1 loadins r2, X incins r2, 1 storeins r1 , X storeins r2 , X Conflict! Wrong ! • Solution ? • Transactional memory - TM (J. Chung et al. HPCA’ 08) • Transaction size • new instruction overhead VS abort overhead

  4. Overhead and Transaction Size • Creating a transaction per basic block • worst performance (over 60%) • Larger transaction is preferred • Trace granularity and dynamic merging

  5. More about TM system • Hardware and Software • This work focus on hardware - HTM • 3 key functions: • Memory version management • Conflict detection • cache coherence message (HTM) • Conflict resolution • 3 existing HTM designs • EE – eager detection, requester loses • EL – eager detection, requester wins • LL – lazy detection, committer wins

  6. start_tranx start_tranx EE Policy: Requester loses Abort! … while (flag1 != 1) ; flag2 = 1; … … flag1 = 1; while (flag2 != 1) ; … … while (flag != 1) ; … … flag = 1; … end_tranx end_tranx Live Lock Problem • Example Core 1 Core 2 • Reason • DBT tools put the sync. into transactions • Especially for busy-waiting sync. • HTM doesn’t know the conflict is caused by sync. • Fix it by making HTM sync.-aware

  7. Remote Write Now you can go! No ! Yes ! Spinning Read Can I go? Busy-waiting Synchronization Pattern • Spinning read and a remote write • Flag sync., locks, barriers Spinning read: a load repeated X times Remote write: value changed by another thread

  8. Hardware Implementation • Load table, Detector, Synchronization Table • Simulated on Simics

  9. New Conflict Resolution • Key idea: A transaction which performs the sync. write should be committed immediately! • Add two rules • When a sync. pattern is detected, notify the HTM (avoid or break live locks due to sync.) • When a conflict is detected, check the syn_table (ensure discovered sync. will not cause live locks )

  10. start_tranx start_tranx … flag = 1; … flag = 1; … Synchronization Detected! end_tranx end_tranx ... start_tranx … end_tranx Example • When T1 comes again, it will see the updated value of flag. Transaction 1 Transaction 2 start_tranx … while (flag != 1) ; … Abort! end_tranx

  11. Accuracy of Sync. Detector

  12. Comparison with Time-out • Time-out solution • Periodically check the progress • Re-instrumentation on the fly • Pay extra overhead • (conflict may only happen once) • Our solution (relies on HTM, not DBT) • No need for re-instrumentation • Only need to check when there is conflict

  13. Thanks ! • Any Questions?

More Related