Received: by 10.192.165.156 with SMTP id m28csp69551imm; Tue, 10 Apr 2018 16:37:21 -0700 (PDT) X-Google-Smtp-Source: AIpwx496vDvMLvXpjgWDNcvd93Us/NknitXpWFNIydLj6KWUr57/DJhwhJ3ZQ8DTjunyEZK6uz0r X-Received: by 2002:a17:902:2006:: with SMTP id n6-v6mr2505703pla.150.1523403441350; Tue, 10 Apr 2018 16:37:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523403441; cv=none; d=google.com; s=arc-20160816; b=qidXgDkRykco1j61CjvVVCd5TKMVZgGYnGti+YA7QWwkb4y97wW0kgu98RuCXi0JRc vQpvzwCio4g53ZMwN8SeEshskrypZO+oLl0mcYa9rkISfxEH0tVowM6JScHwC+Ws2KXY YMPYe7GESqVDElXnPfOeYSWS/ptBsLWobhYKooOM3glOyVvzveX5S4B/8BbvB0njnO/Z x5ScGZ7FAIS+98xpD/kjE/8VGyT8zLemQeO+A8uLj68UquuaXj/cqFA+RVEtCZ5B4X/j NOq1EUvSjSVfgzH4FhQyIaBGBdGIfy3kRN79Q1nCsKBvXHvoFevhwwCWVCoQU9I0XPJe bcvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=xwEmrKlBDt2erKy8LrWsxg8SWRru9+jwE5lf79E5II8=; b=fzX1biy/b4Zg66ZoC5qzMhDmfhUx/w2dPRCgOf0yOjWQJaclQQkJJBugayMmwj0DCg 8RefL6veA5HnA08SGpEaY+SIumtMYyEfoWX5wpA399g8iuXVkSiiYQ34lFvM6aDZcAQu 8yqx/lmcbRFRmffs3xqv9TxFAqz2cUcH5S3JJVGmYVg5Bk8oqgCbEF6FGLPVbOOEMCN9 QqyJi38uAiI6Ckkls8TEScc4CKVv6x+20hCpxUdowSKXQZUxksteBXNUKOkc6THpe277 hAdzA6LUiTqN5lnLsiMRF/EI01N6sZnsAcEd8EgNkfOerszLA8SM9zMJARy+fa3efwqN C8Dg== 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 i63si31397pge.219.2018.04.10.16.36.44; Tue, 10 Apr 2018 16:37:21 -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 S1754729AbeDJXb6 (ORCPT + 99 others); Tue, 10 Apr 2018 19:31:58 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:39140 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754066AbeDJW2d (ORCPT ); Tue, 10 Apr 2018 18:28:33 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id D5507D09; Tue, 10 Apr 2018 22:28:32 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, NeilBrown , Andreas Dilger , Sasha Levin Subject: [PATCH 4.15 062/168] staging: lustre: disable preempt while sampling processor id. Date: Wed, 11 Apr 2018 00:23:24 +0200 Message-Id: <20180410212802.839699613@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212800.144079021@linuxfoundation.org> References: <20180410212800.144079021@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: NeilBrown [ Upstream commit dbeccabf5294e80f7cc9ee566746c42211bed736 ] Calling smp_processor_id() without disabling preemption triggers a warning (if CONFIG_DEBUG_PREEMPT). I think the result of cfs_cpt_current() is only used as a hint for load balancing, rather than as a precise and stable indicator of the current CPU. So it doesn't need to be called with preemption disabled. So disable preemption inside cfs_cpt_current() to silence the warning. Signed-off-by: NeilBrown Reviewed-by: Andreas Dilger Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) --- a/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c +++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c @@ -529,19 +529,20 @@ EXPORT_SYMBOL(cfs_cpt_spread_node); int cfs_cpt_current(struct cfs_cpt_table *cptab, int remap) { - int cpu = smp_processor_id(); - int cpt = cptab->ctb_cpu2cpt[cpu]; + int cpu; + int cpt; - if (cpt < 0) { - if (!remap) - return cpt; + preempt_disable(); + cpu = smp_processor_id(); + cpt = cptab->ctb_cpu2cpt[cpu]; + if (cpt < 0 && remap) { /* don't return negative value for safety of upper layer, * instead we shadow the unknown cpu to a valid partition ID */ cpt = cpu % cptab->ctb_nparts; } - + preempt_enable(); return cpt; } EXPORT_SYMBOL(cfs_cpt_current);