From: NeilBrown <neilb@suse.com> To: Oleg Drokin <oleg.drokin@intel.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, James Simmons <jsimmons@infradead.org>, Andreas Dilger <andreas.dilger@intel.com> Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, Lustre Development List <lustre-devel@lists.lustre.org> Subject: [PATCH 06/17] staging: lustre: get entropy from nid when nid set. Date: Fri, 02 Mar 2018 10:31:25 +1100 [thread overview] Message-ID: <151994708524.7628.17942703834112140684.stgit@noble> (raw) In-Reply-To: <151994679573.7628.1024109499321778846.stgit@noble> 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 <neilb@suse.com> --- 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;
WARNING: multiple messages have this Message-ID (diff)
From: NeilBrown <neilb@suse.com> To: Oleg Drokin <oleg.drokin@intel.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, James Simmons <jsimmons@infradead.org>, Andreas Dilger <andreas.dilger@intel.com> Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, Lustre Development List <lustre-devel@lists.lustre.org> Subject: [lustre-devel] [PATCH 06/17] staging: lustre: get entropy from nid when nid set. Date: Fri, 02 Mar 2018 10:31:25 +1100 [thread overview] Message-ID: <151994708524.7628.17942703834112140684.stgit@noble> (raw) In-Reply-To: <151994679573.7628.1024109499321778846.stgit@noble> 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 <neilb@suse.com> --- 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;
next prev parent reply other threads:[~2018-03-01 23:31 UTC|newest] Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-03-01 23:31 [PATCH 00/17] staging: remove requirement that lustre be built as module NeilBrown 2018-03-01 23:31 ` [lustre-devel] " NeilBrown 2018-03-01 23:31 ` NeilBrown [this message] 2018-03-01 23:31 ` [lustre-devel] [PATCH 06/17] staging: lustre: get entropy from nid when nid set NeilBrown 2018-03-08 0:19 ` Dilger, Andreas 2018-03-08 0:19 ` [lustre-devel] " Dilger, Andreas 2018-03-01 23:31 ` [PATCH 02/17] staging: lustre: fix bug in osc_enter_cache_try NeilBrown 2018-03-01 23:31 ` [lustre-devel] " NeilBrown 2018-03-07 20:51 ` Dilger, Andreas 2018-03-07 20:51 ` [lustre-devel] " Dilger, Andreas 2018-03-01 23:31 ` [PATCH 03/17] staging: lustre: statahead: remove incorrect test on agl_list_empty() NeilBrown 2018-03-01 23:31 ` [lustre-devel] " NeilBrown 2018-03-07 21:08 ` Dilger, Andreas 2018-03-07 21:08 ` [lustre-devel] " Dilger, Andreas 2018-03-01 23:31 ` [PATCH 07/17] staging: lustre: ptlrpc: change GFP_NOFS to GFP_KERNEL NeilBrown 2018-03-01 23:31 ` [lustre-devel] " NeilBrown 2018-03-08 0:20 ` Dilger, Andreas 2018-03-08 0:20 ` [lustre-devel] " Dilger, Andreas 2018-03-01 23:31 ` [PATCH 17/17] Revert "staging: Disable lustre file system for MIPS, SH, and XTENSA" NeilBrown 2018-03-01 23:31 ` [lustre-devel] " NeilBrown 2018-03-09 0:37 ` Dilger, Andreas 2018-03-09 0:37 ` [lustre-devel] " Dilger, Andreas 2018-03-01 23:31 ` [PATCH 13/17] staging: lustre: remove 'ptlrpc_thread usage' for sai_agl_thread NeilBrown 2018-03-01 23:31 ` [lustre-devel] " NeilBrown 2018-03-09 0:12 ` Dilger, Andreas 2018-03-09 0:12 ` [lustre-devel] " Dilger, Andreas 2018-03-01 23:31 ` [PATCH 14/17] staging: lustre: change sai_thread to sai_task NeilBrown 2018-03-01 23:31 ` [lustre-devel] " NeilBrown 2018-03-09 0:20 ` Dilger, Andreas 2018-03-09 0:20 ` [lustre-devel] " Dilger, Andreas 2018-03-01 23:31 ` [PATCH 05/17] staging: lustre: lnet: keep ln_nportals consistent NeilBrown 2018-03-01 23:31 ` [lustre-devel] " NeilBrown 2018-03-07 21:24 ` Dilger, Andreas 2018-03-07 21:24 ` [lustre-devel] " Dilger, Andreas 2018-03-01 23:31 ` [PATCH 08/17] staging: lustre: obdclass: use workqueue for zombie management NeilBrown 2018-03-01 23:31 ` [lustre-devel] " NeilBrown 2018-03-08 0:27 ` Dilger, Andreas 2018-03-08 0:27 ` [lustre-devel] " Dilger, Andreas 2018-03-01 23:31 ` [PATCH 12/17] staging: lustre: remove unused flag from ptlrpc_thread NeilBrown 2018-03-01 23:31 ` [lustre-devel] " NeilBrown 2018-03-08 23:54 ` Dilger, Andreas 2018-03-08 23:54 ` [lustre-devel] " Dilger, Andreas 2018-03-01 23:31 ` [PATCH 01/17] staging: lustre: obd_mount: use correct niduuid suffix NeilBrown 2018-03-01 23:31 ` [lustre-devel] " NeilBrown 2018-03-07 20:49 ` Dilger, Andreas 2018-03-07 20:49 ` [lustre-devel] " Dilger, Andreas 2018-03-01 23:31 ` [PATCH 16/17] staging: lustre: allow monolithic builds NeilBrown 2018-03-01 23:31 ` [lustre-devel] " NeilBrown 2018-03-09 0:32 ` Dilger, Andreas 2018-03-09 0:32 ` [lustre-devel] " Dilger, Andreas 2018-03-01 23:31 ` [PATCH 09/17] staging: lustre: ldlm: use delayed_work for pools_recalc NeilBrown 2018-03-01 23:31 ` [lustre-devel] " NeilBrown 2018-03-08 19:22 ` Dilger, Andreas 2018-03-08 19:22 ` [lustre-devel] " Dilger, Andreas 2018-03-01 23:31 ` [PATCH 04/17] staging: lustre: obdclass: don't require lct_owner to be non-NULL NeilBrown 2018-03-01 23:31 ` [lustre-devel] " NeilBrown 2018-03-07 21:10 ` Dilger, Andreas 2018-03-07 21:10 ` [lustre-devel] " Dilger, Andreas 2018-03-01 23:31 ` [PATCH 11/17] staging: lustre: ptlrpc: use workqueue for pinger NeilBrown 2018-03-01 23:31 ` [lustre-devel] " NeilBrown 2018-03-08 23:53 ` Dilger, Andreas 2018-03-08 23:53 ` [lustre-devel] " Dilger, Andreas 2018-03-11 21:37 ` NeilBrown 2018-03-11 21:37 ` [lustre-devel] " NeilBrown 2018-03-01 23:31 ` [PATCH 15/17] staging: lustre: ptlrpc: move thread creation out of module initialization NeilBrown 2018-03-01 23:31 ` [lustre-devel] " NeilBrown 2018-03-09 0:31 ` Dilger, Andreas 2018-03-09 0:31 ` [lustre-devel] " Dilger, Andreas 2018-03-01 23:31 ` [PATCH 10/17] staging: lustre: ptlrpc: use delayed_work in sec_gc NeilBrown 2018-03-01 23:31 ` [lustre-devel] " NeilBrown 2018-03-08 19:23 ` Dilger, Andreas 2018-03-08 19:23 ` [lustre-devel] " Dilger, Andreas
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=151994708524.7628.17942703834112140684.stgit@noble \ --to=neilb@suse.com \ --cc=andreas.dilger@intel.com \ --cc=gregkh@linuxfoundation.org \ --cc=jsimmons@infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=lustre-devel@lists.lustre.org \ --cc=oleg.drokin@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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.