Re: [PATCH] i2c: prevent endless uevent loop with CONFIG_I2C_DEBUG_CORE

From: Wolfram Sang
Date: Wed Mar 30 2016 - 08:23:11 EST


On Wed, Mar 23, 2016 at 08:47:02PM +0100, Wolfram Sang wrote:
> Jan reported this:
> ===
> After enabling CONFIG_I2C_DEBUG_CORE my system was broken
> (no network, console login not possible). System log was
> flooded with the this message:
>
> ...
> [ 608.052077] rtc-ds1307 0-0068: uevent
> [ 608.052500] rtc-ds1307 0-0068: uevent
> [ 608.052925] rtc-ds1307 0-0068: uevent
> ...
>
> The culprit is the dev_dbg printk in the i2c uevent handler.
> If this is activated (for instance by CONFIG_I2C_DEBUG_CORE)
> it results in an endless loop with systemd-journald.
>
> This happens if user-space scans the system log and reads the uevent
> file to get information about a newly created device, which seems fair
> use to me. Unfortunately reading the "uevent" file uses the same
> function that runs for creating the uevent for a new device,
> generating the next syslog entry.
>
> Ideally user-space would implement a recursion detection and
> after reading the same device file for the 1000th time call it a
> day, but nevertheless I think we should avoid this problem by
> removing the debug print completly or using another print variant.
>
> The same problem seems to be reported here:
> https://bugs.freedesktop.org/show_bug.cgi?id=76886
> ===
>
> His patch converted the message to pr_debug, but I think the debug can
> simply go. We have other means to see code paths these days. This
> enables us to clean up the function some more while we are here.
>
> Reported-by: Jan Glauber <jglauber@xxxxxxxxxx>
> Signed-off-by: Wolfram Sang <wsa@xxxxxxxxxxxxx>
> Acked-by: Alexander Sverdlin <alexander.sverdlin@xxxxxxxxx>
> Tested-by: Jan Glauber <jglauber@xxxxxxxxxx>

Applied to for-current, thanks!

Attachment: signature.asc
Description: PGP signature