Received: by 10.223.176.5 with SMTP id f5csp3445212wra; Mon, 29 Jan 2018 13:17:12 -0800 (PST) X-Google-Smtp-Source: AH8x225JVr12ag8ZWUqdVIwFXm/b6uuJIN6zqlUMxpj8m/KKHtSGaFGMVtUI6JudHgf6EGzGwoKB X-Received: by 10.101.69.66 with SMTP id x2mr22507166pgr.69.1517260632001; Mon, 29 Jan 2018 13:17:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517260631; cv=none; d=google.com; s=arc-20160816; b=U0X6ePN3ChD63tthn3E+cr/R6q0kDtJBeIuaE1Y8QQ3fgOsfrBs7gTeF4FH4dc/I8t 02tUdWoiAalWRIuzIHYmT3ZTIoxq2ab1CLacrK9UJecoEP3fgoTE8zMW9TcllW87Ellv Xyo4tAk4T2C/t1+pu6yJkO+craxmrRVMPl8cAMdBihTjg4UsKnSI00GXVO9l6BrOAovu GcvL3Udtq/SdZhTSNB/jDmV1+7uk7XlxsDVdEcM9VX/Ic9qGtpOMHDTjnzBJ3kh+3SpN VW3WNs5fxM/cUY56onF+z4rojUKUqbkQoqaDIJpPV9Nfih2P06AuL+77Rz3abBdbTVzK 2LbQ== 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=tgU3ddb/ve5qNNXjNdUHkSAY+CfqSfAGN6iWy3Q8R7o=; b=dfiI9b7coTi39cnxMVcVkTh/+XDnbV40zyz/Z9FWVA5QhsOcds8LHkY7/LyAUpFm6f t2iYhRZ6M3Aif6cWpDr9Iy/BQfQNea+vxwHhZNwdue2lxZeOrPkpoeb9bFlLhaD07xP5 jDNIiLeCZMAvgnqvw/lYGPUvOZhwJDxLgTEc1rDnQ8pTa2NWMPfEwIGRUCDybFOdU9ha s3YR1xpdakzOSlPbqC7qBWG4yA3pVr1mGvOzsUmjYDkHsnVBz1BGrR/G6MfZXNYQxj8s 6uphYl/VpZLG5t3KZ0SJ5r6zB4oXl2NzEx4KRXf7LSPAcMZNn08Uxilthb99qqif9SIx 1kdQ== 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 g10-v6si668589plt.206.2018.01.29.13.16.57; Mon, 29 Jan 2018 13:17:11 -0800 (PST) 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 S1752485AbeA2VQH (ORCPT + 99 others); Mon, 29 Jan 2018 16:16:07 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:43496 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752331AbeA2UEi (ORCPT ); Mon, 29 Jan 2018 15:04:38 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 3F3582F5B; Mon, 29 Jan 2018 13:04:25 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sudeep Holla , Mian Yousaf Kaukab Subject: [PATCH 4.9 11/66] drivers: base: cacheinfo: fix x86 with CONFIG_OF enabled Date: Mon, 29 Jan 2018 13:56:35 +0100 Message-Id: <20180129123840.421887712@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180129123839.842860149@linuxfoundation.org> References: <20180129123839.842860149@linuxfoundation.org> User-Agent: quilt/0.65 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.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sudeep Holla commit fac51482577d5e05bbb0efa8d602a3c2111098bf upstream. With CONFIG_OF enabled on x86, we get the following error on boot: " Failed to find cpu0 device node Unable to detect cache hierarchy from DT for CPU 0 " and the cacheinfo fails to get populated in the corresponding sysfs entries. This is because cache_setup_of_node looks for of_node for setting up the shared cpu_map without checking that it's already populated in the architecture specific callback. In order to indicate that the shared cpu_map is already populated, this patch introduces a boolean `cpu_map_populated` in struct cpu_cacheinfo that can be used by the generic code to skip cache_shared_cpu_map_setup. This patch also sets that boolean for x86. Cc: Greg Kroah-Hartman Signed-off-by: Sudeep Holla Signed-off-by: Mian Yousaf Kaukab Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/intel_cacheinfo.c | 2 ++ drivers/base/cacheinfo.c | 3 +++ include/linux/cacheinfo.h | 1 + 3 files changed, 6 insertions(+) --- a/arch/x86/kernel/cpu/intel_cacheinfo.c +++ b/arch/x86/kernel/cpu/intel_cacheinfo.c @@ -934,6 +934,8 @@ static int __populate_cache_leaves(unsig ci_leaf_init(this_leaf++, &id4_regs); __cache_cpumap_setup(cpu, idx, &id4_regs); } + this_cpu_ci->cpu_map_populated = true; + return 0; } --- a/drivers/base/cacheinfo.c +++ b/drivers/base/cacheinfo.c @@ -106,6 +106,9 @@ static int cache_shared_cpu_map_setup(un unsigned int index; int ret; + if (this_cpu_ci->cpu_map_populated) + return 0; + ret = cache_setup_of_node(cpu); if (ret) return ret; --- a/include/linux/cacheinfo.h +++ b/include/linux/cacheinfo.h @@ -71,6 +71,7 @@ struct cpu_cacheinfo { struct cacheinfo *info_list; unsigned int num_levels; unsigned int num_leaves; + bool cpu_map_populated; }; /*