[PATCH] dmesg: do not truncate output

2023-06-18 Thread Jan Klötzke
The kernel log buffer can be configured to be bigger than 16 MiB. As the user expects to see all available logs, do not arbitrarily constrain the buffer size. Signed-off-by: Jan Klötzke --- util-linux/dmesg.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/util-linux/dmesg.c b/util-linux

[PING] mdev: improve daemon operation

2020-11-21 Thread Jan Klötzke
Hi, I posted a patch series for mdev almost a year ago: http://lists.busybox.net/pipermail/busybox/2019-December/087675.html It improves the reliability of the mdev daemon mode on busy systems. Currently the daemon mode can silently fail and stop working! It would be nice if it could be applie

Re: Weird problem with MDEV as a daemon

2020-09-10 Thread Jan Klötzke
On Thu, Sep 10, 2020 at 07:19:32AM +0200, Leonid Zhigunov wrote: > There was, of course, nothing wrong with MDEV! > It is my head and hands to blame! > And text editors, none of wich showed the newline > im mdev.conf. Only after opening it in hex editor > I spotted 0D 0A there! Glad you found the

Re: [PATCH 2/8] mdev: increase netlink buffer sizes

2019-12-19 Thread Jan Klötzke
On Thu, Dec 19, 2019 at 09:11:01PM +, Laurent Bercot wrote: > > > Overcommit is disabled: > > > > / # cat /proc/sys/vm/overcommit_memory > > 2 > > That doesn't mean overcommit is disabled. That means it's enabled with > a hard limit. What was overcommit_ratio? I've left it at the default of

Re: [PATCH 2/8] mdev: increase netlink buffer sizes

2019-12-19 Thread Jan Klötzke
On Wed, Dec 18, 2019 at 09:34:39PM +0100, Bernhard Reutner-Fischer wrote: > On 17 December 2019 17:06:46 CET, "Jan Klötzke" wrote: > >On Tue, Dec 17, 2019 at 12:01:09AM +, Laurent Bercot wrote: > >> > >> > The socket receive buffer turned out to be

Re: [PATCH 2/8] mdev: increase netlink buffer sizes

2019-12-17 Thread Jan Klötzke
On Tue, Dec 17, 2019 at 12:01:09AM +, Laurent Bercot wrote: > > > The socket receive buffer turned out to be too small for real world > > systems. Use the same size as udevd to be on the safe side. As this is > > just a limit and the memory is not allocated by the kernel until really > > neede

[PATCH 5/8] mdev: add syslog logging mode

2019-12-16 Thread Jan Klötzke
foreground due to -f, the messages are still written to stderr as before. Signed-off-by: Jan Klötzke --- util-linux/mdev.c | 24 ++-- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/util-linux/mdev.c b/util-linux/mdev.c index 91c4ff466..1ef7a029e 100644 --- a/util

[PATCH 8/8] mdev: remember line number in rule

2019-12-16 Thread Jan Klötzke
When rules are caches from mdev.conf then their line number cannot be retrieved from the parser anymore. Instead store the line number in the rule so that a cached rule still shows the line number where it was coming from. Signed-off-by: Jan Klötzke --- util-linux/mdev.c | 9 - 1 file

[PATCH 2/8] mdev: increase netlink buffer sizes

2019-12-16 Thread Jan Klötzke
The socket receive buffer turned out to be too small for real world systems. Use the same size as udevd to be on the safe side. As this is just a limit and the memory is not allocated by the kernel until really needed there is actually no memory wasted. Signed-off-by: Jan Klötzke --- util-linux

[PATCH 7/8] mdev: add SIGHUP handler to reload configuration

2019-12-16 Thread Jan Klötzke
Like a well behaved daemon the reception of SIGHUP triggers a reload of /etc/mdev.conf. The file is parsed immediately to catch any errors early and to cache the current version. Signed-off-by: Jan Klötzke --- util-linux/mdev.c | 106 +- 1 file

[PATCH 6/8] mdev: add -v to increase log verbosity

2019-12-16 Thread Jan Klötzke
: Jan Klötzke --- util-linux/mdev.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/util-linux/mdev.c b/util-linux/mdev.c index 1ef7a029e..671221af5 100644 --- a/util-linux/mdev.c +++ b/util-linux/mdev.c @@ -81,7 +81,7 @@ //kbuild:lib-$(CONFIG_MDEV) += mdev.o

[PATCH 0/8] mdev: improve daemon operation

2019-12-16 Thread Jan Klötzke
It looks like the mdev daemon mode is not fully reliable (see [1]). This patch series improves it by first increasing the netlink buffer size and by adding an error handling in case of socket overflows. During discussion a number of other related issues popped up. These are fixed in the series too

[PATCH 3/8] mdev: move daemon setup to dedicated function

2019-12-16 Thread Jan Klötzke
Signed-off-by: Jan Klötzke --- util-linux/mdev.c | 44 +++- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/util-linux/mdev.c b/util-linux/mdev.c index 4e3299d22..cfc1a38bc 100644 --- a/util-linux/mdev.c +++ b/util-linux/mdev.c @@ -1172,6

[PATCH 1/8] libbb: set netlink socket revbuf size before binding

2019-12-16 Thread Jan Klötzke
As soon as the socket is bound it will receive messages. Make sure the recieve buffer size is increased before the first message is received. Signed-off-by: Jan Klötzke --- libbb/xconnect.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/libbb/xconnect.c b

[PATCH 4/8] mdev: re-initialize if uevent messages were lost

