This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug translator/6932] c->busy can be non-atomic.


------- Additional Comments From mhiramat at redhat dot com  2008-11-13 16:05 -------
hmm, if we use per-cpu variable for nesting flag, I think 
interrupts don't need to check it atomically.(as far as I know,
the preemption is disabled there...)

The operation can be separated into 4 phases
---
1. read flag
2. write flag=1 if (flag == 0)
3. doing some
4. write flag=0
---

If an interrupt occurs between 2 and 4,
---
1. read flag
2. write flag=1 if (flag == 0)
>>
 1. read flag
 2. return due to flag == 1
<<
3. doing some
>>
 1. read flag
 2. return due to flag == 1
<<
4. write flag=0
---
This case, the flag is operated correctly.

If an interrupt occurs between 1 and 2,
---
1. read flag
>>
 1. read flag
 2. write flag=1 if (flag == 0)
 3. doing some
 4. write flag=0
<<
2. write flag=1 if (flag == 0)
3. doing some
4. write flag=0
---
Even this case, the flag is correctly operated, because this 
case is same as an interrupt happens right before 1.


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=6932

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]