On 10-2-26 下午11:50, Dirk Vogt wrote:
On Fri, 2010-02-26 at 22:08 +0800, Da Zheng wrote:
In Linux local_irq_save() disables irqs in the local processor, so if the hard IRQ handler tries to raise softirq, it is guaranteed that the softirq thread will not be scheduled to run, and vice versa. How would that work on a SMP machine?
Correct me if I am wrong, but i think even on native Linux the hard IRQ handler and the soft IRQ handler could run on the same time (on two different processors) as only *local* interrupts are disabled.
[...] 2.3.43 introduced softirqs, and re-implemented the (now deprecated) BHs underneath them. Softirqs are fully-SMP versions of BHs: they can run on as many CPUs at once as required. This means they need to deal with any races in shared data using their own locks. [...]
[0] http://people.netfilter.org/rusty/unreliable-guides/kernel-hacking/basics-so...
It seems that I missed a letter.
The same type of softirq can run on more than one processor at the same time, but when a softirq is activated, it should be executed on the same CPU. That's why each CPU has a 32-bit mask describing the pending softirqs in the local CPU. Please check the section 4.7 of the book Understanding the Linux Kernel, the third edition.
Best regards, Zheng Da