Disabling a BH : spin_lock_bh or local_bh_disable.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All,

I was referring to  "Unreliable Guide To Locking by Paul Rusty Russell". 

Here is a quote below :-

"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"

Note : - 

"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.


I have below questions related to the same.

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.

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?

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.

Regards,
Priyaranjan
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux