我這個地方不太懂耶
static void __local_bh_disable(unsigned long ip)
{
//...
raw_local_irq_save(flags);
add_preempt_count(SOFTIRQ_OFFSET);
//...
raw_local_irq_restore(flags);
}
為甚麼他要這樣做呢
感覺不是因為怕先被preempt?
cf 寫:我這個地方不太懂耶
static void __local_bh_disable(unsigned long ip)
{
//...
raw_local_irq_save(flags);
add_preempt_count(SOFTIRQ_OFFSET);
//...
raw_local_irq_restore(flags);
}
為甚麼他要這樣做呢
感覺不是因為怕先被preempt?
#ifdef CONFIG_TRACE_IRQFLAGS
static void __local_bh_disable(unsigned long ip)
{
//...
raw_local_irq_save(flags);
add_preempt_count(SOFTIRQ_OFFSET);
if (softirq_count() == SOFTIRQ_OFFSET)
trace_softirqs_off(ip);
raw_local_irq_restore(flags);
}
#else /* !CONFIG_TRACE_IRQFLAGS */
static inline void __local_bh_disable(unsigned long ip)
{
add_preempt_count(SOFTIRQ_OFFSET);
barrier();
}
#endif /* CONFIG_TRACE_IRQFLAGS */
cf 寫:thank you jserv & orca
這篇問題問錯地方了真不好意思
這一段code是在http://lxr.linux.no/linux/kernel/softirq.c來的
而且也沒貼完全
我猜這就是問題所在, 因為
- 代碼: 選擇全部
#ifdef CONFIG_TRACE_IRQFLAGS
static void __local_bh_disable(unsigned long ip)
{
raw_local_irq_save(flags);
add_preempt_count(SOFTIRQ_OFFSET);
if (softirq_count() == SOFTIRQ_OFFSET)
trace_softirqs_off(ip);
raw_local_irq_restore(flags);
}
#else /* !CONFIG_TRACE_IRQFLAGS */
static inline void __local_bh_disable(unsigned long ip)
{
add_preempt_count(SOFTIRQ_OFFSET);
barrier();
}
#endif /* CONFIG_TRACE_IRQFLAGS */
cli/sti要保護的只是若有開trace
防止到softirq_count()之前都不要被preempt
正在瀏覽這個版面的使用者:沒有註冊會員 和 1 位訪客