diff mbox series

power: supply: Ratelimit no data debug output

Message ID 20230305205226.773025-1-marex@denx.de
State Accepted
Commit 155c45a25679f571c2ae57d10db843a9dfc63430
Headers show
Series power: supply: Ratelimit no data debug output | expand

Commit Message

Marek Vasut March 5, 2023, 8:52 p.m. UTC
Reduce the amount of output this dev_dbg() statement emits into logs,
otherwise if system software polls the sysfs entry for data and keeps
getting -ENODATA, it could end up filling the logs up.

This does in fact make systemd journald choke, since during boot the
sysfs power supply entries are polled and if journald starts at the
same time, the journal is just being repeatedly filled up, and the
system stops on trying to start journald without booting any further.

Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Sebastian Reichel <sre@kernel.org>
Cc: linux-pm@vger.kernel.org
---
 drivers/power/supply/power_supply_sysfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Marek Vasut May 10, 2023, 11:46 p.m. UTC | #1
On 3/5/23 21:57, Hans de Goede wrote:
> Hi,

Hi,

> On 3/5/23 21:52, Marek Vasut wrote:
>> Reduce the amount of output this dev_dbg() statement emits into logs,
>> otherwise if system software polls the sysfs entry for data and keeps
>> getting -ENODATA, it could end up filling the logs up.
>>
>> This does in fact make systemd journald choke, since during boot the
>> sysfs power supply entries are polled and if journald starts at the
>> same time, the journal is just being repeatedly filled up, and the
>> system stops on trying to start journald without booting any further.
>>
>> Signed-off-by: Marek Vasut <marex@denx.de>
>> ---
>> Cc: Hans de Goede <hdegoede@redhat.com>
>> Cc: Sebastian Reichel <sre@kernel.org>
>> Cc: linux-pm@vger.kernel.org
> 
> Thanks, patch looks good to me:
> 
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Any news ? Maybe this could be applied now ?
Sebastian Reichel May 11, 2023, 6:48 p.m. UTC | #2
Hi,

On Thu, May 11, 2023 at 01:46:14AM +0200, Marek Vasut wrote:
> On 3/5/23 21:57, Hans de Goede wrote:
> > On 3/5/23 21:52, Marek Vasut wrote:
> > > Reduce the amount of output this dev_dbg() statement emits into logs,
> > > otherwise if system software polls the sysfs entry for data and keeps
> > > getting -ENODATA, it could end up filling the logs up.
> > > 
> > > This does in fact make systemd journald choke, since during boot the
> > > sysfs power supply entries are polled and if journald starts at the
> > > same time, the journal is just being repeatedly filled up, and the
> > > system stops on trying to start journald without booting any further.
> > > 
> > > Signed-off-by: Marek Vasut <marex@denx.de>
> > > ---
> > > Cc: Hans de Goede <hdegoede@redhat.com>
> > > Cc: Sebastian Reichel <sre@kernel.org>
> > > Cc: linux-pm@vger.kernel.org
> > 
> > Thanks, patch looks good to me:
> > 
> > Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> 
> Any news ? Maybe this could be applied now ?

Sorry for the delay; I applied it to my fixes branch now.

-- Sebastian
Marek Vasut May 11, 2023, 8:06 p.m. UTC | #3
On 5/11/23 20:48, Sebastian Reichel wrote:
> Hi,

Hi,

> On Thu, May 11, 2023 at 01:46:14AM +0200, Marek Vasut wrote:
>> On 3/5/23 21:57, Hans de Goede wrote:
>>> On 3/5/23 21:52, Marek Vasut wrote:
>>>> Reduce the amount of output this dev_dbg() statement emits into logs,
>>>> otherwise if system software polls the sysfs entry for data and keeps
>>>> getting -ENODATA, it could end up filling the logs up.
>>>>
>>>> This does in fact make systemd journald choke, since during boot the
>>>> sysfs power supply entries are polled and if journald starts at the
>>>> same time, the journal is just being repeatedly filled up, and the
>>>> system stops on trying to start journald without booting any further.
>>>>
>>>> Signed-off-by: Marek Vasut <marex@denx.de>
>>>> ---
>>>> Cc: Hans de Goede <hdegoede@redhat.com>
>>>> Cc: Sebastian Reichel <sre@kernel.org>
>>>> Cc: linux-pm@vger.kernel.org
>>>
>>> Thanks, patch looks good to me:
>>>
>>> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
>>
>> Any news ? Maybe this could be applied now ?
> 
> Sorry for the delay; I applied it to my fixes branch now.

Thanks !
diff mbox series

Patch

diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
index c228205e09538..4bbb3053eef44 100644
--- a/drivers/power/supply/power_supply_sysfs.c
+++ b/drivers/power/supply/power_supply_sysfs.c
@@ -285,7 +285,8 @@  static ssize_t power_supply_show_property(struct device *dev,
 
 		if (ret < 0) {
 			if (ret == -ENODATA)
-				dev_dbg(dev, "driver has no data for `%s' property\n",
+				dev_dbg_ratelimited(dev,
+					"driver has no data for `%s' property\n",
 					attr->attr.name);
 			else if (ret != -ENODEV && ret != -EAGAIN)
 				dev_err_ratelimited(dev,