Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754423AbcCWQfo (ORCPT ); Wed, 23 Mar 2016 12:35:44 -0400 Received: from demumfd001.nsn-inter.net ([93.183.12.32]:39568 "EHLO demumfd001.nsn-inter.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751964AbcCWQfn (ORCPT ); Wed, 23 Mar 2016 12:35:43 -0400 Subject: Re: [PATCH] i2c: Prevent endless uevent loop with dev_dbg To: EXT Jan Glauber , Wolfram Sang References: <1458748247-9219-1-git-send-email-jglauber@cavium.com> Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org From: Alexander Sverdlin Message-ID: <56F2C5DA.9070805@nokia.com> Date: Wed, 23 Mar 2016 17:35:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1458748247-9219-1-git-send-email-jglauber@cavium.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: clean X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate-size: 2416 X-purgate-ID: 151667::1458750938-00007057-F7B17480/0/0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2356 Lines: 60 Hi! On 23/03/16 16:50, EXT Jan Glauber wrote: > 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 > > Signed-off-by: Jan Glauber Yes, this is evil thing. Both components do legal stuff, but someone has to stop this madness... I've analyzed journald code and it will suffer from removing this uevent access and I see no easy way how to provide the same level of information about the device in the log. On the other hand the fix in the Kernel is trivial and we have no information loss. Maybe it deserves a comment, so that this call is not changed back at some point in the future. But, in general: Acked-by: Alexander Sverdlin > --- > drivers/i2c/i2c-core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c > index 0f2f848..84165d9 100644 > --- a/drivers/i2c/i2c-core.c > +++ b/drivers/i2c/i2c-core.c > @@ -539,7 +539,7 @@ static int i2c_device_uevent(struct device *dev, struct kobj_uevent_env *env) > if (add_uevent_var(env, "MODALIAS=%s%s", > I2C_MODULE_PREFIX, client->name)) > return -ENOMEM; > - dev_dbg(dev, "uevent\n"); > + pr_debug("uevent: device: %s\n", dev_name(dev)); > return 0; > }