Received: by 10.192.165.156 with SMTP id m28csp45621imm; Tue, 10 Apr 2018 16:04:30 -0700 (PDT) X-Google-Smtp-Source: AIpwx48rXKlxaHS/mMxmJshWqEquiTCzNJ2OKwvtFyLbkYwESgv286NkrZ56mO9cdYIwHPmypP35 X-Received: by 10.99.7.203 with SMTP id 194mr364577pgh.45.1523401470073; Tue, 10 Apr 2018 16:04:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523401470; cv=none; d=google.com; s=arc-20160816; b=jM4l8+5l7VEjTMVVo4G8QiGv7RcaMfM3IvTGqA8oHfyRY2VDGSQqHujdfYvcvXIY47 o9uY5waF80M6lJu7yZAPhTiYbunmrmX+vyGeZvC44bf/QiqYzW/5qTgkB6m1xXRrCmfL V3KnegQ3KmmsEIpMmg7aoZCt5LXzbhs0UqrRTmFbcbjhks4aYosVTyZPNNc3Ex7XDXRI eKzZYpGxOBaOBnrA/BluebxESaayFTFJ9Sh3fSJqWLzYvlW03E0mlwAaPz6bN21uXoFa hbayIDeCbwkdelg/lE5picP3uaUbEMF4xnmXfPtGY02/Sw7nDf/j1dS5hQqxnD1kUzEA yEsw== 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=gw2lFcRBsIJJI2e71x+z54D4zNLNMlfzlHy+ns8owM0=; b=XZH5b0KdDkaaFWiAQ1iPoIM7t9ABYBiBERA7TU4/OSxl8WjkKr8h1EeYOPk2uQ2r68 riTX1P6tFOZ1an9v1nN7ClReLoEkiReiyi8pUXc+tTCliRndn1zd4UjqqN/ez1pCAZRB kB2VCsm2PKUeGLx41vYYugpvIZXRkATXj9jD1ho5Etzb4gXt9iYvvHDTL0LtQJBlHQwH nxmjPJ0EXGEfANMckIPFcBjbFAzh2EhFXgxnz9lxGoZNnHezTuCOFmZcXC5/tR2QvQLM s6XZeFPoH7wlxe38QzJsPN/qKvSNqYgiO7Yw01fRbJ674tZcKjIG1W1r8yWmni4UEFz4 HU+w== 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 n34-v6si3577019pld.331.2018.04.10.16.03.52; Tue, 10 Apr 2018 16:04:30 -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 S932354AbeDJWgE (ORCPT + 99 others); Tue, 10 Apr 2018 18:36:04 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:42348 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932338AbeDJWgB (ORCPT ); Tue, 10 Apr 2018 18:36:01 -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 14BF9DFA; Tue, 10 Apr 2018 22:36:00 +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.14 047/138] staging: lustre: disable preempt while sampling processor id. Date: Wed, 11 Apr 2018 00:23:57 +0200 Message-Id: <20180410212907.554789447@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212902.121524696@linuxfoundation.org> References: <20180410212902.121524696@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.14-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 @@ -528,19 +528,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);