public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: xinwu.liu@intel.com
Cc: arnd@arndb.de, tytso@mit.edu, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] random: fix panic caused by system_wq is not initialization
Date: Thu, 5 Jan 2017 12:47:17 +0100	[thread overview]
Message-ID: <20170105114717.GA9172@kroah.com> (raw)
In-Reply-To: <1483606190-32584-1-git-send-email-xinwu.liu@intel.com>

On Thu, Jan 05, 2017 at 04:49:50PM +0800, xinwu.liu@intel.com wrote:
> From: "Liu, Xinwu" <xinwu.liu@intel.com>
> 
> While booting kernel on simulation environment(very slow),
> kernel panicked:
> 
> [ 310.837531] BUG: unable to handle kernel NULL pointer dereference at
> 0000000000000102
> [ 310.909223] IP: [<ffffffff810acfcd>] __queue_work+0x2d/0x440
> [ 312.023898] Call Trace:
> [ 312.046346] <IRQ>
> [ 312.064346] [<ffffffff810ad418>] queue_work_on+0x38/0x80
> [ 312.115177] [<ffffffff814b364f>] credit_entropy_bits+0x1bf/0x280
> [ 312.168986] [<ffffffff814b4c62>] ?add_interrupt_randomness+0x1c2/0x200
> [ 312.228023] [<ffffffff814b4c62>] add_interrupt_randomness+0x1c2/0x200
> [ 312.285566] [<ffffffff810e4f51>] handle_irq_event_percpu+0x31/0x60
> [ 312.340869] [<ffffffff810e4fb9>] handle_irq_event+0x39/0x60
> [ 312.390955] [<ffffffff810e8480>] handle_edge_irq+0x90/0x150
> [ 312.441039] [<ffffffff8101e52d>] handle_irq+0xad/0x180
> [ 312.487388] [<ffffffff813cfb67>] ? debug_smp_processor_id+0x17/0x20
> [ 312.543433] [<ffffffff81a4ab37>] do_IRQ+0x57/0xf0
> [ 312.586064] [<ffffffff81a490c9>] common_interrupt+0x89/0x89
> [ 312.636155] [<ffffffff81a4ad9c>] ? __do_softirq+0x5c/0x337
> [ 312.685485] [<ffffffff81a4ae01>] ? __do_softirq+0xc1/0x337
> [ 312.734829] [<ffffffff8109a6d5>] irq_exit+0xa5/0xb0
> [ 312.778935] [<ffffffff81a4ab40>] do_IRQ+0x60/0xf0
> [ 312.821567] [<ffffffff81a490c9>] common_interrupt+0x89/0x89
> [ 312.871612] <EOI>
> [ 312.889628] [<ffffffff813bfda8>] ? delay_tsc+0x38/0xc0
> [ 312.938966] [<ffffffff813bfde0>] ? delay_tsc+0x70/0xc0
> [ 312.985320] [<ffffffff813bfd07>] __const_udelay+0x27/0x30
> [ 313.033907] [<ffffffff82419c35>] timer_irq_works+0x36/0x8f
> [ 313.083244] [<ffffffff8241a5ca>] setup_IO_APIC+0x30e/0x7da
> [ 313.132587] [<ffffffff81041cf9>] ? clear_IO_APIC+0x39/0x60
> [ 313.181929] [<ffffffff82419124>] apic_bsp_setup+0x86/0x94
> [ 313.230517] [<ffffffff8241714f>] native_smp_prepare_cpus+0x26f/0x2e2
> [ 313.287320] [<ffffffff82406fc2>] kernel_init_freeable+0xda/0x227
> [ 313.341127] [<ffffffff81a3f6ce>] kernel_init+0xe/0x100
> [ 313.387481] [<ffffffff81a4897f>] ret_from_fork+0x1f/0x40
> [ 313.435322] [<ffffffff81a3f6c0>] ? rest_init+0x90/0x90
> [ 313.481649] Code: 44 00 00 55 48 89 e5 41 57 41 56 41 89 fe 41 55 49
> 89 d5 41 54 49 89 f4 53 48 83 ec 08 89 7d d4 9c 58 f6 c4 02 0f 85 c4 02
> 00 00 <41> f6 84 24 02 01 00 00 01 0f 85 df 02 00 00 41 83 fe 20 0f 84
> [ 313.743052] RIP [<ffffffff810acfcd>] __queue_work+0x2d/0x440
> [ 313.795369] RSP <ffff880072803c68>
> [ 313.826768] CR2: 0000000000000102
> [ 313.856686] --[ end trace bb738d5d79381553 ]--
> [ 313.897788] Kernel panic - not syncing: Fatal exception in interrupt
> 
> 1. Now, all interrupts will contribute to entropy pool.
> 2. System_wq is initialized by early_initcall, but before that
>    clock event ready long time.
> During this period, if entropy gathering by timer interrupt
> cramming input pool, migration happends but system_wq isn't
> ready, panic hit.
> So, do basically check first to avoid this.
> 
> Signed-off-by: Liu, Xinwu <xinwu.liu@intel.com>
> ---
>  drivers/char/random.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/char/random.c b/drivers/char/random.c
> index d6876d5..621fcc9 100644
> --- a/drivers/char/random.c
> +++ b/drivers/char/random.c
> @@ -730,7 +730,8 @@ static void credit_entropy_bits(struct entropy_store *r, int nbits)
>  		    r->entropy_total >= 2*random_read_wakeup_bits) {
>  			struct entropy_store *other = &blocking_pool;
>  
> -			if (other->entropy_count <=
> +			if (likely(keventd_up()) &&
> +			    other->entropy_count <=
>  			    3 * other->poolinfo->poolfracbits / 4) {
>  				schedule_work(&other->push_work);
>  				r->entropy_total = 0;
> -- 
> 1.9.1

Hasn't this patch been rejected multiple times already?  Why send it
again?

greg k-h

      reply	other threads:[~2017-01-05 11:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-05  8:49 [PATCH 1/1] random: fix panic caused by system_wq is not initialization xinwu.liu
2017-01-05 11:47 ` Greg KH [this message]

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=20170105114717.GA9172@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=xinwu.liu@intel.com \
    /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