Login
You're viewing the code4lib.social public feed.
  • Nov 18, 2024, 10:07 AM
    Is there anything stopping you from using linux as a microkernel? You can write drivers for pretty much anything in userspace
    💬 1🔄 1⭐ 0

Replies

  • Nov 18, 2024, 10:15 AM

    @Mae @thomholwerda The issue is usually not access to the hardware, but that there aren’t established protocols/APIs for making devices available to downstream users of such a user space driver, or if such APIs exist they’re niche and not suitable for general purpose use. I think this is gradually changing even in Linux land though.

    💬 2🔄 0⭐ 0
  • 💬 1🔄 0⭐ 0
  • Nov 18, 2024, 10:28 AM

    @whitequark @Mae @thomholwerda Yep, there’s all sorts of priority inversion and deadlock scenarios and edge cases.
    You’ll probably also want to give such processes preferential CPU scheduling treatment for example. No good handling the primary interrupt in the kernel and messaging the user space driver then hand control to some CPU hog user process instead of letting the driver do its thing. But I guess that’s already solved for audio.

    💬 0🔄 0⭐ 0
  • Nov 18, 2024, 10:23 AM

    @Mae @thomholwerda For example, audio stuff now mostly works via user space IPC (Pipewire etc), so there shouldn’t be a hard reason the backend drivers need to live in the kernel.
    ublk in theory paves the way for implementing block device drivers in user space. I don’t know how well it works in practice, I suspect rooting on such a device might not yet be a supported use case.

    💬 1🔄 0⭐ 0
  • 💬 1🔄 0⭐ 0
  • Nov 18, 2024, 10:31 AM

    @whitequark @Mae @thomholwerda I mean ideally you’d want the block device driver to directly be able to talk to the FUSE mount without bouncing via the kernel. I suspect that’s still a way off, but I admittedly haven’t been following along much with evolution of these things in Linux.
    I do happen to have experience with DriverKit in macOS, which is an implementation of this general idea, but suffers even more from indirection. (And Apple control)

    💬 1🔄 0⭐ 0
  • Nov 18, 2024, 10:43 AM

    @whitequark @Mae @thomholwerda If I was working towards such a goal in any OS, I think the key is designing driver APIs built around messaging and memory sharing in such a way that consumers and providers of the API ultimately can’t tell if the other side is the kernel or a separate process - and in fact the endpoint ought to be portable. /dev nodes are very much backed by the kernel at the moment.

    💬 1🔄 0⭐ 0
  • Nov 18, 2024, 10:47 AM

    @whitequark @Mae @thomholwerda macOS in theory has the Mach messaging backed IOKit - but DriverKit doesn’t quite just hand off send and receive rights of the driver client port to the sandboxed driver process; the kernel still acts as as go-between to some extent. I guess that’s very much an application of Conway’s law - and tellingly, Apple itself seems to only use DriverKit for driving third-party devices; its own hardware still gets kernel drivers

    💬 0🔄 0⭐ 0