public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Theodore Y. Ts'o" <tytso@mit.edu>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] random: fix possible sleeping allocation from irq context
Date: Wed, 25 Apr 2018 02:00:17 -0400	[thread overview]
Message-ID: <20180425060017.GB3412@thunk.org> (raw)
In-Reply-To: <201804250046.w3P0kgkd045841@www262.sakura.ne.jp>

On Wed, Apr 25, 2018 at 09:46:42AM +0900, Tetsuo Handa wrote:
> Theodore Ts\'o wrote:
> > We can do a sleeping allocation from an irq context when CONFIG_NUMA
> > is enabled.  Fix this by initializing the NUMA crng instances in a
> > workqueue.
> 
> Offloading to workqueue context itself would be OK,
> but this patch makes linux.git unbootable because
> 
> 	if (crng == &primary_crng && crng_init < 2) {
> 		invalidate_batched_entropy();
> 		numa_crng_init(); // <= Deferred to workqueue context.
> 		crng_init = 2; // <= Not waiting for workqueue context, and oops before console becomes ready. ;-)
> 		process_random_ready_list();
> 		wake_up_interruptible(&crng_init_wait);
> 		pr_notice(\"random: crng init done\\n\");
> 	}
> 
> Please don\'t pretend rng_ready() before workqueue context is processed.

Where's the oops?  It's not oopsing for me, and if the NUMA crng is
not initailized, the code in extract_entropy returns falls back to
using the primary_crng:

static void extract_crng(__u32 out[CHACHA20_BLOCK_WORDS])
{
	struct crng_state *crng = NULL;

#ifdef CONFIG_NUMA
	if (crng_node_pool)
		crng = crng_node_pool[numa_node_id()];
	if (crng == NULL)
#endif
		crng = &primary_crng;
	_extract_crng(crng, out);
}

						- Ted
						

  reply	other threads:[~2018-04-25  6:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-24  3:41 [PATCH] random: fix possible sleeping allocation from irq context Theodore Ts'o
2018-04-25  0:46 ` Tetsuo Handa
2018-04-25  6:00   ` Theodore Y. Ts'o [this message]
2018-04-25 10:47     ` Tetsuo Handa

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=20180425060017.GB3412@thunk.org \
    --to=tytso@mit.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox