<div dir="ltr">Hi All,<div><br></div><div>I was referring to "Unreliable Guide To Locking by Paul Rusty Russell". </div><div><br></div><div>Here is a quote below :-</div><div><br></div><div><div>"If a bottom half shares data with user context, you have two problems. Firstly, the current user context can be interrupted by a bottom half, and secondly, the critical region could be entered from another CPU. This is where spin_lock_bh() (include/linux/spinlock.h) is used. It disables bottom halves on that CPU, then grabs the lock. spin_unlock_bh() does the reverse"</div>
</div><div><br></div><div>Note : - </div><div><br></div><div>"user context" here means : The kernel executing on behalf of a particular process or kernel thread (given by the current() macro.) Not to be confused with userspace. Can be interrupted by software or hardware interrupts.</div>
<div><br></div><div><br></div><div>I have below questions related to the same.</div><div><br></div><div>1. If the BH is a tasklet/workque and in the user context we disable it, what happens when a interrupt(tied to the same tasklet/workque) occurs ? I hope the spin_lock_bh() do not disable the interrupt.</div>
<div><br></div><div>2. I hope that the spin_lock_bh needs to be acquired by the user context. Can anybody confirm this? How the critical section is achieved from the BH in the same context?</div><div><br></div><div>3.Overall It would be great if anybody can help me understand what happens when a BH is disabled with Interrupts still enabled for the BH.</div>
<div><br></div><div>Regards,</div><div>Priyaranjan</div></div>