From patchwork Thu Mar 1 15:24:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 130251 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp2942503edc; Thu, 1 Mar 2018 07:30:52 -0800 (PST) X-Google-Smtp-Source: AG47ELtBw2y1mfRQGtiqES8QA2uTFyc1QaSZXfFgcjkK0Gkuo3CY5Nl5npWaS7K3HV3Z7i9EqRpv X-Received: by 10.99.105.70 with SMTP id e67mr1859633pgc.342.1519918252559; Thu, 01 Mar 2018 07:30:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519918252; cv=none; d=google.com; s=arc-20160816; b=GhOYmLzXCG+MSzR37Z/em2pqDm83GiQAAHG94NNWlaDhKkS/JJ3Jbi+TVoz2VL/oG/ 561gHQznAmX25N/dA0Ayifq3WfVESvz9gthXq/rH5rcW31Tk8UO7j5mgO4Ztn1ay2pv4 92iyiIrv2OwD8CgoGS33IM4bdvfdVIRNIm9sHF7dXWmSp+2uyvkRq4d5YVvt/tDa0Hh2 nyj+m2mayQmI1nNuyesa7GnKmt6mok0i3LPsdv842XGjJt2ix+TJdDHGROdWQp8clQkg F5jmbjw1kGUDti4cT1YXNWmSCHiWbl7U/kkBokxUafSC8+OZPJnCHs8DWvMXuZNseohd SHTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=BjCZQugup0Nanedna5+rz9n+4zpeTRyRCjL8O4uVi3E=; b=k6sq/jfP+EU/6NkicS2wyUhcvwwo8KoDSnpu5UgSGFs2xoX63IaVc4++B7zF38zRo6 5G1RfIieZrTtGEJsS2sPJiRcdyarhdYQYSBCNEOmY+uNqUcjGw/SaJypFZCihNRhULvh 22KMEo+pT3DRGub008DFOJqPTZbcQ2VreUERqof6CPguorLu626RmgTqOTFHMh/AehGO sSMPRrnHmgI2MdZ7j/KE7UNjwNPMzyXAVpkN5J42E+ZeS/KKQGUphTUBfReNo0d44U21 jjYowyJD8GloWjRgPkLakxiI3s0+VrQ5b3QJU38h9aS3NoVooelLaAFjpyr838ruGEAs eNhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=g1/6weNe; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z7si2597209pgp.660.2018.03.01.07.30.52; Thu, 01 Mar 2018 07:30:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-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=@microsoft.com header.s=selector1 header.b=g1/6weNe; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1032152AbeCAPat (ORCPT + 10 others); Thu, 1 Mar 2018 10:30:49 -0500 Received: from mail-by2nam03on0132.outbound.protection.outlook.com ([104.47.42.132]:16151 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1032067AbeCAPab (ORCPT ); Thu, 1 Mar 2018 10:30:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=BjCZQugup0Nanedna5+rz9n+4zpeTRyRCjL8O4uVi3E=; b=g1/6weNe7wi2hVGQcXUNPuP3LfGTeJdVBfjtTNN6+kX267Aom2Wqnbs0+bsHLFUhPwyvoypChl/vhikuINts5ThmbKv1ZY7pzDlloQqXet+cSrBsV3D+de9FuGcsBeCEH4TskaHGBQ6kxEZwQ/x8jgrGZ4yWLNfsD/LTH5CTAHA= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0967.namprd21.prod.outlook.com (52.132.133.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.567.2; Thu, 1 Mar 2018 15:30:27 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8063:c68a:b210:7446]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8063:c68a:b210:7446%2]) with mapi id 15.20.0567.006; Thu, 1 Mar 2018 15:30:27 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "stable-commits@vger.kernel.org" CC: Sudeep Holla , Greg Kroah-Hartman , Sasha Levin Subject: [added to the 4.1 stable tree] drivers: base: cacheinfo: fix x86 with CONFIG_OF enabled Thread-Topic: [added to the 4.1 stable tree] drivers: base: cacheinfo: fix x86 with CONFIG_OF enabled Thread-Index: AQHTsXFqHJZ62LJ56UyQoosx6qv0Pg== Date: Thu, 1 Mar 2018 15:24:39 +0000 Message-ID: <20180301152116.1486-210-alexander.levin@microsoft.com> References: <20180301152116.1486-1-alexander.levin@microsoft.com> In-Reply-To: <20180301152116.1486-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB0967; 7:WRP1+l7wnVVBgeWDT/q8c3hxDWREJD0AeWdaf09YnNSWpnawSpCoQfaagwdMDuTgiwwqE4EyetdA93BHlK3iByu563ZdXZSzEAfDDrxPChqFlX91p1p0EjZjl8rJOp7QJuH7jmdYoCHcIOhYGbndTR98x/ETo9+3bxYTH6ib8Ok2RUMRMBTeC5akWrt8fWN8wIck4bOACT9MBJQGg+7ZRgNsKKWq1VpwNyHRjJXmY0ce1a1yNxssiycAhcKjMdyY x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 3650c797-bc77-4012-b40d-08d57f895c45 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7193020); SRVR:DM5PR2101MB0967; x-ms-traffictypediagnostic: DM5PR2101MB0967: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(180628864354917)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040501)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(3231220)(944501228)(52105095)(10201501046)(6055026)(61426038)(61427038)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:DM5PR2101MB0967; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB0967; x-forefront-prvs: 05986C03E0 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(396003)(346002)(376002)(366004)(39380400002)(189003)(199004)(102836004)(59450400001)(2906002)(10090500001)(86362001)(99286004)(575784001)(6506007)(3280700002)(66066001)(53936002)(110136005)(54906003)(105586002)(478600001)(7736002)(3846002)(6116002)(2900100001)(72206003)(107886003)(14454004)(1076002)(186003)(36756003)(6346003)(26005)(10290500003)(25786009)(22452003)(68736007)(5250100002)(81156014)(2501003)(81166006)(305945005)(106356001)(6486002)(8676002)(6436002)(8936002)(97736004)(2950100002)(316002)(6666003)(5660300001)(6512007)(3660700001)(76176011)(86612001)(4326008)(22906009); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB0967; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-message-info: fN4nl5TAK4BuMcO+3mGjXFUYMs512vGu9bDD+rH7hfdVwXFcQZcrolBpPYHYZ43xXYdHINr1l7pLILKTxyz6uhZjCpq5UqPgvsc6gz8acV0I25tFvRVlu2u+SZdq416NtZHTFemycn6swGToqx5uTT00GoyzWKHF2sKsVe9hdps= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3650c797-bc77-4012-b40d-08d57f895c45 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Mar 2018 15:24:39.9448 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0967 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Sudeep Holla This patch has been added to the 4.1 stable tree. If you have any objections, please let us know. -- 2.14.1 =============== [ Upstream commit fac51482577d5e05bbb0efa8d602a3c2111098bf ] 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: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- arch/x86/kernel/cpu/intel_cacheinfo.c | 2 ++ drivers/base/cacheinfo.c | 3 +++ include/linux/cacheinfo.h | 1 + 3 files changed, 6 insertions(+) diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c index edcb0e28c336..13fb13334f2a 100644 --- 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(unsigned int cpu) ci_leaf_init(this_leaf++, &id4_regs); __cache_cpumap_setup(cpu, idx, &id4_regs); } + this_cpu_ci->cpu_map_populated = true; + return 0; } diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c index fdba441457ec..3f5fb95b0f4c 100644 --- a/drivers/base/cacheinfo.c +++ b/drivers/base/cacheinfo.c @@ -106,6 +106,9 @@ static int cache_shared_cpu_map_setup(unsigned int cpu) unsigned int index; int ret; + if (this_cpu_ci->cpu_map_populated) + return 0; + ret = cache_setup_of_node(cpu); if (ret) return ret; diff --git a/include/linux/cacheinfo.h b/include/linux/cacheinfo.h index 3daf5ed392c9..4b97ae264388 100644 --- 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; }; /*