public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/powernv: delay rng of node creation until later in boot
       [not found] <Yr2PQSZWVtr+Y7a2@zx2c4.com>
@ 2022-06-30 12:16 ` Jason A. Donenfeld
  2022-06-30 13:54   ` Sachin Sant
  2022-07-04 11:57   ` Michael Ellerman
  0 siblings, 2 replies; 6+ messages in thread
From: Jason A. Donenfeld @ 2022-06-30 12:16 UTC (permalink / raw)
  To: linuxppc-dev, mpe, sachinp; +Cc: Jason A. Donenfeld, stable

The of node for the rng must be created much later in boot. Otherwise it
tries to connect to a parent that doesn't yet exist, resulting on this
splat:

[    0.000478] kobject: '(null)' ((____ptrval____)): is not initialized, yet kobject_get() is being called.
[    0.002925] [c000000002a0fb30] [c00000000073b0bc] kobject_get+0x8c/0x100 (unreliable)
[    0.003071] [c000000002a0fba0] [c00000000087e464] device_add+0xf4/0xb00
[    0.003194] [c000000002a0fc80] [c000000000a7f6e4] of_device_add+0x64/0x80
[    0.003321] [c000000002a0fcb0] [c000000000a800d0] of_platform_device_create_pdata+0xd0/0x1b0
[    0.003476] [c000000002a0fd00] [c00000000201fa44] pnv_get_random_long_early+0x240/0x2e4
[    0.003623] [c000000002a0fe20] [c000000002060c38] random_init+0xc0/0x214

This patch fixes the issue by doing the of node creation inside of
machine_subsys_initcall.

Fixes: f3eac426657d ("powerpc/powernv: wire up rng during setup_arch")
Cc: stable@vger.kernel.org
Cc: Michael Ellerman <mpe@ellerman.id.au>
Reported-by: Sachin Sant <sachinp@linux.ibm.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 arch/powerpc/platforms/powernv/rng.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/rng.c b/arch/powerpc/platforms/powernv/rng.c
index 463c78c52cc5..bd5ad5f351c2 100644
--- a/arch/powerpc/platforms/powernv/rng.c
+++ b/arch/powerpc/platforms/powernv/rng.c
@@ -176,12 +176,8 @@ static int __init pnv_get_random_long_early(unsigned long *v)
 		    NULL) != pnv_get_random_long_early)
 		return 0;
 
-	for_each_compatible_node(dn, NULL, "ibm,power-rng") {
-		if (rng_create(dn))
-			continue;
-		/* Create devices for hwrng driver */
-		of_platform_device_create(dn, NULL, NULL);
-	}
+	for_each_compatible_node(dn, NULL, "ibm,power-rng")
+		rng_create(dn);
 
 	if (!ppc_md.get_random_seed)
 		return 0;
@@ -205,10 +201,16 @@ void __init pnv_rng_init(void)
 
 static int __init pnv_rng_late_init(void)
 {
+	struct device_node *dn;
 	unsigned long v;
+
 	/* In case it wasn't called during init for some other reason. */
 	if (ppc_md.get_random_seed == pnv_get_random_long_early)
 		pnv_get_random_long_early(&v);
+	if (ppc_md.get_random_seed == powernv_get_random_long) {
+		for_each_compatible_node(dn, NULL, "ibm,power-rng")
+			of_platform_device_create(dn, NULL, NULL);
+	}
 	return 0;
 }
 machine_subsys_initcall(powernv, pnv_rng_late_init);
-- 
2.35.1


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

* Re: [PATCH] powerpc/powernv: delay rng of node creation until later in boot
  2022-06-30 12:16 ` [PATCH] powerpc/powernv: delay rng of node creation until later in boot Jason A. Donenfeld
