All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>,
	stable@vger.kernel.org,
	Christophe Leroy <christophe.leroy@csgroup.eu>
Subject: Re: [PATCH v3 2/3] powerpc/powernv: wire up rng during setup_arch
Date: Sun, 19 Jun 2022 21:49:26 +1000	[thread overview]
Message-ID: <87czf4c1q1.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <20220611151015.548325-3-Jason@zx2c4.com>

"Jason A. Donenfeld" <Jason@zx2c4.com> writes:
> The platform's RNG must be available before random_init() in order to be
> useful for initial seeding, which in turn means that it needs to be
> called from setup_arch(), rather than from an init call. Fortunately,
> each platform already has a setup_arch function pointer, which means
> it's easy to wire this up. This commit also removes some noisy log
> messages that don't add much.
>
> Cc: stable@vger.kernel.org
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
> Fixes: a4da0d50b2a0 ("powerpc: Implement arch_get_random_long/int() for powernv")
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> ---
>  arch/powerpc/platforms/powernv/powernv.h |  2 ++
>  arch/powerpc/platforms/powernv/rng.c     | 18 +++++-------------
>  arch/powerpc/platforms/powernv/setup.c   |  2 ++
>  3 files changed, 9 insertions(+), 13 deletions(-)
>
...
> diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
> index 824c3ad7a0fa..a5fcb6796b22 100644
> --- a/arch/powerpc/platforms/powernv/setup.c
> +++ b/arch/powerpc/platforms/powernv/setup.c
> @@ -203,6 +203,8 @@ static void __init pnv_setup_arch(void)
>  	pnv_check_guarded_cores();
>  
>  	/* XXX PMCS */
> +
> +	powernv_rng_init();
>  }

This crashes on power8 because it's too early to call kzalloc() in
rng_create(), and it's also too early to setup the percpu variables in
there.

I'll rework it and post a v4.

cheers

WARNING: multiple messages have this Message-ID (diff)
From: Michael Ellerman <mpe@ellerman.id.au>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>, stable@vger.kernel.org
Subject: Re: [PATCH v3 2/3] powerpc/powernv: wire up rng during setup_arch
Date: Sun, 19 Jun 2022 21:49:26 +1000	[thread overview]
Message-ID: <87czf4c1q1.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <20220611151015.548325-3-Jason@zx2c4.com>

"Jason A. Donenfeld" <Jason@zx2c4.com> writes:
> The platform's RNG must be available before random_init() in order to be
> useful for initial seeding, which in turn means that it needs to be
> called from setup_arch(), rather than from an init call. Fortunately,
> each platform already has a setup_arch function pointer, which means
> it's easy to wire this up. This commit also removes some noisy log
> messages that don't add much.
>
> Cc: stable@vger.kernel.org
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
> Fixes: a4da0d50b2a0 ("powerpc: Implement arch_get_random_long/int() for powernv")
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> ---
>  arch/powerpc/platforms/powernv/powernv.h |  2 ++
>  arch/powerpc/platforms/powernv/rng.c     | 18 +++++-------------
>  arch/powerpc/platforms/powernv/setup.c   |  2 ++
>  3 files changed, 9 insertions(+), 13 deletions(-)
>
...
> diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
> index 824c3ad7a0fa..a5fcb6796b22 100644
> --- a/arch/powerpc/platforms/powernv/setup.c
> +++ b/arch/powerpc/platforms/powernv/setup.c
> @@ -203,6 +203,8 @@ static void __init pnv_setup_arch(void)
>  	pnv_check_guarded_cores();
>  
>  	/* XXX PMCS */
> +
> +	powernv_rng_init();
>  }

This crashes on power8 because it's too early to call kzalloc() in
rng_create(), and it's also too early to setup the percpu variables in
there.

I'll rework it and post a v4.

cheers

  parent reply	other threads:[~2022-06-19 11:49 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-11 15:10 [PATCH v3 0/3] powerpc: wire up rng during setup_arch Jason A. Donenfeld
2022-06-11 15:10 ` Jason A. Donenfeld
2022-06-11 15:10 ` [PATCH v3 1/3] powerpc/microwatt: " Jason A. Donenfeld
2022-06-11 15:10   ` Jason A. Donenfeld
2022-06-11 16:25   ` Christophe Leroy
2022-06-11 15:10 ` [PATCH v3 2/3] powerpc/powernv: " Jason A. Donenfeld
2022-06-11 15:10   ` Jason A. Donenfeld
2022-06-11 16:25   ` Christophe Leroy
2022-06-19 11:49   ` Michael Ellerman [this message]
2022-06-19 11:49     ` Michael Ellerman
2022-06-19 20:32     ` Jason A. Donenfeld
2022-06-19 20:32       ` Jason A. Donenfeld
2022-06-20 12:45       ` [PATCH v4] " Jason A. Donenfeld
2022-06-21 14:08         ` [PATCH v5] " Jason A. Donenfeld
2022-06-21 18:33           ` Christophe Leroy
2022-06-21 18:47             ` Jason A. Donenfeld
2022-06-21 18:47               ` Jason A. Donenfeld
2022-06-21 19:22               ` Christophe Leroy
2022-06-21 19:22                 ` Christophe Leroy
2022-06-22  2:27                 ` Michael Ellerman
2022-06-26  0:28           ` Michael Ellerman
2022-06-11 15:10 ` [PATCH v3 3/3] powerpc/pseries: " Jason A. Donenfeld
2022-06-11 15:10   ` Jason A. Donenfeld
2022-06-11 16:25   ` Christophe Leroy
2022-06-19 11:55 ` [PATCH v3 0/3] powerpc: " Michael Ellerman
2022-06-19 11:55   ` Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87czf4c1q1.fsf@mpe.ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=Jason@zx2c4.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.