Applying Hardware Transactional Memory for Concurrency-Bug

Applying Hardware Transactional Memory for Concurrency-Bug

Applying Hardware Transactional Memory for Concurrency-Bug Failure Recovery in Production Runs Yuxi Chen, Shu Wang, and Shan Lu, University of Chicago; Karthikeyan Sankaralingam, University of Wisconsin – Madison https://www.usenix.org/conference/atc18/presentation/chen-yuxi This paper is included in the Proceedings of the 2018 USENIX Annual Technical Conference (USENIX ATC ’18). July 11–13, 2018 • Boston, MA, USA ISBN 978-1-939133-02-1 Open access to the Proceedings of the 2018 USENIX Annual Technical Conference is sponsored by USENIX. Applying Hardware Transactional Memory for Concurrency-Bug Failure Recovery in Production Runs Yuxi Chen Shu Wang Shan Lu Karthikeyan Sankaralingam University of Chicago University of Wisconsin – Madison Thread 1 Abstract Thread 2 … Re-Execu2on Concurrency bugs widely exist and severely threaten Point Re-execu'on gets around failure system availability. Techniques that help recover from Thread F failure concurrency-bug failures during production runs are Rollback Point highly desired. This paper proposes BugTM, an ap- Figure 1: Single-threaded recovery for concurrency bugs proach that leverages Hardware Transactional Mem- ory (HTM) on commodity machines for production- ten come together with naive failure restarts; even if not run concurrency-bug recovery. Requiring no knowl- successful, the recovery attempts only delays the failure edge about where are concurrency bugs, BugTM uses by a negligible amount of time. static analysis and code transformation to insert HTM in- This approach also faces challenges in performance, structions into multi-threaded programs. These BugTM- recovery capability, and correctness (i.e., not introducing transformed programs will then be able to recover from a new bugs), as we elaborate below. concurrency-bug failure by rolling back and re-executing Traditional rollback recovery conducts full-blown the recent history of a failure thread. BugTM greatly multi-threaded re-execution and whole-memory check- improves the recovery capability of state-of-the-art tech- pointing. It can help recover almost all concurrency-bug niques with low run-time overhead and no changes to OS failures, but incurs too large overhead to be deployed in or hardware, while guarantees not to introduce new bugs. production runs [35, 39]. Even with support from operat- 1 Introduction ing systems changes, periodic full-blown checkpointing 1.1 Motivation still often incurs more than 10% overhead [35]. A recently proposed recovery technique, ConAir, Concurrency bugs are caused by untimely accesses to conducts single-threaded re-execution and register-only shared variables. They are difficult to expose dur- checkpointing [55]. As shown in Figure 1, when a fail- ing in-house testing. They widely exist in production- ure happens at a thread, ConAir rolls back the register run software [26] and have caused disastrous failures content of this thread through an automatically inserted [23, 32, 40]. Production run failures severely hurt sys- longjmp and re-executes from the return of an automat- tem availability: the restart after a failure could take long ically inserted setjmp, which took register checkpoints. time and even lead to new problems if the failure leaves This design offers great performance (<1% overhead), inconsistent system states. Furthermore, comparing with but also imposes severe limitations to failure-recovery many other types of bugs, failures caused by concurrency capability. Particularly, with no memory checkpoints bugs are particularly difficult to diagnose and fix cor- and re-executing only one thread, ConAir does not al- rectly [50]. Techniques that handle production-run fail- low its re-execution regions to contain writes to shared ures caused by concurrency bugs are highly desired. variables (referred to as Ws) for correctness concerns, Rollback-and-reexecution is a promising approach to severely hurting its chance to recover many failures. recover failures caused by concurrency bugs. When a This limitation can be demonstrated by the real-world failure happens during a production run, the program example in Figure 2. In this example, the NULL assign- rolls back and re-executes from an earlier checkpoint. ment from Thread-2 could execute between the write Due to the unique non-determinism nature of concur- (A1) and the read (A2) on s!table from Thread-1, and rency bugs, the re-execution could get around the failure. cause failures. At the first glance, the failure could be This approach is appealing for several reasons. It is recovered if we could rollback Thread-1 and re-execute generic, requiring no prior knowledge about bugs; it im- both A1 and A2. However, such rollback and re-execution proves availability, masking the manifestation of concur- cannot be allowed by ConAir, as correctness can no rency bugs from end users; it avoids causing system in- longer be guaranteed if a write to a shared variable is consistency or wasting computation resources, which of- re-executed (Ws in Figure 2): another thread t could have USENIX Association 2018 USENIX Annual Technical Conference 837 read the old value of s!table, saved it to a local pointer, ReExecution RollBack Checkpoint ReExecution the re-execution then gave s!table a new value, caus- Point Point Memory ? contains Ws? ing inconsistency between t and Thread-1 and deviation ConAir setjmp longjmp 7 7 from the original program semantics. BugTMH StartTx AbortTx XX setjmp longjmp BugTMHS – or StartTx or AbortTx X X 1 //Thread-1 1 //Thread-2 2 s->table = newTable(...); //A1, Ws 2 Table 1: Design comparisons (Ws: shared-variable writes) 3 3 s->table = NULL; 4 if(!s->table) //A2 Deterministic aborts, such as those caused by trapping 5 //fatal-error message; software fails instructions, could cause software to hang if not well handled. We need to guarantee these cases do not happen Figure 2: A real-world concurrency bug from Mozilla and ensure software semantics remains unmodified. Failure recovery challenges: In order for HTM to help recovery, we need to improve the chances that soft- Rx BugTMHS ware executes in a transaction when a failure happens BugTMH and we need to carefully design HTM-abort handlers to correctly process the corresponding transaction aborts. ConAir BugTM addresses these challenges by its carefully de- Recovery Capability signed and carefully inserted, based on static program analysis, HTM start, commit, and abort routines. Specif- 0.5 1.5 3 10 Overhead (%) ically, we have explored two BugTM designs: BugTMH Figure 3: Design space of concurrency-bug failure re- and BugTMHS, as highlighted in Table 1. They are both covery (Heart: non-existing optimal design; Rx [35] changes OS) implemented as LLVM compiler passes that automati- cally instrument software in the following ways. 1.2 Contributions Hardware BugTM, short for BugTMH , uses HTM techniques2 exclusively to help failure recovery. When a Existing recovery techniques only touch two corners of failure is going to happen, a hardware transaction abort the design space — good performance but limited re- causes the failing thread to roll back. The re-execution covery capability or good recovery capability but lim- naturally starts from the beginning of the enclosing trans- ited performance — as shown in Figure 3. It is desir- action, carefully inserted by BugTM . able to have new recovery techniques that combine the H BugTM provides better recovery capability than performance and recovery capability strengths of the ex- H ConAir — benefiting from HTM, its re-execution region isting two corners of design, while maintaining correct- can contain shared variable writes. However, HTM costs ness guarantees. BugTM provides such a new technique more than setjmp/longjmp. Therefore, the performance leveraging hardware transactional memory (HTM) sup- of BugTM is worse than ConAir, but much better than port that already exists in commodity machines. H full-blown checkpointing, as shown in Figure 3. At the first glance, the opportunity seems obvious, as Hybrid BugTM, short for BugTM , uses HTM HTM provides a powerful mechanism for concurrency HS techniques and setjmp/longjmp together to help failure re- control and rollback-reexecution. Previous work [46] covery. BugTM inserts both setjmp/longjmp and HTM also showed that TM can be used to manually fix con- HS APIs into software, with the latter inserted only when currency bugs after they are detected. beneficial (i.e., when able to extend re-execution re- However, automatically inserting HTMs to help gions). When a failure is going to happen, the rollback tackle unknown concurrency bugs during production is carried out through transaction abort if under an active runs faces many challenges not encountered by manu- transaction or longjmp otherwise. ally fixing already detected concurrency bugs off-line: Performance challenges: High frequency of transac- BugTMHS provides performance almost as good tion uses would cause large overhead unacceptable for as ConAir and recovery capability even better than production runs. Unsuitable content of transactions, like BugTMH by carefully combining BugTMH and ConAir. trapping instructions1, high levels of transaction nesting, We thoroughly evaluated BugTMH and BugTMHS us- and long loops, would also cause performance degrada- ing 29 real-world concurrency bugs, including all the tion due to repeated and unnecessary transaction aborts. bugs used by a set of recent papers on concurrency bug Correctness challenges: Unpaired transaction-start detection and avoidance [17, 19, 41, 55, 56, 57]. Our and transaction-commit

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    15 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us