- 论坛徽章:
- 0
|
内核版本 2.4.28-8 或者 2.4.0
文件:irq.c
do_IRQ() 中
- for (;;) {
- /* 这里解开了IRQ descriptor 的锁,其它cpu便可以竞争这个锁啦*/
- spin_unlock(&desc->lock);
- /* 这里运行IRQ descriptor 中的每一个中断服务程序*/
- handle_IRQ_event(irq, ®s, action);
- spin_lock(&desc->lock);
- if (!(desc->status & IRQ_PENDING))
- break;
- desc->status &= ~IRQ_PENDING;
- }
- desc->status &= ~IRQ_INPROGRESS;
复制代码 do_IRQ()->handle_IRQ_event() 中
- /* 这里取出每一个中断服务程序,没有什么保护措施?*/
- do {
- status |= action->flags;
- action->handler(irq, action->dev_id, regs);
- action = action->next;
- } while (action);
复制代码 如果有另外一个cpu通过
request_irq()->setup_irq()
- /* 此处等待IRQ descriptor解锁*/
- spin_lock_irqsave(&desc->lock,flags);
- /* 向IRQ descriptor上增加中断服务程序*/
- p = &desc->action;
- if ((old = *p) != NULL) {
- /* Can't share interrupts unless both agree to */
- if (!(old->flags & new->flags & SA_SHIRQ)) {
- spin_unlock_irqrestore(&desc->lock,flags);
- return -EBUSY;
- }
- /* add new interrupt at end of irq queue */
- do {
- p = &old->next;
- old = *p;
- } while (old);
- shared = 1;
- }
- *p = new;
- if (!shared) {
- desc->depth = 0;
- desc->status &= ~(IRQ_DISABLED | IRQ_AUTODETECT | IRQ_WAITING);
- desc->handler->startup(irq);
- }
- spin_unlock_irqrestore(&desc->lock,flags);
复制代码 问题是:一个cpu正在handle_IRQ_event()调用每一个中断服务程序,而另一个cpu在setup_irq()增加中断服务程序,这是否存在并发问题?还是在哪儿做了互斥保护的?求指教! |
评分
-
查看全部评分
|