2019-12-16 Thread Jan Klötzke
If the netlink read() failed with ENOBUFS we know that we have missed at least one message due to a socket receive buffer overrun. The only way how to recover is to drop the old socket, open a fresh one and make a cold-plug scan of the current system state. Signed-off-by: Jan Klötzke --- util

Re: mdev -d can (silently) die with "read: no buffer space available"

2019-12-16 Thread Jan Klötzke
On Mon, Dec 16, 2019 at 04:53:32PM +1000, Alexander Zangerl wrote: > On Sun, 15 Dec 2019 22:15:21 +0100, Jan Klötzke writes: > >On Sun, Dec 15, 2019 at 08:44:14AM +1000, Alexander Zangerl wrote: > >> i only increased BUFFER_SIZE. > ... > >This is strange. The read() call will always return a singl

Re: mdev -d can (silently) die with "read: no buffer space available"

2019-12-15 Thread Jan Klötzke
On Sun, Dec 15, 2019 at 08:44:14AM +1000, Alexander Zangerl wrote: > On Sat, 14 Dec 2019 14:49:20 +0100, Jan Klötzke writes: > >Just to double check: did you increase BUFFER_SIZE or RCVBUF? I'm > >asking because the error that you observed (ENOBUFS) is returned by the > &g

Re: mdev -d can (silently) die with "read: no buffer space available"

2019-12-14 Thread Jan Klötzke
On Sat, Dec 14, 2019 at 06:47:43PM +1000, Alexander Zangerl wrote: > the mdev -d daemon mode introduced in 1.31.0 works pretty well on > my (systemd- and udev-less) box, but i've hit a few minor issues: > > 1. after a few days the mdev daemon tends to die. > > this is on a laptop that suspends an

Re: [PATCH] losetup: Create loop device if it does not exist

2019-10-28 Thread Jan Klötzke
On Mon, Oct 28, 2019 at 07:26:10AM +0100, Joerg Vehlow wrote: > > > Am 23.10.2019 um 20:39 schrieb Stefan Seyfried: > > Am 22.10.19 um 10:49 schrieb Joerg Vehlow: > > > No interest in util-linux compatibility? > > Is util-linux really creating the device node? > > > > I thought it would use the

[PATCH v2 3/3] mdev: add support to run as daemon

2019-05-07 Thread Jan Klötzke
Adds the -d option to run mdev in daemon mode handling hotplug events from the kernel like udev. If the system generates many hotplug events this mode of operation will consume less resources than registering mdev as hotplug helper or using the uevent applet. Signed-off-by: Jan Klötzke --- v2

Re: [PATCH 0/3] mdev: add daemon mode

2019-05-07 Thread Jan Klötzke
On Sat, May 04, 2019 at 07:00:30PM +0200, Markus Gothe wrote: > Ouch, then fork()'ing is indeed an issue. And Linux not being an RTOS is > another issue, but I hope you are using an RTOS (like QNX or FreeRTOS) and > not Linux. Oh, Linux is actually a better match for a full blown IVI system, at

Re: [PATCH 0/3] mdev: add daemon mode

2019-05-04 Thread Jan Klötzke
On Sat, May 04, 2019 at 07:42:06AM +, Laurent Bercot wrote: > > > If mdev is used as kernel hotplug helper and the system generates many > > hotplug events it will quickly consume considerable resources because a > > process is forked for each event and, if the mdev.seq feature is used, > > th

Re: [PATCH 0/3] mdev: add daemon mode

2019-05-04 Thread Jan Klötzke
On Fri, May 03, 2019 at 11:16:34PM +0200, Markus Gothe wrote: > Err, zram ofc :) ... > > Or even better you could turn on zswap on your embedded device and avoid the > OOM-kiler which I guess is the real reason you fixed this. Actually RAM was not the problem at all. It really was the time to sp

Re: [PATCH 3/3] mdev: add support to run as daemon

2019-05-04 Thread Jan Klötzke
On Sat, May 04, 2019 at 08:06:44AM +0200, Peter Korsgaard wrote: > >>>>> "Jan" == Jan Klötzke writes: > > > Adds the -s option to run mdev in daemon mode handling hotplug events > > from the kernel like udev. If the system generates many hotplug even

[PATCH 2/3] mdev: use option parser helper

2019-05-03 Thread Jan Klötzke
Signed-off-by: Jan Klötzke --- util-linux/mdev.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/util-linux/mdev.c b/util-linux/mdev.c index 8205a260a..9e2f527d7 100644 --- a/util-linux/mdev.c +++ b/util-linux/mdev.c @@ -249,6 +249,10 @@ #endif +enum

[PATCH 1/3] mdev: move action processing into separate functions

2019-05-03 Thread Jan Klötzke
This purely moves code from main() to separate functions for better extensibility. Signed-off-by: Jan Klötzke --- util-linux/mdev.c | 154 -- 1 file changed, 82 insertions(+), 72 deletions(-) diff --git a/util-linux/mdev.c b/util-linux/mdev.c index

[PATCH 0/3] mdev: add daemon mode

2019-05-03 Thread Jan Klötzke
If mdev is used as kernel hotplug helper and the system generates many hotplug events it will quickly consume considerable resources because a process is forked for each event and, if the mdev.seq feature is used, they must also coordinate among each other. While the uevent applet mitigates some of

[PATCH 3/3] mdev: add support to run as daemon

2019-05-03 Thread Jan Klötzke
Adds the -s option to run mdev in daemon mode handling hotplug events from the kernel like udev. If the system generates many hotplug events this mode of operation will consume less resources than registering mdev as hotplug helper or using the uevent applet. Signed-off-by: Jan Klötzke --- util