Received: by 10.223.185.116 with SMTP id b49csp8019870wrg; Thu, 1 Mar 2018 15:35:28 -0800 (PST) X-Google-Smtp-Source: AG47ELtOBY7sP3Drx1f+6sBWTmUGyKspefCyZAvx5Cxmz2WrHjwj2EORHRnWgW4uS7sQZb3JYASd X-Received: by 2002:a17:902:461:: with SMTP id 88-v6mr3426802ple.88.1519947328249; Thu, 01 Mar 2018 15:35:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519947328; cv=none; d=google.com; s=arc-20160816; b=BXHn9ecg9VtZcnnUUOPIlH5/Vgxfj3tQqk7zax3NdM+PwArEpia+1Hv3ha5RTfYp6k JJojCAvQoWidjbxWvELUj7MkIjQq1QbM64HtLV5zSHU06NTbmjgctofKkaF358tJ9ko+ edCUXAsw67fOkqDhqcjdIj5iUt69c8clrI91LSgYcb0WBHv6tORxWvnNHD1aGOBCwwP6 /Qx+O/JqxKPospDO3+2V+AccuDslCXyac1OKwqZXrmMfpoU+zqqhIUW2h4XgpntRbzo8 SMpwsuE/rC+hljjjuZS6K6G8Cj+DqTHQicII2t1Q8+9Jlt/9pX3fLkQoyV6Av55ScjDl ka4Q== 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:mime-version :user-agent:references:in-reply-to:message-id:cc:subject:date:to :from:arc-authentication-results; bh=mxLM93VhIfqoY2QEm1ryNNMOcZtDnfofk3CVcudLKeo=; b=RbwDPaZycvE12+WfUbMehRgPq91X58GyjLP4J1vXgGINJbwaB7/sjI/bVN03x9dYbl JF9utjfP9SI9qJKU/b/jvqOcYcVtemqkDMoKO5C79rTryCXddxIYbN5d88M7Gaf2WEky P4oD3TgeEWVQ1IZhXFHLs+OMUVQU0861p4Bjl1LO1T31hPdMNzjDlDNSUYnmq43u02wP G7tT4eKWIN5qCTNwbTXkBgXvnjWvp6VIWETDZSW4OqPL/kSG1WAWXhVNIZfFqYX2YlNW hkag2O+Qid2Yqs2FM3TDtei5PxYqvtbqeCGNnPfinMn8sLMzXi7g87z/pMTaOJVO11KF K6qg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y72si3725602pfd.88.2018.03.01.15.35.13; Thu, 01 Mar 2018 15:35:28 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1163309AbeCAXc6 (ORCPT + 99 others); Thu, 1 Mar 2018 18:32:58 -0500 Received: from mx2.suse.de ([195.135.220.15]:54175 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163293AbeCAXc5 (ORCPT ); Thu, 1 Mar 2018 18:32:57 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B44C0B46C; Thu, 1 Mar 2018 23:32:55 +0000 (UTC) From: NeilBrown To: Oleg Drokin , Greg Kroah-Hartman , James Simmons , Andreas Dilger Date: Fri, 02 Mar 2018 10:31:25 +1100 Subject: [PATCH 06/17] staging: lustre: get entropy from nid when nid set. Cc: Linux Kernel Mailing List , Lustre Development List Message-ID: <151994708524.7628.17942703834112140684.stgit@noble> In-Reply-To: <151994679573.7628.1024109499321778846.stgit@noble> References: <151994679573.7628.1024109499321778846.stgit@noble> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When the 'lustre' module is loaded, it gets a list of net devices and uses the node ids to add entropy to the prng. This means that the network interfaces need to be configured before the module is loaded, which prevents the module from being compiled into a monolithic kernel. So move this entropy addition to the moment when the interface is imported to LNet and the node id is first known. Signed-off-by: NeilBrown --- drivers/staging/lustre/lnet/lnet/api-ni.c | 7 +++++++ drivers/staging/lustre/lustre/llite/super25.c | 17 +---------------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index 48d25ccadbb3..90266be0132d 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -1214,6 +1214,7 @@ lnet_startup_lndni(struct lnet_ni *ni, struct lnet_ioctl_config_data *conf) struct lnet_lnd *lnd; struct lnet_tx_queue *tq; int i; + u32 seed; lnd_type = LNET_NETTYP(LNET_NIDNET(ni->ni_nid)); @@ -1352,6 +1353,12 @@ lnet_startup_lndni(struct lnet_ni *ni, struct lnet_ioctl_config_data *conf) tq->tq_credits = lnet_ni_tq_credits(ni); } + /* Nodes with small feet have little entropy. The NID for this + * node gives the most entropy in the low bits. + */ + seed = LNET_NIDADDR(ni->ni_nid); + add_device_randomness(&seed, sizeof(seed)); + CDEBUG(D_LNI, "Added LNI %s [%d/%d/%d/%d]\n", libcfs_nid2str(ni->ni_nid), ni->ni_peertxcredits, lnet_ni_tq_credits(ni) * LNET_CPT_NUMBER, diff --git a/drivers/staging/lustre/lustre/llite/super25.c b/drivers/staging/lustre/lustre/llite/super25.c index 9b0bb3541a84..861e7a60f408 100644 --- a/drivers/staging/lustre/lustre/llite/super25.c +++ b/drivers/staging/lustre/lustre/llite/super25.c @@ -85,8 +85,7 @@ MODULE_ALIAS_FS("lustre"); static int __init lustre_init(void) { - struct lnet_process_id lnet_id; - int i, rc; + int rc; BUILD_BUG_ON(sizeof(LUSTRE_VOLATILE_HDR) != LUSTRE_VOLATILE_HDR_LEN + 1); @@ -125,20 +124,6 @@ static int __init lustre_init(void) goto out_debugfs; } - /* Nodes with small feet have little entropy. The NID for this - * node gives the most entropy in the low bits - */ - for (i = 0;; i++) { - u32 seed; - - if (LNetGetId(i, &lnet_id) == -ENOENT) - break; - if (LNET_NETTYP(LNET_NIDNET(lnet_id.nid)) != LOLND) { - seed = LNET_NIDADDR(lnet_id.nid); - add_device_randomness(&seed, sizeof(seed)); - } - } - rc = vvp_global_init(); if (rc != 0) goto out_sysfs;