Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp341822imm; Fri, 1 Jun 2018 01:45:12 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIDhvwUGThaqP2pEY2lUJZPkbNSCAbKtBA7ku5cYxBsTii+iFZPGLmrfSj5z6Rufd7YDBy5 X-Received: by 2002:a62:6406:: with SMTP id y6-v6mr5986682pfb.204.1527842712178; Fri, 01 Jun 2018 01:45:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527842712; cv=none; d=google.com; s=arc-20160816; b=imZyh2LZMxztRLHFYVotEimDhK7CRyKIl1EY1Wkughy17Y56Ubzk+9c563rWVNDjfu 1bz2EYd2OcVXwPRRY2TWArvb3ma5L935JWQY1nGi44MUnkEY99QpGUgfcx6a33SsfJ1t 3lXP94VdfLuLoDKwdwfUpn3Voi1/kF+ViW1Tjd/jnysVFQ/yDo9byV/RRr8NNiRJk7Kq 06sP4/0EB/8PUEIqBYQrcqJt6u2bbVVfo4+OFK5DRixD9W+IIvgj1AyNdTHlmTcc1CEG mvV3NwnFAprgx9FMj8T92WadL+A5aiYC5sDSooyxognaLhedWFyWWRSm5RsY3++c/JFq iYIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=ugvYkxNWbNBdas/c/ruusjmS/yE5/lXDO7+7+4R+E/k=; b=wXgGrDEM4GBmYgqXmPIHcBAp1nIe5qq4FsiofWftfL3c2MYPnT81nIf7vJiIB2Uov3 ITssEQi6HOGHeboTTudlpIwG5JgbtrPx0YLvyDLpZMv8ooQMUZeNXU3dvGe31oPDHx8Y fR81nVJK/xXzRbwsvXp2uuwmbdZOAY8bW1ZVCToB12M265u4AEu2tc07f+mm5I6nM20P q2XfUlX1etGS6TJzkpm3PkLrpoYfbykYCWcl5ja9qNs8tvRaMu3pqhfniWlF3xv6UZUD BEuoBDGzO+rmQf6inw91iS66GlOy1RTsrXZsrUfx0GNqobj8uxj/i2mmlJzOBoxI9/kV Txfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wChxfp8P; 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 q14-v6si3214162pli.419.2018.06.01.01.44.58; Fri, 01 Jun 2018 01:45:12 -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; dkim=pass header.i=@kernel.org header.s=default header.b=wChxfp8P; 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 S1750916AbeFAIoN (ORCPT + 99 others); Fri, 1 Jun 2018 04:44:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:52754 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750771AbeFAIoJ (ORCPT ); Fri, 1 Jun 2018 04:44:09 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B0B4C20876; Fri, 1 Jun 2018 08:44:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527842649; bh=7W8+Ia4f0Gn8KwM5ITM9NRBCKWwIhOgSArOkCAexbpc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=wChxfp8PTwxtxtr8vU4lVagP5A8EgCZ39uuQpSRKW+UapmVR7QWxQg4w+f945R7BT wRKBsotVjHR7WiBBuoFwO89OMoM9fPkxVZ0xLy99uVnMZtg+BxDUUk7a2NDRDyWCLA BuhcoWzVI9F4g0azZn7u5n46FS8SmztCqY+TxvQ8= Date: Fri, 1 Jun 2018 10:43:47 +0200 From: Greg Kroah-Hartman To: James Simmons Cc: devel@driverdev.osuosl.org, Andreas Dilger , Oleg Drokin , NeilBrown , Dmitry Eremin , Amir Shehata , Linux Kernel Mailing List , Lustre Development List Subject: Re: [PATCH v2 23/25] staging: lustre: libcfs: rework CPU pattern parsing code Message-ID: <20180601084347.GH19242@kroah.com> References: <1527603725-30560-1-git-send-email-jsimmons@infradead.org> <1527603725-30560-24-git-send-email-jsimmons@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1527603725-30560-24-git-send-email-jsimmons@infradead.org> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 29, 2018 at 10:22:03AM -0400, James Simmons wrote: > From: Dmitry Eremin > > Currently the module param string for CPU pattern can be > modified which is wrong. Rewrite CPU pattern parsing code > to avoid the passed buffer from being changed. This change > also enables us to add real errors propogation to the caller > functions. > > Signed-off-by: Dmitry Eremin > Signed-off-by: Amir Shehata > Signed-off-by: Andreas Dilger > Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8703 > Reviewed-on: https://review.whamcloud.com/23306 > Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9715 > Reviewed-on: https://review.whamcloud.com/27872 > Reviewed-by: James Simmons > Reviewed-by: Andreas Dilger > Reviewed-by: Patrick Farrell > Reviewed-by: Olaf Weber > Reviewed-by: Oleg Drokin > Signed-off-by: James Simmons > --- > Changelog: > > v1) Initial patch > v2) Rebased patch. No changes in code from earlier patch > > .../lustre/include/linux/libcfs/libcfs_cpu.h | 2 +- > drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c | 146 ++++++++++++--------- > 2 files changed, 87 insertions(+), 61 deletions(-) > > diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h > index c0aa0b3..12ed0a9 100644 > --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h > +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h > @@ -393,7 +393,7 @@ static inline int cfs_cpu_init(void) > > static inline void cfs_cpu_fini(void) > { > - if (cfs_cpt_tab) { > + if (!IS_ERR_OR_NULL(cfs_cpt_tab)) { > cfs_cpt_table_free(cfs_cpt_tab); > cfs_cpt_tab = NULL; > } > diff --git a/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c b/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c > index 649f7f9..aed48de 100644 > --- a/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c > +++ b/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c > @@ -692,11 +692,11 @@ int cfs_cpt_bind(struct cfs_cpt_table *cptab, int cpt) > nodemask = cptab->ctb_parts[cpt].cpt_nodemask; > } > > - if (cpumask_any_and(*cpumask, cpu_online_mask) >= nr_cpu_ids) { > + if (!cpumask_intersects(*cpumask, cpu_online_mask)) { > CDEBUG(D_INFO, > "No online CPU found in CPU partition %d, did someone do CPU hotplug on system? You might need to reload Lustre modules to keep system working well.\n", > cpt); This is the funniest error message I have seen in a while. No one should have to reload all kernel modules just because the CPU topology changed, that's crazy. You have the ability to read all of this at runtime, and react to changes that happen while the system is running. You should never need/rely on userspace passing in random strings to pretend to match up with what the system really has at the moment, that way lies madness. All of this should be ripped out and use the proper apis instead. No special userspace api should be needed at all. greg k-h