lkml.org 
[lkml]   [2018]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] random: fix possible sleeping allocation from irq context
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


\
 
 \ /
  Last update: 2018-04-25 08:00    [W:0.060 / U:9.408 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site