linux: enable UEVENT_HELPER when mdev is used
PATCH 1/1 linux: enable UEVENT_HELPER when mdev is used
S10mdev uses /proc/sys/kernel/hotplug, which is only available if CONFIG_UEVENT_HELPER is enabled in the kernel, so ensure it is.
--- linux/linux.mk | 2 ++ 1 file changed, 2 insertions(+)
linux/linux.mk +2 -0
@@ -333,6 +333,8 @@ define LINUX_KCONFIG_FIXUP_CMDS $(call KCONFIG_ENABLE_OPT,CONFIG_DEVTMPFS_MOUNT,$(@D)/.config)) $(if $(BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV), $(call KCONFIG_ENABLE_OPT,CONFIG_INOTIFY_USER,$(@D)/.config)) + $(if $(BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV), + $(call KCONFIG_ENABLE_OPT,CONFIG_UEVENT_HELPER,$(@D)/.config)) $(if $(BR2_PACKAGE_AUDIT), $(call KCONFIG_ENABLE_OPT,CONFIG_NET,$(@D)/.config) $(call KCONFIG_ENABLE_OPT,CONFIG_AUDIT,$(@D)/.config))
Signature · 1 line
2.11.0
PATCH 1/1 linux: enable UEVENT_HELPER when mdev is used
Quoted 3 lines · Peter Korsgaard
S10mdev uses
/proc/sys/kernel/hotplug, which is only available ifCONFIG_UEVENT_HELPERis enabled in the kernel, so ensure it is.
Thanks!
Quoted 22 lines
Reported-by Andy Shevchenko <[email protected]>Signed-off-by Peter Korsgaard <[email protected]>--- linux/linux.mk | 2 ++ 1 file changed, 2 insertions(+)linux/linux.mk +2
-0@@ -333,6 +333,8 @@ define LINUX_KCONFIG_FIXUP_CMDS $(call KCONFIG_ENABLE_OPT,CONFIG_DEVTMPFS_MOUNT,$(@D)/.config)) $(if $(BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV), $(call KCONFIG_ENABLE_OPT,CONFIG_INOTIFY_USER,$(@D)/.config)) + $(if $(BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV), + $(call KCONFIG_ENABLE_OPT,CONFIG_UEVENT_HELPER,$(@D)/.config)) $(if $(BR2_PACKAGE_AUDIT), $(call KCONFIG_ENABLE_OPT,CONFIG_NET,$(@D)/.config) $(call KCONFIG_ENABLE_OPT,CONFIG_AUDIT,$(@D)/.config))Signature · 1 line
2.11.0
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 1/1 linux: enable UEVENT_HELPER when mdev is used
In reply to Peter KorsgaardQuoted 2 lines · Peter Korsgaard
S10mdev uses
/proc/sys/kernel/hotplug, which is only available ifCONFIG_UEVENT_HELPERis enabled in the kernel, so ensure it is.
So, I take a look at it, and it's a little bit more complicated...
Busybox *does* have support for the "new" netlink-based uevent interface, but
that interface needs a daemon that keeps running and they separated that daemon into a separate process, called uevent. So, in the "new" way, you should do something like (not tried, just based on source code):
start-stop-daemon -S -b -x /sbin/uevent -- mdev
But of course, that means that we have to be sure that the uevent executable is
in fact built for busybox. So we'd need to extend BUSYBOX_SET_MDEV to enable uevent.
Also, we can only use the uevent approach if netlink uevents are available.
They exist since 2.6.12, so I guess on that side we're safe. However, they also depend on CONFIG_NET (because netlink does).
So, these are our options:
1. Bloat the kernel with legacy uevent helper support (this patch).
2. Bloat the kernel with networking even if it is not used for anything else, and bloat busybox with uevent (3.1 kb), and always use uevent.
3. Use uevent in the init script but don't enforce anything (with potential silent failures), and explain stuff in the mdev help text.
4. Try out all possibilities in the init script - which still fails silently in case neither CONFIG_UEVENT_HELPER nor CONFIG_NET is enabled in the kernel.
In my opinion, we definitely should *not* go for option 1. I don't want to be
the one that forces the kernel to maintain legacy stuff. I would definitely use uevent. On the other hand, I really don't like it when we force changes into busybox or kernel configs. Since it's really likely that CONFIG_NET is enabled in the kernel, and since our default busybox config (but not the minimal one) does enable uevent, I think that option 3 is the way to go.
By the way, with netlink, the event are properly serialized, and uevent makes
sure that only one mdev subprocess is created so it maintains the serialisation. So, it is no longer needed to create /dev/mdev.seq (which, for some reason, we currently don't do...).
Regards,
Arnout
Quoted 21 lines
Reported-by Andy Shevchenko <[email protected]>Signed-off-by Peter Korsgaard <[email protected]>--- linux/linux.mk | 2 ++ 1 file changed, 2 insertions(+)linux/linux.mk +2
-0@@ -333,6 +333,8 @@ define LINUX_KCONFIG_FIXUP_CMDS $(call KCONFIG_ENABLE_OPT,CONFIG_DEVTMPFS_MOUNT,$(@D)/.config)) $(if $(BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV), $(call KCONFIG_ENABLE_OPT,CONFIG_INOTIFY_USER,$(@D)/.config)) + $(if $(BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV), + $(call KCONFIG_ENABLE_OPT,CONFIG_UEVENT_HELPER,$(@D)/.config)) $(if $(BR2_PACKAGE_AUDIT), $(call KCONFIG_ENABLE_OPT,CONFIG_NET,$(@D)/.config) $(call KCONFIG_ENABLE_OPT,CONFIG_AUDIT,$(@D)/.config))
PATCH 1/1 linux: enable UEVENT_HELPER when mdev is used
Quoted 24 lines · Arnout Vandecappelle
Quoted 2 lines · Peter Korsgaard
S10mdev uses
/proc/sys/kernel/hotplug, which is only available ifCONFIG_UEVENT_HELPERis enabled in the kernel, so ensure it is.So, I take a look at it, and it's a little bit more complicated...
Busybox *does* have support for the "new" netlink-based uevent interface, but
that interface needs a daemon that keeps running and they separated that daemon into a separate process, called uevent. So, in the "new" way, you should do something like (not tried, just based on source code):start-stop-daemon -S -b -x
/sbin/uevent-- mdevBut of course, that means that we have to be sure that the uevent executable is
in fact built for busybox. So we'd need to extendBUSYBOX_SET_MDEVto enable uevent.Also, we can only use the uevent approach if netlink uevents are available.
They exist since 2.6.12, so I guess on that side we're safe. However, they also depend onCONFIG_NET(because netlink does).So, these are our options:
1. Bloat the kernel with legacy uevent helper support (this patch).
Quoted 8 lines
2. Bloat the kernel with networking even if it is not used for anything else, and bloat busybox with uevent (3.1 kb), and always use uevent.
3. Use uevent in the init script but don't enforce anything (with potential silent failures), and explain stuff in the mdev help text.
4. Try out all possibilities in the init script - which still fails silently in case neither
CONFIG_UEVENT_HELPERnorCONFIG_NETis enabled in the kernel.
Since the UEVENT_HELPER had been made optional back in 2014 and I reported bug for mdev script in 2019 I would *speculate* that everybody nowadays are using udev, so, netlink is quite probably already enabled in the kernel.
Quoted 2 lines
In my opinion, we definitely should *not* go for option 1. I don't want to be
the one that forces the kernel to maintain legacy stuff.
I second this.
Quoted 5 lines
I would definitely use
uevent. On the other hand, I really don't like it when we force changes into busybox or kernel configs. Since it's really likely thatCONFIG_NETis enabled in the kernel, and since our default busybox config (but not the minimal one) does enable uevent, I think that option 3 is the way to go.
Agree.
Quoted 4 lines
By the way, with netlink, the event are properly serialized, and uevent makes
sure that only one mdev subprocess is created so it maintains the serialisation. So, it is no longer needed to create/dev/mdev.seq(which, for some reason, we currently don't do...).
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 1/1 linux: enable UEVENT_HELPER when mdev is used
In reply to Arnout VandecappelleQuoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Arnout" == Arnout Vandecappelle <[email protected]> writes:
Quoted 2 lines · Peter Korsgaard
S10mdev uses
/proc/sys/kernel/hotplug, which is only available ifCONFIG_UEVENT_HELPERis enabled in the kernel, so ensure it is.
Quoted 8 lines
So, I take a look at it, and it's a little bit more complicated...
Busybox *does* have support for the "new" netlink-based uevent interface, but
that interface needs a daemon that keeps running and they separated that daemon into a separate process, called uevent. So, in the "new" way, you should do something like (not tried, just based on source code):start-stop-daemon -S -b -x
/sbin/uevent-- mdev
Ahh, so busybox now has a clone of s6-uevent-listener / mdevd-netlink? I wasn't aware of that.
There is also patches floating for a daemon mode for mdev:
https://www.mail-archive.com/busybox at busybox.net/msg25938.html and separately, mdevd exists: https://skarnet.org/software/mdevd/
Quoted 3 lines
So, these are our options:
1. Bloat the kernel with legacy uevent helper support (this patch).
This is not really bloat, as it just makes the existing implicit dependency explicit.
Quoted 2 lines
2. Bloat the kernel with networking even if it is not used for anything else, and bloat busybox with uevent (3.1 kb), and always use uevent.
Networking support adds significant bloat, the other options afaik not.
Quoted 9 lines
3. Use uevent in the init script but don't enforce anything (with potential silent failures), and explain stuff in the mdev help text.
4. Try out all possibilities in the init script - which still fails silently in case neither
CONFIG_UEVENT_HELPERnorCONFIG_NETis enabled in the kernel.In my opinion, we definitely should *not* go for option 1. I don't want to be
the one that forces the kernel to maintain legacy stuff. I would definitely use uevent.
What advantage does uevent have over the legacy uevent helper? Just serialization or anything else?
Quoted 4 lines
On the other hand, I really don't like it when we force changes into busybox or kernel configs. Since it's really likely that
CONFIG_NETis enabled in the kernel, and since our default busybox config (but not the minimal one) does enable uevent, I think that option 3 is the way to go.
I don't use mdev myself, so I don't really care a lot about what option we go for longer term, but given how close 2019.05 is, the only valid options for the release are this patch or nothing.
I have no problems with patches (for next) moving our mdev logic to netdev instead if people are interested.
Quoted 4 lines
By the way, with netlink, the event are properly serialized, and uevent makes
sure that only one mdev subprocess is created so it maintains the serialisation. So, it is no longer needed to create/dev/mdev.seq(which, for some reason, we currently don't do...).
Ahh yes, a patch adding an 'echo >/dev/mdev.seq' to S10mdev would be nice.
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 linux: enable UEVENT_HELPER when mdev is used
Quoted 13 lines · Peter Korsgaard
Quoted 12 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Arnout" == Arnout Vandecappelle <[email protected]> writes:
Quoted 2 lines · Peter Korsgaard
S10mdev uses
/proc/sys/kernel/hotplug, which is only available ifCONFIG_UEVENT_HELPERis enabled in the kernel, so ensure it is.So, I take a look at it, and it's a little bit more complicated...
Busybox *does* have support for the "new" netlink-based uevent interface, but
that interface needs a daemon that keeps running and they separated that daemon into a separate process, called uevent. So, in the "new" way, you should do something like (not tried, just based on source code):
Quoted 4 lines
Quoted 1 line
start-stop-daemon -S -b -x
/sbin/uevent-- mdevAhh, so busybox now has a clone of s6-uevent-listener / mdevd-netlink? I wasn't aware of that.
It has been added in 2015 :-)
Quoted 11 lines
There is also patches floating for a daemon mode for mdev:
https://www.mail-archive.com/busybox at busybox.net/msg25938.html and separately, mdevd exists: https://skarnet.org/software/mdevd/Quoted 3 lines
So, these are our options:
1. Bloat the kernel with legacy uevent helper support (this patch).
This is not really bloat, as it just makes the existing implicit dependency explicit.
It is "bloat" because there is a way to avoid it, but the user can't disable it
(even if the user modifies the init script to use uevent so it becomes unneeded, Buildroot forces the kernel option on).
Quoted 4 lines
Quoted 2 lines
2. Bloat the kernel with networking even if it is not used for anything else, and bloat busybox with uevent (3.1 kb), and always use uevent.
Networking support adds significant bloat, the other options afaik not.
Note that it's just CONFIG_NET, not CONFIG_INET. Without CONFIG_NET, you don't
have e.g. the socket() syscall. 90% of the packages will not work (at runtime). So we're kind of in the same domain as with a custom uClibc config that disables stuff that most packages depend on.
Quoted 6 lines
Quoted 5 lines
3. Use uevent in the init script but don't enforce anything (with potential silent failures), and explain stuff in the mdev help text.
4. Try out all possibilities in the init script - which still fails silently in case neither
CONFIG_UEVENT_HELPERnorCONFIG_NETis enabled in the kernel.
Quoted 6 lines
Quoted 3 lines
In my opinion, we definitely should *not* go for option 1. I don't want to be
the one that forces the kernel to maintain legacy stuff. I would definitely use uevent.What advantage does uevent have over the legacy uevent helper? Just serialization or anything else?
It's also more efficient IIUC, but I don't know much of the details.
Admittedly, that efficiency probably goes away with uevent, because it stems from avoiding a fork, but uevent does exactly that.
Quoted 8 lines
Quoted 4 lines
On the other hand, I really don't like it when we force changes into busybox or kernel configs. Since it's really likely that
CONFIG_NETis enabled in the kernel, and since our default busybox config (but not the minimal one) does enable uevent, I think that option 3 is the way to go.I don't use mdev myself, so I don't really care a lot about what option we go for longer term, but given how close 2019.05 is, the only valid options for the release are this patch or nothing.
As Andy indicated, this bug has existed for several years. I really don't see
the need to fix it for 2019.05.
Quoted 11 lines
I have no problems with patches (for next) moving our mdev logic to netdev instead if people are interested.
Quoted 4 lines
By the way, with netlink, the event are properly serialized, and uevent makes
sure that only one mdev subprocess is created so it maintains the serialisation. So, it is no longer needed to create/dev/mdev.seq(which, for some reason, we currently don't do...).Ahh yes, a patch adding an 'echo >/dev/mdev.seq' to S10mdev would be nice.
But not needed if we use uevent :-)
Regards,
Arnout
PATCH 1/1 linux: enable UEVENT_HELPER when mdev is used
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Arnout" == Arnout Vandecappelle <[email protected]> writes:
Hi,
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
start-stop-daemon -S -b -x
/sbin/uevent-- mdevAhh, so busybox now has a clone of s6-uevent-listener / mdevd-netlink? I wasn't aware of that.
It has been added in 2015 :-)
As I said, I don't use mdev ;)
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
1. Bloat the kernel with legacy uevent helper support (this patch).
This is not really bloat, as it just makes the existing implicit dependency explicit.
It is "bloat" because there is a way to avoid it, but the user can't disable it
(even if the user modifies the init script to use uevent so it becomes unneeded, Buildroot forces the kernel option on).
Correct.
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
2. Bloat the kernel with networking even if it is not used for anything else, and bloat busybox with uevent (3.1 kb), and always use uevent.
Networking support adds significant bloat, the other options afaik not.
Note that it's just
CONFIG_NET, notCONFIG_INET. WithoutCONFIG_NET, you don't
have e.g. thesocket()syscall. 90% of the packages will not work (at runtime). So we're kind of in the same domain as with a custom uClibc config that disables stuff that most packages depend on.
How will the uevent daemon work without socket()?
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
3. Use uevent in the init script but don't enforce anything (with potential silent failures), and explain stuff in the mdev help text.
4. Try out all possibilities in the init script - which still fails silently in case neither
CONFIG_UEVENT_HELPERnorCONFIG_NETis enabled in the kernel.In my opinion, we definitely should *not* go for option 1. I don't want to be
the one that forces the kernel to maintain legacy stuff. I would definitely use uevent.
Quoted 6 lines
Quoted 2 lines
What advantage does uevent have over the legacy uevent helper? Just serialization or anything else?
It's also more efficient IIUC, but I don't know much of the details.
Admittedly, that efficiency probably goes away with uevent, because it stems from avoiding a fork, but uevent does exactly that.
Indeed. Notice that Denys has just merged the daemon mode (-d) support for mdev, so from a performance PoV, that is probably what we should support rather than uevent + mdev:
http://lists.busybox.net/pipermail/busybox/2019-June/087305.html
Quoted 6 lines
Quoted 3 lines
I don't use mdev myself, so I don't really care a lot about what option we go for longer term, but given how close 2019.05 is, the only valid options for the release are this patch or nothing.
As Andy indicated, this bug has existed for several years. I really don't see
the need to fix it for 2019.05.
.. so I didn't.
Quoted 4 lines
Quoted 2 lines
Ahh yes, a patch adding an 'echo >/dev/mdev.seq' to S10mdev would be nice.
But not needed if we use uevent :-)
Not if we unconditionally do it, no.
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 linux: enable UEVENT_HELPER when mdev is used
Hi all,
Quoted 54 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Arnout" == Arnout Vandecappelle <[email protected]> writes:
Hi,
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
start-stop-daemon -S -b -x
/sbin/uevent-- mdevAhh, so busybox now has a clone of s6-uevent-listener / mdevd-netlink? I wasn't aware of that.
It has been added in 2015 :-)
As I said, I don't use mdev ;)
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
1. Bloat the kernel with legacy uevent helper support (this patch).
This is not really bloat, as it just makes the existing implicit dependency explicit.
It is "bloat" because there is a way to avoid it, but the user can't disable it
(even if the user modifies the init script to use uevent so it becomes unneeded, Buildroot forces the kernel option on).Correct.
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
2. Bloat the kernel with networking even if it is not used for anything else, and bloat busybox with uevent (3.1 kb), and always use uevent.
Networking support adds significant bloat, the other options afaik not.
Note that it's just
CONFIG_NET, notCONFIG_INET. WithoutCONFIG_NET, you don't
have e.g. thesocket()syscall. 90% of the packages will not work (at runtime). So we're kind of in the same domain as with a custom uClibc config that disables stuff that most packages depend on.How will the uevent daemon work without
socket()?Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
3. Use uevent in the init script but don't enforce anything (with potential silent failures), and explain stuff in the mdev help text.
4. Try out all possibilities in the init script - which still fails silently in case neither
CONFIG_UEVENT_HELPERnorCONFIG_NETis enabled in the kernel.In my opinion, we definitely should *not* go for option 1. I don't want to be
the one that forces the kernel to maintain legacy stuff. I would definitely use uevent.Quoted 6 lines
Quoted 2 lines
What advantage does uevent have over the legacy uevent helper? Just serialization or anything else?
It's also more efficient IIUC, but I don't know much of the details.
Admittedly, that efficiency probably goes away with uevent, because it stems from avoiding a fork, but uevent does exactly that.
Quoted 5 lines
Indeed. Notice that Denys has just merged the daemon mode (-d) support for mdev, so from a performance PoV, that is probably what we should support rather than uevent + mdev:
http://lists.busybox.net/pipermail/busybox/2019-June/087305.html
This is great news !
Even then, the S10mdev init script has to be modified to start mdev in daemon mode. I could add this to
http://patchwork.ozlabs.org/patch/1107175/. However, I don't see a good way to check if FEATURE_MDEV_DAEMON=y.
I could try to search for the daemon option in the help text (mdev 2>&1 | grep "runs mdev as daemon"),
but this look a bit hackish to me.
Quoted 12 lines
Quoted 8 lines
Quoted 5 lines
I don't use mdev myself, so I don't really care a lot about what option we go for longer term, but given how close 2019.05 is, the only valid options for the release are this patch or nothing.
As Andy indicated, this bug has existed for several years. I really don't see
the need to fix it for 2019.05... so I didn't.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Ahh yes, a patch adding an 'echo >/dev/mdev.seq' to S10mdev would be nice.
But not needed if we use uevent :-)
Not if we unconditionally do it, no.
Regards,
Titouan
PATCH 1/1 linux: enable UEVENT_HELPER when mdev is used
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Titouan" == Titouan Christophe <[email protected]> writes:
Hi,
Quoted 4 lines
Quoted 4 lines
Indeed. Notice that Denys has just merged the daemon mode (-d) support for mdev, so from a performance PoV, that is probably what we should support rather than uevent + mdev:
Quoted 8 lines
This is great news !
Even then, the S10mdev init script has to be modified to start mdev in daemon mode. I could add this to
http://patchwork.ozlabs.org/patch/1107175/. However, I don't see a good way to check if FEATURE_MDEV_DAEMON=y.
We would just forcibly enable that option when building busybox when BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV is enabled, similar to the other mdev options.
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 linux: enable UEVENT_HELPER when mdev is used
Hello,
Quoted 12 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Titouan" == Titouan Christophe <[email protected]> writes:
Hi,
Quoted 7 lines
Quoted 5 lines
Indeed. Notice that Denys has just merged the daemon mode (-d) support for mdev, so from a performance PoV, that is probably what we should support rather than uevent + mdev:
http://lists.busybox.net/pipermail/busybox/2019-June/087305.html
This is great news !
Quoted 9 lines
Quoted 4 lines
Even then, the S10mdev init script has to be modified to start mdev in daemon mode. I could add this to
http://patchwork.ozlabs.org/patch/1107175/. However, I don't see a good way to check if FEATURE_MDEV_DAEMON=y.We would just forcibly enable that option when building busybox when
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEVis enabled, similar to the other mdev options.
IMHO this patch can now be archived, since this series has been applied:
http://patchwork.ozlabs.org/project/buildroot/list/?series=114874 .
Also, this last patch http://patchwork.ozlabs.org/patch/1119590/ would be needed to make sure mdev daemon mode can always be used.
Regards,
Titouan
PATCH 1/1 linux: enable UEVENT_HELPER when mdev is used
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Titouan" == Titouan Christophe <[email protected]> writes:
Hi,
Quoted 3 lines
IMHO this patch can now be archived, since this series has been applied:
http://patchwork.ozlabs.org/project/buildroot/list/?series=114874 .
Agreed, marked as rejected.
Quoted 2 lines
Also, this last patch http://patchwork.ozlabs.org/patch/1119590/ would be needed to make sure mdev daemon mode can always be used.
And I have applied this, thanks!
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 linux: enable UEVENT_HELPER when mdev is used
In reply to Arnout VandecappelleHello Arnout, Peter, Andy and all,
Quoted 36 lines · Arnout Vandecappelle
Quoted 2 lines · Peter Korsgaard
S10mdev uses
/proc/sys/kernel/hotplug, which is only available ifCONFIG_UEVENT_HELPERis enabled in the kernel, so ensure it is.So, I take a look at it, and it's a little bit more complicated...
Busybox *does* have support for the "new" netlink-based uevent interface, but
that interface needs a daemon that keeps running and they separated that daemon into a separate process, called uevent. So, in the "new" way, you should do something like (not tried, just based on source code):start-stop-daemon -S -b -x
/sbin/uevent-- mdevBut of course, that means that we have to be sure that the uevent executable is
in fact built for busybox. So we'd need to extendBUSYBOX_SET_MDEVto enable uevent.Also, we can only use the uevent approach if netlink uevents are available.
They exist since 2.6.12, so I guess on that side we're safe. However, they also depend onCONFIG_NET(because netlink does).So, these are our options:
1. Bloat the kernel with legacy uevent helper support (this patch).
2. Bloat the kernel with networking even if it is not used for anything else, and bloat busybox with uevent (3.1 kb), and always use uevent.
3. Use uevent in the init script but don't enforce anything (with potential silent failures), and explain stuff in the mdev help text.
4. Try out all possibilities in the init script - which still fails silently in case neither
CONFIG_UEVENT_HELPERnorCONFIG_NETis enabled in the kernel.
Quoted 6 lines
In my opinion, we definitely should *not* go for option 1. I don't want to be
the one that forces the kernel to maintain legacy stuff. I would definitely use uevent. On the other hand, I really don't like it when we force changes into busybox or kernel configs. Since it's really likely thatCONFIG_NETis enabled in the kernel, and since our default busybox config (but not the minimal one) does enable uevent, I think that option 3 is the way to go.
Couldn't we implement the following in S10mdev ?
- If both /proc/net/netlink and /sbin/uevent are present -> uevent daemon + mdev
- If /proc/sys/kernel/hotplug is present -> go for mdev as hotplug (and init mdev.seq)
- Otherwise -> print an error message.
I have a patch for this, would I submit ?
Best regards,
Titouan
Quoted 37 lines
By the way, with netlink, the event are properly serialized, and uevent makes
sure that only one mdev subprocess is created so it maintains the serialisation. So, it is no longer needed to create/dev/mdev.seq(which, for some reason, we currently don't do...).Regards,
ArnoutQuoted 13 lines
Reported-by Andy Shevchenko <[email protected]>Signed-off-by Peter Korsgaard <[email protected]>--- linux/linux.mk | 2 ++ 1 file changed, 2 insertions(+)linux/linux.mk +0
-0linux/linux.mk define LINUX_KCONFIG_FIXUP_CMDS · line 340
Quoted 8 lines
linux/linux.mk +2
-0@@ -333,6 +333,8 @@ define LINUX_KCONFIG_FIXUP_CMDS $(call KCONFIG_ENABLE_OPT,CONFIG_DEVTMPFS_MOUNT,$(@D)/.config)) $(if $(BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV), $(call KCONFIG_ENABLE_OPT,CONFIG_INOTIFY_USER,$(@D)/.config)) + $(if $(BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV), + $(call KCONFIG_ENABLE_OPT,CONFIG_UEVENT_HELPER,$(@D)/.config)) $(if $(BR2_PACKAGE_AUDIT), $(call KCONFIG_ENABLE_OPT,CONFIG_NET,$(@D)/.config) $(call KCONFIG_ENABLE_OPT,CONFIG_AUDIT,$(@D)/.config))_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
PATCH 1/1 linux: enable UEVENT_HELPER when mdev is used
Quoted 49 lines · Titouan Christophe
Hello Arnout, Peter, Andy and all,
Quoted 37 lines · Arnout Vandecappelle
Quoted 2 lines · Peter Korsgaard
S10mdev uses
/proc/sys/kernel/hotplug, which is only available ifCONFIG_UEVENT_HELPERis enabled in the kernel, so ensure it is.? So, I take a look at it, and it's a little bit more complicated...
? Busybox *does* have support for the "new" netlink-based uevent interface, but that interface needs a daemon that keeps running and they separated that daemon into a separate process, called uevent. So, in the "new" way, you should do something like (not tried, just based on source code):
start-stop-daemon -S -b -x
/sbin/uevent-- mdev? But of course, that means that we have to be sure that the uevent executable is in fact built for busybox. So we'd need to extend
BUSYBOX_SET_MDEVto enable uevent.? Also, we can only use the uevent approach if netlink uevents are available. They exist since 2.6.12, so I guess on that side we're safe. However, they also depend on
CONFIG_NET(because netlink does).? So, these are our options:
1. Bloat the kernel with legacy uevent helper support (this patch).
2. Bloat the kernel with networking even if it is not used for anything else, and bloat busybox with uevent (3.1 kb), and always use uevent.
3. Use uevent in the init script but don't enforce anything (with potential silent failures), and explain stuff in the mdev help text.
4. Try out all possibilities in the init script - which still fails silently in case neither
CONFIG_UEVENT_HELPERnorCONFIG_NETis enabled in the kernel.Quoted 6 lines
? In my opinion, we definitely should *not* go for option 1. I don't want to be the one that forces the kernel to maintain legacy stuff. I would definitely use uevent. On the other hand, I really don't like it when we force changes into busybox or kernel configs. Since it's really likely that
CONFIG_NETis enabled in the kernel, and since our default busybox config (but not the minimal one) does enable uevent, I think that option 3 is the way to go.Couldn't we implement the following in S10mdev ?
Quoted 7 lines
- If both
/proc/net/netlinkand/sbin/ueventare present -> uevent daemon + mdev
- If/proc/sys/kernel/hotplugis present -> go for mdev as hotplug (and init mdev.seq)
- Otherwise -> print an error message.I have a patch for this, would I submit ?
If you anyway have it, submit it, and we can discuss based on that.
It would be nice if you could also do a preparatory patch that converts the
file to the "canonical init script format" (cfr. e.g. package/rsyslog/S01rsyslogd). mdev doesn't have arguments or a default, so that simplifies things a little.
Regards,
Arnout
PATCH 1/1 linux: enable UEVENT_HELPER when mdev is used
Hello,
Quoted 1 line · On Wed, 29 May 2019 15:57:22 +0200 Arnout Vandecappelle <[email protected]> wrote:
If you anyway have it, submit it, and we can discuss based on that.
Titouan has submitted his patch:
http://patchwork.ozlabs.org/patch/1107175/
The commit title is probably not the best, but other than that, the idea looks good to me.
Quoted 4 lines
It would be nice if you could also do a preparatory patch that converts the
file to the "canonical init script format" (cfr. e.g. package/rsyslog/S01rsyslogd). mdev doesn't have arguments or a default, so that simplifies things a little.
Since the change to S10mdev from Titouan is kind of a fix, I would actually not make the conversion to the "canonical format" a requirement that should be done as a preparatory patch, but that's admittedly a minor detail.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com