用户空间中的Linux中断处理 [英] Linux Interrupt Handling in User Space

查看:618
本文介绍了用户空间中的Linux中断处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Linux中,在用户空间代码而不是内核空间中处理设备中断的选项有哪些?

解决方案

经验告诉我们,几乎可以为任何PCI适配器编写良好且稳定的用户空间驱动程序.它只需要内核中的一些复杂性和一个小的代理层. UIO是朝这个方向迈出的一步,但是如果您想正确处理用户空间中的中断,则UIO可能不够用,例如,如果设备不支持UIO所依赖的PCI规范的中断禁止位. >

请注意,进程唤醒延迟只有几微秒,因此,如果您的实现要求非常低的延迟,那么用户空间可能会拖累它.

如果要实现用户空间驱动程序,则可以将内核ISR减少为"disable& ack& akeup-userpace"操作,处理唤醒过程中的中断,然后重新执行启用中断(当然,是通过从用户空间进程写入映射的PCI内存来实现的.)

In Linux, what are the options for handling device interrupts in user space code rather than in kernel space?

解决方案

Experience tells it is possible to write good and stable user-space drivers for almost any PCI adapter. It just requires some sophistication and a small proxying layer in the kernel. UIO is a step in that direction, but If you want to correctly handle interrupts in user-space then UIO might not be enough, for example if the device doesn't support the PCI-spec's interrupt disable bit which UIO relies on.

Notice that process wakeup latencies are a few microsecs so if your implementation requires very low latency then user-space might be a drag on it.

If I were to implement a user-space driver, I would reduce the kernel ISR to just a "disable & ack & wakeup-userpace" operation, handle the interrupt inside the waked-up process, and then re-enable the interrupt (of course, by writing to mapped PCI memory from the userspace process).

这篇关于用户空间中的Linux中断处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