Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3910062imm; Tue, 29 May 2018 16:46:19 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL+IfXEA9VElgBxhQTtqFhj0C1gMV/iBdC/8+Uowwmvww8gRYoYMjuLqLbOZRXos6JXVjCP X-Received: by 2002:a62:8b9b:: with SMTP id e27-v6mr464616pfl.82.1527637579212; Tue, 29 May 2018 16:46:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527637579; cv=none; d=google.com; s=arc-20160816; b=ORswEEltvm5Pmb8kF07ObIl+gjPPusHwL5FENNTHDt3olU5m13CyKmIHvy1Q2/pbie 6QPVhaodlccaeHIlP/5AoV6hrK028Vbt55+vWxifvuz7eAnYMpHnVsVslAnf1iPn/Zez wEAYIxhIyTwkNc9hKDThv5eCF+ITPwSn586884jJj87WKp9nejRFHOW8IeYqZGybJ/Bm qHi9t8q/1QbfDgxQo2gGm5uWzFtHGjuEJmeII53XEjhQ4/dT0DSmxBbt8Nu5RJlciOFF Gx9zoTFFbFR71utf/IfVz/cexqy9RsIQvsGB3kQnwEYcXws0/xQCNrd5zKC1WX4r6fTR jCdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:references :in-reply-to:subject:cc:date:to:from:arc-authentication-results; bh=Cle663w2BrhLzxsaD+gjMuwgVByTwhKrXoS5rcHGxI8=; b=eDNY54L1fe1vmQnrnV1CJmi0j/gYq6vzrY+CSL4m+bJSuYntfe1cL2n/oxHGdHJ2CS GEq/ClQcqfG8TzaOu9byHNZgZN/Qs0gvFfy7gnvNwUfjspBFRk9lcKHx/dhvmNTrka0l XIZWDEM/eGwnbAWtgLdX3ILnRnzuZlJXOFldVcpyv3RhzpGq3jj621Roy35fE6M+yAjI YtDZJczHx3Atv7DYOK0JHS1uYDpvyEkJ7HO9HmVxhVkhpetKAVZnah3bnBUxxi25R2P0 PVJ1BU1Y9E7tOCLExqcBEzvlFwqGzG0Ral89xQxEJ4K2XKjB8IlA6scpEs57wTj2ETCJ Cb8Q== 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 s3-v6si32060459plp.241.2018.05.29.16.46.05; Tue, 29 May 2018 16:46:19 -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 S1755378AbeE2XpU (ORCPT + 99 others); Tue, 29 May 2018 19:45:20 -0400 Received: from mx2.suse.de ([195.135.220.15]:50851 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755284AbeE2XpT (ORCPT ); Tue, 29 May 2018 19:45:19 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id BA36CABF4; Tue, 29 May 2018 23:45:17 +0000 (UTC) From: NeilBrown To: James Simmons , Greg Kroah-Hartman , devel@driverdev.osuosl.org, Andreas Dilger , Oleg Drokin Date: Wed, 30 May 2018 09:45:08 +1000 Cc: Linux Kernel Mailing List , Lustre Development List , James Simmons , James Simmons , Amir Shehata Subject: Re: [PATCH v2 01/25] staging: lustre: libcfs: restore UMP handling In-Reply-To: <1527603725-30560-2-git-send-email-jsimmons@infradead.org> References: <1527603725-30560-1-git-send-email-jsimmons@infradead.org> <1527603725-30560-2-git-send-email-jsimmons@infradead.org> Message-ID: <87muwiuiuz.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable 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 > Signed-off-by: Amir Shehata > 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 > 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/d= rivers/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 @@ >=20=20 > #include > #include > +#include > #include >=20=20 > /* any CPU partition */ > @@ -89,10 +90,11 @@ struct cfs_cpu_partition { > /* spread rotor for NUMA allocator */ > unsigned int cpt_spread_rotor; > }; > - > +#endif /* CONFIG_SMP */ >=20=20 > /** 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; > }; >=20=20 > extern struct cfs_cpt_table *cfs_cpt_tab; >=20=20 > +#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 *c= ptab, > void cfs_cpu_fini(void); >=20=20 > #else /* !CONFIG_SMP */ > -struct cfs_cpt_table; > -#define cfs_cpt_tab ((struct cfs_cpt_table *)NULL) >=20=20 > -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); > } >=20=20 > -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 !=3D 1) > + return NULL; > + > + cptab =3D 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 =3D snprintf(buf, len, "0\t: 0\n"); > + len -=3D rc; > + if (len <=3D 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 *cpt= ab, > static inline nodemask_t * > cfs_cpt_nodemask(struct cfs_cpt_table *cptab, int cpt) > { > - return NULL; > + return &cptab->ctb_nodemask; > } >=20=20 > static inline int > @@ -328,24 +374,21 @@ void cfs_cpt_unset_nodemask(struct cfs_cpt_table *c= ptab, > static inline int > cfs_cpu_init(void) > { > - return 0; > + cfs_cpt_tab =3D cfs_cpt_table_alloc(1); > + > + return cfs_cpt_tab ? 0 : -1; > } >=20=20 > static inline void cfs_cpu_fini(void) > { > + if (cfs_cpt_tab) { > + cfs_cpt_table_free(cfs_cpt_tab); > + cfs_cpt_tab =3D NULL; > + } > } >=20=20 > #endif /* CONFIG_SMP */ >=20=20 > -/** > - * 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 pointe= rs, > * variable can be indexed by CPU ID. > diff --git a/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c b/drivers/st= aging/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 >=20=20 > -/** 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/stagin= g/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 { >=20=20 > static struct dentry *lnet_debugfs_root; >=20=20 > +/** 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); >=20=20 > --=20 > 1.8.3.1 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEG8Yp69OQ2HB7X0l6Oeye3VZigbkFAlsN5gQACgkQOeye3VZi gbmP7xAAnceAd+IR4qhrmMl0I7tKBVPOUjiSU6hqr8kUbTljqQosTYZAxlU63eBH wO2nrqM4vFbjZ6l5rq8Hvbb2y0xD78xmsqbP5zOwK9UrvPsERoTsBZWDZulTCI1q anODSpshQrMDvzpnxD+unTubXcuDmpJwRh/H4L0Sb91HQjlql0d8O2pk/ohH8Dqx KPVeamB6CaYbJo7h9Y2nDZ1Km5mpWZgeiTG9ttHqQjHEDl65V5U+LEGovgy8nNQu 1mu1x1wlqBnRkSb1Q6UlWFoFBG1dG8Hh1Lf7Py3fEkwRmgahOMw1XCaRHDx/JCi0 Y9/0fMRPYAxhS/IIgeIckgcjGGxDi9qhUcAMC2qZWEzAq/qoT38h30dTFJqJ+6VM PavfWybn/mna9KB0Ixal2YYB0ghYh0JhQJ1555sc/mNIkxh5VBNfNcxYdVt7f2cg 6ZACnCXKH7x1+ooofEtfz1Uz0+yXq7J0puvMykWrLqg8o2EDj/cYPjlHotKdD4dC 9svHSpdYnhSWq91BfRMnAJ/L9ThLn6FRxAqQdfXwdrPyH7tSD/W7b8bNWIBB4PyV 5mUquCjnBOhQK/0Gvxs0fh1uTZM80qhMIgfjDpp9TBoe79DMvxS0ImbB9Wat/yKq rGxNFVaLw08L+97Vzr8S5FqQwVdIvOFoG3D0Rxrs6Jps6zrSNbk= =Yfuh -----END PGP SIGNATURE----- --=-=-=--