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

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

问题描述

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

解决方案

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

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

如果我要实现用户空间驱动程序,我会将内核 ISR 简化为禁用 & ack & 唤醒用户空间"操作,在唤醒进程内部处理中断,然后重新启用中断(当然,通过从用户空间进程写入映射的 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天全站免登陆