简体   繁体   English

我可以在软件中断环境中使用free_irq吗?

[英]Can I use free_irq in a software interrupt context?

The kernel documentation says about free_irq the following : 内核文档中关于free_irq的内容如下:

This function must not be called from interrupt context. 不得从中断上下文中调用此函数。

Does it include software interrupts? 它包括软件中断吗? How can I free an IRQ in a software IRQ function? 如何在软件IRQ功能中释放IRQ?

Thanks for your help, 谢谢你的帮助,

Yes, that rule includes softirq context. 是的,该规则包括softirq上下文。 The fact that you think you need to call free_irq() from softirq context is an indication that your design is a bit out of the ordinary -- in normal cases, free_irq() is used when a device being shut down, which is almost always from process context. 您认为您需要从softirq上下文调用free_irq()的事实表明您的设计有点与众不同-在正常情况下,当设备关闭时会使用free_irq() ,这几乎总是从过程上下文。

However if you really need to do it, the thing to do would be to defer it to process context via schedule_work() or some similar workqueue function. 但是,如果您确实需要执行此操作,则可以通过schedule_work()或类似的工作队列函数将其推迟到处理上下文中。 Of course you can't wait in your softirq for that deferred work to complete, so you'll have to defer any other work that comes after freeing the IRQ also. 当然,您不能在softirq中等待该推迟的工作完成,因此您还必须在释放IRQ之后推迟其他任何工作。

It might be possible to give a better answer if you gave a bit more information about why you're trying to call free_irq() from interrupt context. 如果您提供了更多有关为什么要尝试从中断上下文中调用free_irq()信息,则可能会给出更好的答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM