Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2594378yba; Sun, 7 Apr 2019 23:56:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqy+QcLQ074f3jWEY9l0g1r4IMcDgivUapqsbRlCmZ2SArYUaUMSQyFaxa5NGzZ/FpMjSXy2 X-Received: by 2002:a17:902:7785:: with SMTP id o5mr28686198pll.33.1554706597520; Sun, 07 Apr 2019 23:56:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554706597; cv=none; d=google.com; s=arc-20160816; b=aj0S1YXv2v2LikUlakoQdTS49yM1NIArHIIWwd4KC9SS+kcOUeTJoeSW+XeWS/Qsm9 58grv+4f9KF2q64UHq2U+YpkShxa+0aa5B7H2UV+HMvlAHQTuviLgEs85MyYCT8Wq+IO eC2vvCxmfWJf/xuB+yl6Xg9Sr4mZAd8r9gpDeSeWeSBzc5l960u7boQeHJlioJ5IKRB9 AC//qfpi9o1udeLqtcFSxXeqY7IKiWbea1MuUCbS9koJgBhbkUITXpO1FEaHypEEIGwP m42dL6YahnFnfKZ1sX+d8LnrG8GMadGd7uRjVnjC1Kvu4uN3SzpyptpwL701OVY743hK K5hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject; bh=SZSIx34uh7WCy4BaB51PSNT3MCMKBXt//LTMG4xBpKk=; b=es/FxcwiVA4VQIRDmF5w2dNqkjim5B+WwsGxYGztNX5P3f81+UuU8ldOeuMzScRMqi qxNEIg4VPmcxk1hFsM4EMSQqk6aPjhZ6Sh+E3hwbmoVdk6iFr5JRBO/NG58lEBw0i96A uAgSPOpsTjTAiUkXT1JMdWFrH8YulwSJzeIZfOXlULdlY5u/iLmf89i8ERIVCVDl2mIQ RvCsT42UMMBzTzIVnubQKwopyq/9YavcwuKP2jZGaesUku3Bu78kulbm1vUIUieiuzjj KRBBo4NOJ96ai1srfZ5bdBDaoH8Gpjhm/3VOpNyI5Ast9O/u6bcBcmlwTVsfVt+QWJ6o hpXw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y29si26218935pgk.120.2019.04.07.23.56.20; Sun, 07 Apr 2019 23:56:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726068AbfDHGzm (ORCPT + 99 others); Mon, 8 Apr 2019 02:55:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42438 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725871AbfDHGzl (ORCPT ); Mon, 8 Apr 2019 02:55:41 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 106BA307EAA7; Mon, 8 Apr 2019 06:55:41 +0000 (UTC) Received: from [10.40.204.71] (ovpn-204-71.brq.redhat.com [10.40.204.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id 209B8D1C6; Mon, 8 Apr 2019 06:55:36 +0000 (UTC) Subject: Re: [PATCH] hwrng: core - don't block in add_early_randomness() To: Herbert Xu Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, Matt Mackall References: <20190329163011.7370-1-lvivier@redhat.com> <20190408063154.7bnt6puawoqtwlgo@gondor.apana.org.au> From: Laurent Vivier Openpgp: preference=signencrypt Autocrypt: addr=lvivier@redhat.com; prefer-encrypt=mutual; keydata= xsFNBFYFJhkBEAC2me7w2+RizYOKZM+vZCx69GTewOwqzHrrHSG07MUAxJ6AY29/+HYf6EY2 WoeuLWDmXE7A3oJoIsRecD6BXHTb0OYS20lS608anr3B0xn5g0BX7es9Mw+hV/pL+63EOCVm SUVTEQwbGQN62guOKnJJJfphbbv82glIC/Ei4Ky8BwZkUuXd7d5NFJKC9/GDrbWdj75cDNQx UZ9XXbXEKY9MHX83Uy7JFoiFDMOVHn55HnncflUncO0zDzY7CxFeQFwYRbsCXOUL9yBtqLer Ky8/yjBskIlNrp0uQSt9LMoMsdSjYLYhvk1StsNPg74+s4u0Q6z45+l8RAsgLw5OLtTa+ePM JyS7OIGNYxAX6eZk1+91a6tnqfyPcMbduxyBaYXn94HUG162BeuyBkbNoIDkB7pCByed1A7q q9/FbuTDwgVGVLYthYSfTtN0Y60OgNkWCMtFwKxRaXt1WFA5ceqinN/XkgA+vf2Ch72zBkJL RBIhfOPFv5f2Hkkj0MvsUXpOWaOjatiu0fpPo6Hw14UEpywke1zN4NKubApQOlNKZZC4hu6/ 8pv2t4HRi7s0K88jQYBRPObjrN5+owtI51xMaYzvPitHQ2053LmgsOdN9EKOqZeHAYG2SmRW LOxYWKX14YkZI5j/TXfKlTpwSMvXho+efN4kgFvFmP6WT+tPnwARAQABzSNMYXVyZW50IFZp dmllciA8bHZpdmllckByZWRoYXQuY29tPsLBeAQTAQIAIgUCVgVQgAIbAwYLCQgHAwIGFQgC CQoLBBYCAwECHgECF4AACgkQ8ww4vT8vvjwpgg//fSGy0Rs/t8cPFuzoY1cex4limJQfReLr SJXCANg9NOWy/bFK5wunj+h/RCFxIFhZcyXveurkBw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-Version: 1.0 In-Reply-To: <20190408063154.7bnt6puawoqtwlgo@gondor.apana.org.au> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 08 Apr 2019 06:55:41 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/04/2019 08:31, Herbert Xu wrote: > On Fri, Mar 29, 2019 at 05:30:11PM +0100, Laurent Vivier wrote: >> If the device is not ready to provide data the kernel will >> be stuck indefinitely in the init function. >> >> This is not a problem if the device is driven using a module, >> but if the driver is linked directly into the kernel then the >> kernel boot sequence hangs. >> >> This can happen with virtio-rng device with rng-egd backend >> with no data provider, for instance with QEMU command line parameters: >> >> ... >> -chardev socket,id=charrng0,host=localhost,port=2345,server,nowait \ >> -object rng-egd,id=objrng0,chardev=charrng0 \ >> -device virtio-rng-pci,rng=objrng0,id=rng0 >> >> To avoid that, we can call rng_get_data() in non blocking mode because >> the function already manages the case where byte_read is >> 0 (if the device is not already initialized). >> >> See also commit d3cc7996473a >> ("hwrng: fetch randomness only after device init") >> >> Signed-off-by: Laurent Vivier > > I think this is either not a bug (make sure that the user supplies > a RNG source) or it should be addressed in virtio-rng. Yes, I did more investigation and I agree. Thanks, Laurent