Coder Social home page Coder Social logo

skarnet / mdevd Goto Github PK

View Code? Open in Web Editor NEW
55.0 55.0 4.0 188 KB

A kernel event manager compatible with mdev.conf

Home Page: https://skarnet.org/software/mdevd/

License: ISC License

Makefile 10.48% C 83.00% Shell 6.52%
busybox c linux mdev udevd

mdevd's People

Contributors

mobin-2008 avatar skarnet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

mdevd's Issues

Mention `nsss` as an optional dependency

The documentation on the website doesn't mention that nsss is an optional build-time and boot-time dependency, even though it's mentioned in the NEWS file that as of 0.1.0.2 support for nsss was added, and a --enable-nsss flag is listed in the configure file.

Also what kind of dependency is it? Is it only a build-time dependency, or a boot-time dependency or a run-time dependency?

Add support for /etc/mdevd.d config directory

I propose to add support for /etc/mdevd.d for user configs and /lib/mdevd.d for package-specific configs.
/lib/mdevd.d is useful for packages that want to install rules without user interaction. The idea is similar to /lib/udev/rules.d

This proposal definitely complicates mdevd. On the other side, it also makes mdevd a more usable alternative to udev. Anyway, I'd like to hear your thoughts.

Support more uevent actions

This feature isn't compatible with busybox mdev (and probably upcoming toybox mdev). However, it is actually useful to have the ability to run commands on change action. The one of possible use cases is a battery capacity notifier. See https://github.com/Ventto/batify.

Proposed syntax:

# do something on ACTION=change
<rule> <own>:<grp> <perm> %<cmd>

Rebroadcast uevents

Currently, libudev-zero uses files to get uevents from device manager. I admit that this looks hacky and improper, but I can't do anything on my side.

I propose to rebroadcast uevent messages. This way, I could implement race-free file-less hotplugging for libudev-zero.

As far as I know, there are two ways how it could be done.

  1. Rebroadcast uevents to named unix socket
  2. Rebroadcast uevents via custom netlink group number[1]

[1]
https://man7.org/linux/man-pages/man7/netlink.7.html nl_groups
oasislinux/hotplugd@6d19eb4

Race condition