@ 2022-06-30 13:54   ` Sachin Sant
  2022-07-02 10:42     ` Jason A. Donenfeld
  2022-07-04 11:57   ` Michael Ellerman
  1 sibling, 1 reply; 6+ messages in thread
From: Sachin Sant @ 2022-06-30 13:54 UTC (permalink / raw)
  To: Jason A. Donenfeld; +Cc: linuxppc-dev, Michael Ellerman, stable



> On 30-Jun-2022, at 5:46 PM, Jason A. Donenfeld <Jason@zx2c4.com> wrote:
> 
> The of node for the rng must be created much later in boot. Otherwise it
> tries to connect to a parent that doesn't yet exist, resulting on this
> splat:
> 
> [    0.000478] kobject: '(null)' ((____ptrval____)): is not initialized, yet kobject_get() is being called.
> [    0.002925] [c000000002a0fb30] [c00000000073b0bc] kobject_get+0x8c/0x100 (unreliable)
> [    0.003071] [c000000002a0fba0] [c00000000087e464] device_add+0xf4/0xb00
> [    0.003194] [c000000002a0fc80] [c000000000a7f6e4] of_device_add+0x64/0x80
> [    0.003321] [c000000002a0fcb0] [c000000000a800d0] of_platform_device_create_pdata+0xd0/0x1b0
> [    0.003476] [c000000002a0fd00] [c00000000201fa44] pnv_get_random_long_early+0x240/0x2e4
> [    0.003623] [c000000002a0fe20] [c000000002060c38] random_init+0xc0/0x214
> 
> This patch fixes the issue by doing the of node creation inside of
> machine_subsys_initcall.
> 
> Fixes: f3eac426657d ("powerpc/powernv: wire up rng during setup_arch")
> Cc: stable@vger.kernel.org
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Reported-by: Sachin Sant <sachinp@linux.ibm.com>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> ---

Thanks Jason for the patch. This fixes the reported problem for me.

Tested-by: Sachin Sant <sachinp@linux.ibm.com>

- Sachin


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

* Re: [PATCH] powerpc/powernv: delay rng of node creation until later in boot
  2022-06-30 13:54   ` Sachin Sant
@ 2022-07-02 10:42     ` Jason A. Donenfeld
  2022-07-04 11:14       ` Michael Ellerman
  0 siblings, 1 reply; 6+ messages in thread
From: Jason A. Donenfeld @ 2022-07-02 10:42 UTC (permalink / raw)
  To: Sachin Sant, mpe, benh, paulus; +Cc: linuxppc-dev, stable

Hi Benjamin, Paul,

On Thu, Jun 30, 2022 at 07:24:05PM +0530, Sachin Sant wrote:
> > On 30-Jun-2022, at 5:46 PM, Jason A. Donenfeld <Jason@zx2c4.com> wrote:
> > 
> > The of node for the rng must be created much later in boot. Otherwise it
> > tries to connect to a parent that doesn't yet exist, resulting on this
> > splat:
> > 
> > [    0.000478] kobject: '(null)' ((____ptrval____)): is not initialized, yet kobject_get() is being called.
> > [    0.002925] [c000000002a0fb30] [c00000000073b0bc] kobject_get+0x8c/0x100 (unreliable)
> > [    0.003071] [c000000002a0fba0] [c00000000087e464] device_add+0xf4/0xb00
> > [    0.003194] [c000000002a0fc80] [c000000000a7f6e4] of_device_add+0x64/0x80
> > [    0.003321] [c000000002a0fcb0] [c000000000a800d0] of_platform_device_create_pdata+0xd0/0x1b0
> > [    0.003476] [c000000002a0fd00] [c00000000201fa44] pnv_get_random_long_early+0x240/0x2e4
> > [    0.003623] [c000000002a0fe20] [c000000002060c38] random_init+0xc0/0x214
> > 
> > This patch fixes the issue by doing the of node creation inside of
> > machine_subsys_initcall.
> > 
> > Fixes: f3eac426657d ("powerpc/powernv: wire up rng during setup_arch")
> > Cc: stable@vger.kernel.org
> > Cc: Michael Ellerman <mpe@ellerman.id.au>
> > Reported-by: Sachin Sant <sachinp@linux.ibm.com>
> > Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> > ---
> 
> Thanks Jason for the patch. This fixes the reported problem for me.
> 
> Tested-by: Sachin Sant <sachinp@linux.ibm.com>
> 
> - Sachin

It sounds like Michael is on vacation for a few weeks. Think you could
queue this up so we can get POWER8 booting again?

