From: NeilBrown <neilb@suse.com>
To: James Simmons <jsimmons@infradead.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
devel@driverdev.osuosl.org,
Andreas Dilger <andreas.dilger@intel.com>,
Oleg Drokin <oleg.drokin@intel.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Lustre Development List <lustre-devel@lists.lustre.org>,
James Simmons <jsimmons@infradead.org>,
James Simmons <uja.ornl@yahoo.com>,
Amir Shehata <amir.shehata@intel.com>
Subject: Re: [PATCH v2 01/25] staging: lustre: libcfs: restore UMP handling
Date: Wed, 30 May 2018 09:45:08 +1000 [thread overview]
Message-ID: <87muwiuiuz.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <1527603725-30560-2-git-send-email-jsimmons@infradead.org>
[-- Attachment #1: Type: text/plain, Size: 6973 bytes --]
On Tue, May 29 2018, James Simmons wrote:
> 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.
Can't we just get lustre to handle the NULL pointer?
Is most cases, the pointer is accessed through an accessor function, and
on !CONFIG_SMP, that can be a static inline that doesn't even look at
the pointer.
I really think this is a step backwards. If you can identify specific
problems caused by the current code, I'm sure we can fix them.
>
> Signed-off-by: James Simmons <uja.ornl@yahoo.com>
> Signed-off-by: Amir Shehata <amir.shehata@intel.com>
> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7734
This bug doesn't seem to mention this patch at all
> Reviewed-on: http://review.whamcloud.com/18916
Nor does this review.
Thanks,
NeilBrown
> Reviewed-by: Olaf Weber <olaf@sgi.com>
> Reviewed-by: Doug Oucharek <dougso@me.com>
> Signed-off-by: James Simmons <jsimmons@infradead.org>
> ---
> 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 <linux/cpu.h>
> #include <linux/cpuset.h>
> +#include <linux/slab.h>
> #include <linux/topology.h>
>
> /* 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 <linux/libcfs/libcfs_string.h>
> #include <linux/libcfs/libcfs.h>
>
> -/** 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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2018-05-29 23:45 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-29 14:21 [PATCH v2 00/25] staging: lustre: libcfs: SMP rework James Simmons
2018-05-29 14:21 ` [PATCH v2 01/25] staging: lustre: libcfs: restore UMP handling James Simmons
2018-05-29 23:45 ` NeilBrown [this message]
2018-06-13 22:02 ` James Simmons
2018-06-13 22:18 ` [lustre-devel] " Doug Oucharek
2018-06-13 22:29 ` NeilBrown
2018-05-30 10:05 ` Dan Carpenter
2018-05-29 14:21 ` [PATCH v2 02/25] staging: lustre: libcfs: remove useless CPU partition code James Simmons
2018-05-29 14:21 ` [PATCH v2 03/25] staging: lustre: libcfs: rename variable i to cpu James Simmons
2018-05-29 14:21 ` [PATCH v2 04/25] staging: lustre: libcfs: properly handle failure cases in SMP code James Simmons
2018-05-29 14:21 ` [PATCH v2 05/25] staging: lustre: libcfs: replace MAX_NUMNODES with nr_node_ids James Simmons
2018-05-29 14:21 ` [PATCH v2 06/25] staging: lustre: libcfs: remove excess space James Simmons
2018-05-29 14:21 ` [PATCH v2 v2 07/25] staging: lustre: libcfs: replace num_possible_cpus() with nr_cpu_ids James Simmons
2018-06-01 8:29 ` Greg Kroah-Hartman
2018-06-01 8:31 ` Greg Kroah-Hartman
2018-05-29 14:21 ` [PATCH v2 08/25] staging: lustre: libcfs: NUMA support James Simmons
2018-06-01 8:37 ` Greg Kroah-Hartman
2018-05-29 14:21 ` [PATCH v2 09/25] staging: lustre: libcfs: add cpu distance handling James Simmons
2018-05-29 14:21 ` [PATCH v2 10/25] staging: lustre: libcfs: use distance in cpu and node handling James Simmons
2018-05-29 14:21 ` [PATCH v2 11/25] staging: lustre: libcfs: provide debugfs files for distance handling James Simmons
2018-06-01 8:41 ` Greg Kroah-Hartman
2018-05-29 14:21 ` [PATCH v2 12/25] staging: lustre: libcfs: invert error handling for cfs_cpt_table_print James Simmons
2018-05-29 14:21 ` [PATCH v2 13/25] staging: lustre: libcfs: fix libcfs_cpu coding style James Simmons
2018-06-01 8:39 ` Greg Kroah-Hartman
2018-05-29 14:21 ` [PATCH v2 14/25] staging: lustre: libcfs: use int type for CPT identification James Simmons
2018-05-29 14:21 ` [PATCH v2 15/25] staging: lustre: libcfs: rename i to node for cfs_cpt_set_nodemask James Simmons
2018-05-29 14:21 ` [PATCH v2 16/25] staging: lustre: libcfs: rename i to cpu for cfs_cpt_bind James Simmons
2018-05-29 14:21 ` [PATCH v2 17/25] staging: lustre: libcfs: rename cpumask_var_t variables to *_mask James Simmons
2018-05-29 14:21 ` [PATCH v2 18/25] staging: lustre: libcfs: rename goto label in cfs_cpt_table_print James Simmons
2018-06-01 8:33 ` Greg Kroah-Hartman
2018-05-29 14:21 ` [PATCH v2 19/25] staging: lustre: libcfs: update debug messages James Simmons
2018-05-29 14:22 ` [PATCH v2 20/25] staging: lustre: libcfs: make tolerant to offline CPUs and empty NUMA nodes James Simmons
2018-05-29 14:22 ` [PATCH v2 21/25] staging: lustre: libcfs: report NUMA node instead of just node James Simmons
2018-05-29 14:22 ` [PATCH v2 22/25] staging: lustre: libcfs: update debug messages in CPT code James Simmons
2018-05-29 14:22 ` [PATCH v2 23/25] staging: lustre: libcfs: rework CPU pattern parsing code James Simmons
2018-06-01 8:43 ` Greg Kroah-Hartman
2018-05-29 14:22 ` [PATCH v2 24/25] staging: lustre: libcfs: change CPT estimate algorithm James Simmons
2018-05-29 14:22 ` [PATCH v2 25/25] staging: lustre: ptlrpc: use current CPU instead of hardcoded 0 James Simmons
2018-06-01 8:28 ` [PATCH v2 00/25] staging: lustre: libcfs: SMP rework Greg Kroah-Hartman
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=87muwiuiuz.fsf@notabene.neil.brown.name \
--to=neilb@suse.com \
--cc=amir.shehata@intel.com \
--cc=andreas.dilger@intel.com \
--cc=devel@driverdev.osuosl.org \
--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 \
--cc=uja.ornl@yahoo.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