linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Regression in Linux next with show wakeup sources stats in sysfs
@ 2019-08-14  6:38 Tony Lindgren
  2019-08-14  7:08 ` Stephen Boyd
  0 siblings, 1 reply; 4+ messages in thread
From: Tony Lindgren @ 2019-08-14  6:38 UTC (permalink / raw)
  To: Tri Vo, Greg Kroah-Hartman, Stephen Boyd, Kalesh Singh,
	Rafael J. Wysocki
  Cc: linux-pm, linux-kernel, linux-arm-kernel, linux-omap

Hi all,

Looks like commit 986845e747af ("PM / wakeup: Show wakeup sources stats
in sysfs") has caused a regression in Linux next where I can now get
some errors like this during the boot:

kobject_add_internal failed for wakeup10 (error: -2 parent: usb)

Any ideas why this might be happening? Maybe some deferred probe
related issue?

Regards,

Tony

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Regression in Linux next with show wakeup sources stats in sysfs
  2019-08-14  6:38 Regression in Linux next with show wakeup sources stats in sysfs Tony Lindgren
@ 2019-08-14  7:08 ` Stephen Boyd
  2019-08-14  7:32   ` Tony Lindgren
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Boyd @ 2019-08-14  7:08 UTC (permalink / raw)
  To: Rafael J. Wysocki, Greg Kroah-Hartman, Kalesh Singh,
	Tony Lindgren, Tri Vo
  Cc: linux-pm, linux-kernel, linux-arm-kernel, linux-omap

Quoting Tony Lindgren (2019-08-13 23:38:03)
> Hi all,
> 
> Looks like commit 986845e747af ("PM / wakeup: Show wakeup sources stats
> in sysfs") has caused a regression in Linux next where I can now get
> some errors like this during the boot:
> 
> kobject_add_internal failed for wakeup10 (error: -2 parent: usb)
> 
> Any ideas why this might be happening? Maybe some deferred probe
> related issue?
> 

Yeah! Take a look at this thread[1] and please test out patches I'm
throwing out there like a total cowboy(d).

[1] https://lkml.kernel.org/r/1565731976.8572.16.camel@lca.pw


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Regression in Linux next with show wakeup sources stats in sysfs
  2019-08-14  7:08 ` Stephen Boyd
@ 2019-08-14  7:32   ` Tony Lindgren
  2019-08-14 14:56     ` Stephen Boyd
  0 siblings, 1 reply; 4+ messages in thread
From: Tony Lindgren @ 2019-08-14  7:32 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Rafael J. Wysocki, Greg Kroah-Hartman, Kalesh Singh, Tri Vo,
	linux-omap, linux-kernel, linux-arm-kernel, linux-pm,
	Sebastian Reichel

* Stephen Boyd <swboyd@chromium.org> [190814 07:09]:
> Quoting Tony Lindgren (2019-08-13 23:38:03)
> > Hi all,
> > 
> > Looks like commit 986845e747af ("PM / wakeup: Show wakeup sources stats
> > in sysfs") has caused a regression in Linux next where I can now get
> > some errors like this during the boot:
> > 
> > kobject_add_internal failed for wakeup10 (error: -2 parent: usb)
> > 
> > Any ideas why this might be happening? Maybe some deferred probe
> > related issue?
> > 
> 
> Yeah! Take a look at this thread[1] and please test out patches I'm
> throwing out there like a total cowboy(d).
> 
> [1] https://lkml.kernel.org/r/1565731976.8572.16.camel@lca.pw

Oh OK thanks, looks like I'm a bit behind then. My test case turned
out to be caused by device_init_wakeup() called before device_add() for
power_supply in case that helps. In that case create_dir() will fail
for kobject_add_internal(). Doing something like below fixes the
issue, but seems like we probably have other similar issues as well.
Adding Sebastian to Cc in case this might be a real problem despite
the other issues.

Regards,

Tony

8< -----------------------
diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -1051,14 +1051,14 @@ __power_supply_register(struct device *parent,
 	}
 
 	spin_lock_init(&psy->changed_lock);
-	rc = device_init_wakeup(dev, ws);
-	if (rc)
-		goto wakeup_init_failed;
-
 	rc = device_add(dev);
 	if (rc)
 		goto device_add_failed;
 
+	rc = device_init_wakeup(dev, ws);
+	if (rc)
+		goto wakeup_init_failed;
+
 	rc = psy_register_thermal(psy);
 	if (rc)
 		goto register_thermal_failed;
@@ -1100,9 +1100,9 @@ __power_supply_register(struct device *parent,
 register_cooler_failed:
 	psy_unregister_thermal(psy);
 register_thermal_failed:
+wakeup_init_failed:
 	device_del(dev);
 device_add_failed:
-wakeup_init_failed:
 check_supplies_failed:
 dev_set_name_failed:
 	put_device(dev);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Regression in Linux next with show wakeup sources stats in sysfs
  2019-08-14  7:32   ` Tony Lindgren
@ 2019-08-14 14:56     ` Stephen Boyd
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2019-08-14 14:56 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Rafael J. Wysocki, Greg Kroah-Hartman, Kalesh Singh, Tri Vo,
	linux-omap, linux-kernel, linux-arm-kernel, linux-pm,
	Sebastian Reichel

Quoting Tony Lindgren (2019-08-14 00:32:34)
> * Stephen Boyd <swboyd@chromium.org> [190814 07:09]:
> > Quoting Tony Lindgren (2019-08-13 23:38:03)
> > > Hi all,
> > > 
> > > Looks like commit 986845e747af ("PM / wakeup: Show wakeup sources stats
> > > in sysfs") has caused a regression in Linux next where I can now get
> > > some errors like this during the boot:
> > > 
> > > kobject_add_internal failed for wakeup10 (error: -2 parent: usb)
> > > 
> > > Any ideas why this might be happening? Maybe some deferred probe
> > > related issue?
> > > 
> > 
> > Yeah! Take a look at this thread[1] and please test out patches I'm
> > throwing out there like a total cowboy(d).
> > 
> > [1] https://lkml.kernel.org/r/1565731976.8572.16.camel@lca.pw
> 
> Oh OK thanks, looks like I'm a bit behind then. My test case turned
> out to be caused by device_init_wakeup() called before device_add() for
> power_supply in case that helps. In that case create_dir() will fail
> for kobject_add_internal(). Doing something like below fixes the
> issue, but seems like we probably have other similar issues as well.
> Adding Sebastian to Cc in case this might be a real problem despite
> the other issues.
> 

Ah yeah. I sent a patch for power supply earlier[2], but now I'm
thinking that it would be better to take the approach in the thread I
mentioned where we just don't add sysfs stuff until when device_add() is
called.

[2] https://lkml.kernel.org/r/20190801213330.81079-1-swboyd@chromium.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-08-14 14:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-14  6:38 Regression in Linux next with show wakeup sources stats in sysfs Tony Lindgren
2019-08-14  7:08 ` Stephen Boyd
2019-08-14  7:32   ` Tony Lindgren
2019-08-14 14:56     ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).