Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3452748imm; Tue, 29 May 2018 07:31:06 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIbYa4jz0GRlFQ/ow/3GNqIqb59cEl2592sf04bHP61+E2qy0gBc1wYTmtPDRC4XHJ757Uh X-Received: by 2002:a62:119d:: with SMTP id 29-v6mr13235527pfr.102.1527604265952; Tue, 29 May 2018 07:31:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527604265; cv=none; d=google.com; s=arc-20160816; b=bnNrH3wE0cE/AomJjrRarNhCgvuXRfICRU+Jq2txqCJGdgv0yhYLVLHD/POC3jMz/4 tb/4xyPBl7EAXi7BHwhey7XQAegIuzKrjpSiobxaQSEmsDUiS7h0sohbfCrLlGzxhJVG MbdjHtNHgHdjDOm3i8h7A9MmnWyybW9zP2FWJ+B/oJTKWzUoLrbnM9j2LrWLgkIcHovO fWkW/kSmTXXjwoQvwYG1T+bOoiRIo2gF7cKgFJr8McOTBnJU549GKoLEhPPwpjuWxfw1 M8GBRps3qZII1djbUfiVu/yeCQZkm3SG+qf8x5xFxOGHHsSTaAsCP91OX55kGhTlFJ4x L07g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=9XdN5HfjYC4bQulbh9z35vfkl2/Fr2EhraP98ul/NWU=; b=E/XA0UN/HebtslcwT+C9BwPkS4eUFifHOe/pqbA1M5MubukVAv8VrU3oPkzMFuVMiH Ak1rjuIEa6gW5Y0q/zE22v0lhb0PYg9j9xqIZvcMiHoB/c5zxjzrjiwizStWoEW9UKK1 DyxXTDYUvcp7/vdGt0dyhwFUsGg73hW9OfP/q84XTnEwDWFzhnuAo/xeNXme9Knsqp8U 5qs/pHV6qRwRaePMXO32PJuu3SckI+8RgJ7taOcMPFbFvvtpq3HTWpf1vHkIKWMNc0HY L4aDgZsQ82uujZgEr/3RhyqFjtBSjfjXAOII7bB/E5i7Xszl2BelH3fvVNNPdyvy+zzZ pAuw== 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 x10-v6si25850951pgo.679.2018.05.29.07.30.51; Tue, 29 May 2018 07:31:05 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935216AbeE2O2w (ORCPT + 99 others); Tue, 29 May 2018 10:28:52 -0400 Received: from smtp4.ccs.ornl.gov ([160.91.203.40]:38208 "EHLO smtp4.ccs.ornl.gov" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934304AbeE2OWI (ORCPT ); Tue, 29 May 2018 10:22:08 -0400 Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp4.ccs.ornl.gov (Postfix) with ESMTP id C090D1005250; Tue, 29 May 2018 10:22:06 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id BEC9D2C1; Tue, 29 May 2018 10:22:06 -0400 (EDT) From: James Simmons To: Greg Kroah-Hartman , devel@driverdev.osuosl.org, Andreas Dilger , Oleg Drokin , NeilBrown Cc: Linux Kernel Mailing List , Lustre Development List , James Simmons , James Simmons , Amir Shehata Subject: [PATCH v2 01/25] staging: lustre: libcfs: restore UMP handling Date: Tue, 29 May 2018 10:21:41 -0400 Message-Id: <1527603725-30560-2-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1527603725-30560-1-git-send-email-jsimmons@infradead.org> References: <1527603725-30560-1-git-send-email-jsimmons@infradead.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With the cleanup of the libcfs SMP handling all UMP handling was removed. In the process now various NULL pointers and empty fields are return in the UMP case which causes lustre to crash hard. Restore the proper UMP handling so Lustre can properly function. Signed-off-by: James Simmons Signed-off-by: Amir Shehata Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7734 Reviewed-on: http://review.whamcloud.com/18916 Reviewed-by: Olaf Weber Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- Changelog: v1) New patch to handle the disappearence of UMP support .../lustre/include/linux/libcfs/libcfs_cpu.h | 87 ++++++++++++++++------ drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c | 4 - drivers/staging/lustre/lnet/libcfs/module.c | 4 + 3 files changed, 69 insertions(+), 26 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h index 61641c4..2ad12a6 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h @@ -74,6 +74,7 @@ #include #include +#include #include /* any CPU partition */ @@ -89,10 +90,11 @@ struct cfs_cpu_partition { /* spread rotor for NUMA allocator */ unsigned int cpt_spread_rotor; }; - +#endif /* CONFIG_SMP */ /** descriptor for CPU partitions */ struct cfs_cpt_table { +#ifdef CONFIG_SMP /* version, reserved for hotplug */ unsigned int ctb_version; /* spread rotor for NUMA allocator */ @@ -103,14 +105,26 @@ struct cfs_cpt_table { struct cfs_cpu_partition *ctb_parts; /* shadow HW CPU to CPU partition ID */ int *ctb_cpu2cpt; - /* all cpus in this partition table */ - cpumask_var_t ctb_cpumask; /* all nodes in this partition table */ nodemask_t *ctb_nodemask; +#else + nodemask_t ctb_nodemask; +#endif /* CONFIG_SMP */ + /* all cpus in this partition table */ + cpumask_var_t ctb_cpumask; }; extern struct cfs_cpt_table *cfs_cpt_tab; +#ifdef CONFIG_SMP +/** + * destroy a CPU partition table + */ +void cfs_cpt_table_free(struct cfs_cpt_table *cptab); +/** + * create a cfs_cpt_table with \a ncpt number of partitions + */ +struct cfs_cpt_table *cfs_cpt_table_alloc(unsigned int ncpt); /** * return cpumask of CPU partition \a cpt */ @@ -208,20 +222,52 @@ void cfs_cpt_unset_nodemask(struct cfs_cpt_table *cptab, void cfs_cpu_fini(void); #else /* !CONFIG_SMP */ -struct cfs_cpt_table; -#define cfs_cpt_tab ((struct cfs_cpt_table *)NULL) -static inline cpumask_var_t * -cfs_cpt_cpumask(struct cfs_cpt_table *cptab, int cpt) +static inline void cfs_cpt_table_free(struct cfs_cpt_table *cptab) { - return NULL; + kfree(cptab); } -static inline int -cfs_cpt_table_print(struct cfs_cpt_table *cptab, char *buf, int len) +static inline struct cfs_cpt_table *cfs_cpt_table_alloc(int ncpt) { - return 0; + struct cfs_cpt_table *cptab; + + if (ncpt != 1) + return NULL; + + cptab = kzalloc(sizeof(*cptab), GFP_NOFS); + if (!cptab) + return NULL; + + if (!zalloc_cpumask_var(&cptab->ctb_cpumask, GFP_NOFS)) { + kfree(cptab); + return NULL; + } + cpumask_set_cpu(0, cptab->ctb_cpumask); + node_set(0, cptab->ctb_nodemask); + + return cptab; +} + +static inline int cfs_cpt_table_print(struct cfs_cpt_table *cptab, + char *buf, int len) +{ + int rc; + + rc = snprintf(buf, len, "0\t: 0\n"); + len -= rc; + if (len <= 0) + return -EFBIG; + + return rc; } + +static inline cpumask_var_t * +cfs_cpt_cpumask(struct cfs_cpt_table *cptab, int cpt) +{ + return &cptab->ctb_cpumask; +} + static inline int cfs_cpt_number(struct cfs_cpt_table *cptab) { @@ -243,7 +289,7 @@ void cfs_cpt_unset_nodemask(struct cfs_cpt_table *cptab, static inline nodemask_t * cfs_cpt_nodemask(struct cfs_cpt_table *cptab, int cpt) { - return NULL; + return &cptab->ctb_nodemask; } static inline int @@ -328,24 +374,21 @@ void cfs_cpt_unset_nodemask(struct cfs_cpt_table *cptab, static inline int cfs_cpu_init(void) { - return 0; + cfs_cpt_tab = cfs_cpt_table_alloc(1); + + return cfs_cpt_tab ? 0 : -1; } static inline void cfs_cpu_fini(void) { + if (cfs_cpt_tab) { + cfs_cpt_table_free(cfs_cpt_tab); + cfs_cpt_tab = NULL; + } } #endif /* CONFIG_SMP */ -/** - * destroy a CPU partition table - */ -void cfs_cpt_table_free(struct cfs_cpt_table *cptab); -/** - * create a cfs_cpt_table with \a ncpt number of partitions - */ -struct cfs_cpt_table *cfs_cpt_table_alloc(unsigned int ncpt); - /* * allocate per-cpu-partition data, returned value is an array of pointers, * variable can be indexed by CPU ID. diff --git a/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c b/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c index 3d1cf45..803fc58 100644 --- a/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c +++ b/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c @@ -41,10 +41,6 @@ #include #include -/** Global CPU partition table */ -struct cfs_cpt_table *cfs_cpt_tab __read_mostly; -EXPORT_SYMBOL(cfs_cpt_tab); - /** * modparam for setting number of partitions * diff --git a/drivers/staging/lustre/lnet/libcfs/module.c b/drivers/staging/lustre/lnet/libcfs/module.c index 5dc7de9..b438d456 100644 --- a/drivers/staging/lustre/lnet/libcfs/module.c +++ b/drivers/staging/lustre/lnet/libcfs/module.c @@ -66,6 +66,10 @@ struct lnet_debugfs_symlink_def { static struct dentry *lnet_debugfs_root; +/** Global CPU partition table */ +struct cfs_cpt_table *cfs_cpt_tab __read_mostly; +EXPORT_SYMBOL(cfs_cpt_tab); + BLOCKING_NOTIFIER_HEAD(libcfs_ioctl_list); EXPORT_SYMBOL(libcfs_ioctl_list); -- 1.8.3.1