From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x225xfQMXUt6ljRtV1YApTu1qWShT0yG9Sj0f/X3oaVnUtU7iS1VQSTU5FGxIk6ROpOiOwPr1 ARC-Seal: i=1; a=rsa-sha256; t=1517256279; cv=none; d=google.com; s=arc-20160816; b=Qg9b5hbeEfRYpYHuiyeFG5+pObQLXMaLGR9+UsWW2KG0gGNyszUnfXqikpIktJZ8o0 yzEXY3g5gINj1Uwzkhx+4RyUESyZToEDkBKfG+oPWDkYCgTSXi6Zr8bh+eBA/EnajkJW GDM7c38gDVZq8Xo0wgQhUG28Yzuw7tPS9sxiftpUORc9pZd1tlTuoj8QE6iXy543X+EJ yQuV6Sk2ujQ+xqhzYGbjTT6A/zsBZ3ct1sDzDg12xKM4HyJXb0dzbeeWKI27mPvnCqvH ONsLASIbA/3ZelBDveFC8m/VLWR49p36lyGpM/Cy0R8H7Z5zqLhJIN0oWVVSzfUDIg/P e6lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=tgU3ddb/ve5qNNXjNdUHkSAY+CfqSfAGN6iWy3Q8R7o=; b=faxVrz4dIgYD8i4AIGfa32E7QyFpkQzENFI5o4NTfqTV2Wb2+ld18mswtim5Z0UFRz xH4uWzhftDIJhyCAB0aIj7XWCmqe7+ZMvTwQhKBtEoRayKI9+zyqg8ESKLDblOvoVbvO /LN4Edfe03H0sOArz48YLUNbfSGIQMTiq5miRNVQ5HOJU/B0HhwJ3lt6nH8sywlcAUT8 MMqDJV3Ctwclk4Dz43VeomzNhQg4TsBPgRIHftgrEtUy1U+RRvkM0VZWFutzx6drOuQ3 SNw1mA05HACv7MttYWQRAPeSWRK6a+UOCM8XCO/veOtGUN2IAPxWLVVtMrTZ4K7hT5Ta zlaw== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCI=?= X-GMAIL-THRID: =?utf-8?q?1590958520424289748?= X-GMAIL-MSGID: =?utf-8?q?1590958520424289748?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 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; }; /*