Summary: | x86 assembly prefix LOCK to guarantee atomicity has no effect | ||
---|---|---|---|
Product: | [Developer tools] valgrind | Reporter: | smile <smilenglitter> |
Component: | general | Assignee: | Julian Seward <jseward> |
Status: | RESOLVED DUPLICATE | ||
Severity: | normal | CC: | njn |
Priority: | NOR | ||
Version: | 2.1.2 | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Bug Depends on: | 197793 | ||
Bug Blocks: | |||
Attachments: |
assembly code using LOCK
driver file clients build |
Description
smile
2004-07-23 09:41:51 UTC
Created attachment 6792 [details]
assembly code using LOCK
Created attachment 6793 [details]
driver file
Created attachment 6794 [details]
clients
Created attachment 6795 [details]
build
I'm not sure there's much we can do about this as there is no guarantee that a single instruction in the executable being emulated will translate to a single instruction in the generated code so it may not be possible to preserve a LOCK prefix in all cases. LOCK prefix guarantees instruction level atomicity in a multicpu environment, essential for mutual exclusion and represents a very important feature. The point is not just that LOCK prefix is missing in generated code, but because of it atomicity is not guaranteed. I know that, what I'm saying is that it is not (in general terms) possible for valgrind to provide the atomicity you require because there is no guarantee that the instruction in the input stream that you want to be atomic will be single instruction in the output stream. That's just how valgrind works. It might be possible to preserve the LOCK prefix when there is a one-one mapping between instructions, and valgrind should certainly warn loudly when it is ignoring a LOCK prefix. I got your point. Thanks. Then the alternative would be to go for high level language mutex algorithms. This bug is a good item for the wishlist I guess. One of the local experts mentioned that a lock prefix use with cmpxchg can be implemented with a cmpxchg lfence and doesnot require lock prefix. But ofcourse it can only work with P4. Julian, will this be fixed by bug 197793? If so, this can be marked as a dup of it. *** This bug has been marked as a duplicate of bug 197793 *** |