Due to lack of synchronization, a race condition may occur when e.g other programs/services need rw access to /dev/input/*. Since mdevd doesn't provide a way to request its state of processing coldplug uevents, those programs/services have no synchronization with mdevd which may lead to breakage due to bad permissions in /dev/input/*.

This is tricky issue to fix i think. Udev has udevadm settle which blocks until all events are processed. Mdev has mdev -s which set proper permissions in /dev/* without need for daemon. What mdevd should do? Looking forward to your ideas!

Performance mdevd-coldplug?

Hi @skarnet
it looks like mdevd-coldplug is very slow? It triggers the hardware / device detection in round about 1 second what is as fast as the following snippet to load the needed drivers:

grep -h MODALIAS /sys/bus/*/devices/*/uevent | cut -d= -f2 | xargs modprobe -abq 2> /dev/null

But it looks like the snippet have done all the work with loading the modules, but mdevd-coldplug just triggers mdevd to load the modules which have much delay until all the modules are loaded?
After mdevd-coldplug is finished I see some seconds (7-10 seconds, qemu-kvm) some debugging output.

modprobe: module dmi:bvnSeaBIOS:bvrrel-1.10.2-0-g5f4c7b1-prebuilt.qemu-project.org:bd04/01/2014:svnQEMU:pnStandardPC(i440FX+PIIX,1996):pvrpc-i440fx-2.8:cvnQEMU:ct1:cvrpc-i440fx-2.8: not found in modules.dep
modprobe: module input:b0011v0002p0006e0000-e0,1,2,k110,111,112,113,114,r0,1,6,8,amlsfw not found in modules.dep
modprobe: module input:b0019v0000p0001e0000-e0,1,k74,ramlsfw not found in modules.dep
modprobe: module platform:reg-dummy not found in modules.dep
modprobe: module acpi:PNP0103: not found in modules.dep
modprobe: module platform:platform-framebuffer not found in modules.dep
modprobe: module platform:alarmtimer not found in modules.dep
modprobe: module platform:Fixed MDIO bus not found in modules.dep
modprobe: module platform:serial8250 not found in modules.dep
modprobe: module platform:i8042 not found in modules.dep
modprobe: module pci:v00008086d00001237sv00001AF4sd00001100bc06sc00i00 not found in modules.dep
modprobe: module pci:v00008086d00007000sv00001AF4sd00001100bc06sc01i00 not found in modules.dep
modprobe: module cpu:type:x86,ven0002fam0006mod0006:feature:,0000,0002,0003,0004,0005,0006,0007,0008,0009,000B,000C,000D,000E,000F,0010,0011,0013,0017,0018,0019,001A,0020,0022,0023,0024,0025,0026,0027,0028,0029,002B,002C,002D,002E,002F,0030,0031,0034,0037,0038,003D,006E,0071,0074,0075,0079,0080,008D,009F,00C0,00C2,00C8,00EC,00F3,010F
 not found in modules.dep
modprobe: module acpi:PNP0103: not found in modules.dep
modprobe: module acpi:LNXSYBUS: not found in modules.dep
modprobe: module acpi:PNP0501: not found in modules.dep
modprobe: module acpi:PNP0C0F: not found in modules.dep
modprobe: module acpi:PNP0A06: not found in modules.dep
modprobe: module acpi:LNXPWRBN: not found in modules.dep
modprobe: module acpi:PNP0C0F: not found in modules.dep
modprobe: module  not found in modules.dep
modprobe: module acpi:LNXSYSTM: not found in modules.dep
modprobe: module acpi:PNP0F13: not found in modules.dep
modprobe: module  not found in modules.dep
modprobe: module acpi:LNXSYBUS: not found in modules.dep
modprobe: module acpi:PNP0C0F: not found in modules.dep
modprobe: module acpi:PNP0B00: not found in modules.dep
modprobe: module acpi:PNP0C0F: not found in modules.dep
modprobe: module acpi:PNP0A06: not found in modules.dep
modprobe: can't load module pcc_cpufreq (kernel/drivers/cpufreq/pcc-cpufreq.ko): No such device
modprobe: can't load module acpi_cpufreq (kernel/drivers/cpufreq/acpi-cpufreq.ko): No such device
modprobe: module acpi:PNP0303: not found in modules.dep
modprobe: module acpi:PNP0C0F: not found in modules.dep
modprobe: module acpi:PNP0A06: not found in modules.dep
modprobe: module acpi:PNP0A03: not found in modules.dep
modprobe: module acpi:ACPI0010:PNP0A05: not found in modules.dep
modprobe: module input:b0010v001Fp0001e0100-e0,12,kramls1,2,fw not found in modules.dep
modprobe: module platform:floppy not found in modules.dep
modprobe: module platform:parport_pc not found in modules.dep
modprobe: module platform:parport_pc not found in modules.dep
modprobe: module platform:parport_pc not found in modules.dep

the grep modprobe snippet just takes 1-2 seconds with the following debugging output.

modprobe: module acpi:ACPI0010:PNP0A05: not found in modules.dep
modprobe: can't load module pcc_cpufreq (kernel/drivers/cpufreq/pcc-cpufreq.ko): No such device
modprobe: can't load module acpi_cpufreq (kernel/drivers/cpufreq/acpi-cpufreq.ko): No such device
modprobe: module acpi:LNXPWRBN: not found in modules.dep
modprobe: module acpi:LNXSYBUS: not found in modules.dep
modprobe: module acpi:LNXSYBUS: not found in modules.dep
modprobe: module acpi:LNXSYSTM: not found in modules.dep
modprobe: module acpi:PNP0103: not found in modules.dep
modprobe: module acpi:PNP0303: not found in modules.dep
modprobe: module acpi:PNP0501: not found in modules.dep
modprobe: module acpi:PNP0A03: not found in modules.dep
modprobe: module acpi:PNP0A06: not found in modules.dep
modprobe: module acpi:PNP0A06: not found in modules.dep
modprobe: module acpi:PNP0A06: not found in modules.dep
modprobe: module acpi:PNP0B00: not found in modules.dep
modprobe: module acpi:PNP0C0F: not found in modules.dep
modprobe: module acpi:PNP0C0F: not found in modules.dep
modprobe: module acpi:PNP0C0F: not found in modules.dep
modprobe: module acpi:PNP0C0F: not found in modules.dep
modprobe: module acpi:PNP0C0F: not found in modules.dep
modprobe: module acpi:PNP0F13: not found in modules.dep
modprobe: module cpu:type:x86,ven0002fam0006mod0006:feature:,0000,0002,0003,0004,0005,0006,0007,0008,0009,000B,000C,000D,000E,000F,0010,0011,0013,0017,0018,0019,001A,0020,0022,0023,0024,0025,0026,0027,0028,0029,002B,002C,002D,002E,002F,0030,0031,0034,0037,0038,003D,006E,0071,0074,0075,0079,0080,008D,009F,00C0,00C2,00C8,00EC,00F3,010F not found in modules.dep
modprobe: module pci:v00008086d00001237sv00001AF4sd00001100bc06sc00i00 not found in modules.dep
modprobe: module pci:v00008086d00007000sv00001AF4sd00001100bc06sc01i00 not found in modules.dep
modprobe: module platform:Fixed not found in modules.dep
modprobe: module MDIO not found in modules.dep
modprobe: module bus not found in modules.dep
modprobe: module acpi:PNP0103: not found in modules.dep
modprobe: module acpi:QEMU0002: not found in modules.dep
modprobe: module platform:alarmtimer not found in modules.dep
modprobe: module platform:floppy not found in modules.dep
modprobe: module platform:i8042 not found in modules.dep
modprobe: module platform:platform-framebuffer not found in modules.dep
modprobe: module platform:reg-dummy not found in modules.dep
modprobe: module platform:serial8250 not found in modules.dep

So the snippet is a considerable faster alternative to mdevd-coldplug implementation? Any way to improve it?

mdevd paket in alpine-edge build against wrong libskarnet

I got the following error, while installing mdevd:

  so:libskarnet.so.2.6 (missing):
    required by:
                 mdevd-0.1.0.1-r0[so:libskarnet.so.2.6]

Unfortunately, the packet "skalibs" is in version 2.7, which might cause this error. Since you are also the maintainer of this packet, it should be easy to build against the new version (or build it static)

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.