Sorry I broke things before :-(

Jason

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

* Re: [PATCH] powerpc/powernv: delay rng of node creation until later in boot
  2022-07-02 10:42     ` Jason A. Donenfeld
@ 2022-07-04 11:14       ` Michael Ellerman
  2022-07-04 11:34         ` Jason A. Donenfeld
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Ellerman @ 2022-07-04 11:14 UTC (permalink / raw)
  To: Jason A. Donenfeld, Sachin Sant, benh, paulus; +Cc: linuxppc-dev, stable



On 2 July 2022 8:42:06 pm AEST, "Jason A. Donenfeld" <Jason@zx2c4.com> wrote:
>Hi Benjamin, Paul,
>
>On Thu, Jun 30, 2022 at 07:24:05PM +0530, Sachin Sant wrote:
>> > On 30-Jun-2022, at 5:46 PM, Jason A. Donenfeld <Jason@zx2c4.com> wrote:
>> > 
>> > The of node for the rng must be created much later in boot. Otherwise it
>> > tries to connect to a parent that doesn't yet exist, resulting on this
>> > splat:
>> > 
>> > [    0.000478] kobject: '(null)' ((____ptrval____)): is not initialized, yet kobject_get() is being called.
>> > [    0.002925] [c000000002a0fb30] [c00000000073b0bc] kobject_get+0x8c/0x100 (unreliable)
>> > [    0.003071] [c000000002a0fba0] [c00000000087e464] device_add+0xf4/0xb00
>> > [    0.003194] [c000000002a0fc80] [c000000000a7f6e4] of_device_add+0x64/0x80
>> > [    0.003321] [c000000002a0fcb0] [c000000000a800d0] of_platform_device_create_pdata+0xd0/0x1b0
>> > [    0.003476] [c000000002a0fd00] [c00000000201fa44] pnv_get_random_long_early+0x240/0x2e4
>> > [    0.003623] [c000000002a0fe20] [c000000002060c38] random_init+0xc0/0x214
>> > 
>> > This patch fixes the issue by doing the of node creation inside of
>> > machine_subsys_initcall.
>> > 
>> > Fixes: f3eac426657d ("powerpc/powernv: wire up rng during setup_arch")
>> > Cc: stable@vger.kernel.org
>> > Cc: Michael Ellerman <mpe@ellerman.id.au>
>> > Reported-by: Sachin Sant <sachinp@linux.ibm.com>
>> > Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
>> > ---
>> 
>> Thanks Jason for the patch. This fixes the reported problem for me.
>> 
>> Tested-by: Sachin Sant <sachinp@linux.ibm.com>
>> 
>> - Sachin
>
>It sounds like Michael is on vacation for a few weeks. Think you could
>queue this up so we can get POWER8 booting again?

It doesn't break booting for me, but it is an ugly splat.

I'll pick it up into fixes.

I think it's more correct to say the "platform device creation" causes the problem, so I'll update the change log to say that.

cheers

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

* Re: [PATCH] powerpc/powernv: delay rng of node creation until later in boot
  2022-07-04 11:14       ` Michael Ellerman
@ 2022-07-04 11:34         ` Jason A. Donenfeld
  0 siblings, 0 replies; 6+ messages in thread
From: Jason A. Donenfeld @ 2022-07-04 11:34 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: Sachin Sant, benh, paulus, linuxppc-dev, stable

Hi Michael,

On Mon, Jul 04, 2022 at 09:14:32PM +1000, Michael Ellerman wrote:
> 
> 
> On 2 July 2022 8:42:06 pm AEST, "Jason A. Donenfeld" <Jason@zx2c4.com> wrote:
> >Hi Benjamin, Paul,
> >
> >On Thu, Jun 30, 2022 at 07:24:05PM +0530, Sachin Sant wrote:
> >> > On 30-Jun-2022, at 5:46 PM, Jason A. Donenfeld <Jason@zx2c4.com> wrote:
> >> > 
> >> > The of node for the rng must be created much later in boot. Otherwise it
> >> > tries to connect to a parent that doesn't yet exist, resulting on this
> >> > splat:
> >> > 
> >> > [    0.000478] kobject: '(null)' ((____ptrval____)): is not initialized, yet kobject_get() is being called.
> >> > [    0.002925] [c000000002a0fb30] [c00000000073b0bc] kobject_get+0x8c/0x100 (unreliable)
> >> > [    0.003071] [c000000002a0fba0] [c00000000087e464] device_add+0xf4/0xb00
> >> > [    0.003194] [c000000002a0fc80] [c000000000a7f6e4] of_device_add+0x64/0x80
> >> > [    0.003321] [c000000002a0fcb0] [c000000000a800d0] of_platform_device_create_pdata+0xd0/0x1b0
> >> > [    0.003476] [c000000002a0fd00] [c00000000201fa44] pnv_get_random_long_early+0x240/0x2e4
> >> > [    0.003623] [c000000002a0fe20] [c000000002060c38] random_init+0xc0/0x214
> >> > 
> >> > This patch fixes the issue by doing the of node creation inside of
> >> > machine_subsys_initcall.
> >> > 
> >> > Fixes: f3eac426657d ("powerpc/powernv: wire up rng during setup_arch")
> >> > Cc: stable@vger.kernel.org
> >> > Cc: Michael Ellerman <mpe@ellerman.id.au>
> >> > Reported-by: Sachin Sant <sachinp@linux.ibm.com>
> >> > Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> >> > ---
> >> 
> >> Thanks Jason for the patch. This fixes the reported problem for me.
> >> 
> >> Tested-by: Sachin Sant <sachinp@linux.ibm.com>
> >> 
> >> - Sachin
> >
> >It sounds like Michael is on vacation for a few weeks. Think you could
> >queue this up so we can get POWER8 booting again?
> 
> It doesn't break booting for me, but it is an ugly splat.
> 
> I'll pick it up into fixes.
> 
> I think it's more correct to say the "platform device creation" causes the problem, so I'll update the change log to say that.

Sounds good. Thank you!

Jason

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

* Re: [PATCH] powerpc/powernv: delay rng of node creation until later in boot
  2022-06-30 12:16 ` [PATCH] powerpc/powernv: delay rng of node creation until later in boot Jason A. Donenfeld
  2022-06-30 13:54   ` Sachin Sant
@ 2022-07-04 11:57   ` Michael Ellerman
  1 sibling, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2022-07-04 11:57 UTC (permalink / raw)
  To: sachinp, mpe, linuxppc-dev, Jason A. Donenfeld; +Cc: stable

On Thu, 30 Jun 2022 14:16:54 +0200, Jason A. Donenfeld wrote:
> The of node for the rng must be created much later in boot. Otherwise it
> tries to connect to a parent that doesn't yet exist, resulting on this
> splat:
> 
> [    0.000478] kobject: '(null)' ((____ptrval____)): is not initialized, yet kobject_get() is being called.
> [    0.002925] [c000000002a0fb30] [c00000000073b0bc] kobject_get+0x8c/0x100 (unreliable)
> [    0.003071] [c000000002a0fba0] [c00000000087e464] device_add+0xf4/0xb00
> [    0.003194] [c000000002a0fc80] [c000000000a7f6e4] of_device_add+0x64/0x80
> [    0.003321] [c000000002a0fcb0] [c000000000a800d0] of_platform_device_create_pdata+0xd0/0x1b0
> [    0.003476] [c000000002a0fd00] [c00000000201fa44] pnv_get_random_long_early+0x240/0x2e4
> [    0.003623] [c000000002a0fe20] [c000000002060c38] random_init+0xc0/0x214
> 
> [...]

Applied to powerpc/fixes.

[1/1] powerpc/powernv: delay rng of node creation until later in boot
      https://git.kernel.org/powerpc/c/887502826549caa7e4215fd9e628f48f14c0825a

cheers

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

end of thread, other threads:[~2022-07-04 11:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <Yr2PQSZWVtr+Y7a2@zx2c4.com>
2022-06-30 12:16 ` [PATCH] powerpc/powernv: delay rng of node creation until later in boot Jason A. Donenfeld
2022-06-30 13:54   ` Sachin Sant
2022-07-02 10:42     ` Jason A. Donenfeld
2022-07-04 11:14       ` Michael Ellerman
2022-07-04 11:34         ` Jason A. Donenfeld
2022-07-04 11:57   ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox