Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755965AbbKCTPc (ORCPT ); Tue, 3 Nov 2015 14:15:32 -0500 Received: from mail-by2on0067.outbound.protection.outlook.com ([207.46.100.67]:55550 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755942AbbKCTP2 (ORCPT ); Tue, 3 Nov 2015 14:15:28 -0500 Authentication-Results: spf=none (sender IP is 165.204.84.221) smtp.mailfrom=amd.com; 163.com; dkim=none (message not signed) header.d=none;163.com; dmarc=permerror action=none header.from=amd.com; X-WSS-ID: 0NX96TP-07-CE6-02 X-M-MSG: From: Aravind Gopalakrishnan To: , , , CC: , , , , , Subject: [PATCH] x86/intel_cacheinfo: Fix LLC topology for AMD Fam17h systems Date: Tue, 3 Nov 2015 13:15:56 -0600 Message-ID: <1446578156-4431-1-git-send-email-Aravind.Gopalakrishnan@amd.com> X-Mailer: git-send-email 2.6.1 MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:165.204.84.221;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(428002)(199003)(189002)(2201001)(97736004)(53416004)(87936001)(47776003)(5008740100001)(5007970100001)(50986999)(5003940100001)(48376002)(50466002)(5001770100001)(5003600100002)(101416001)(19580395003)(5001920100001)(229853001)(86362001)(77096005)(19580405001)(92566002)(36756003)(50226001)(189998001)(105586002)(106466001);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2PR12MB0711;H:atltwp01.amd.com;FPR:;SPF:None;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY2PR12MB0711;2:ZTxcPTKNXSRjpncRfDhruPCsEvlbugyq8V6IVBg4UIFNGmKdDm+bggDoWSflwTA4QMZQ5s9+AoSPDHP8FIUP0glpmskcK4k5j3s15IvIDzcNIXNGERn7lPC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vOqD6bSktx6RxSZw136b9ANvukdEWJuzkYb2jaU85Bk49zR8ZUq+XSZAxGTx0Y33yVdGO6y3+1ZJWhWsmJxTzqqOZPO56LXQT75xwRCz9TWyKFMOeHs/cc4uo9JuGYu5nqa;4:WV1ZwCf0Y6N0N+lngG+Ubv+hOxalAcVcLVbe7c0ZurbGpD5BFf+UoTuulcwMXTTT4Y9GGb3eRwoAyvzNogqAYKD+EO449M9dlxiTa5ZiKapkFuuoK1zt//RnQ+ugWE+S2CAPpa23+S6Gh5oqvoBYK6zec3PdI3z5WPxjOKNxzhK1wF6Tz5gXaQNmEVFwWqYy61mTJ8l6ALvlgBCJJoz3nHMee0wGJhrzk9gHX6moK1wRvPUvCLLz9W0j9jlP6TPaoXC+4eNYIyUPrjK6y1qwWwIiADrNGPiUFPkTpnwQDyl2uG5GGOfSIsqd0I+aFO+5YyN3YGfRbJvjJbq+j3V4lUQFd1ZiC9IyfDBc0WPYnY9aAKh6HuDTLK6Y1+2B5HjW X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(10201501046)(3002001);SRVR:BY2PR12MB0711;BCL:0;PCL:0;RULEID:;SRVR:BY2PR12MB0711; X-Forefront-PRVS: 0749DC2CE6 X-Microsoft-Exchange-Diagnostics: 1;BY2PR12MB0711;23:xpIMgi5Upnt4F/HCXnNZZBXROZC7uoKSszYjD1YXhGm08slOVWyt7WNKq3lnGnCcIyLz0Mr31lBQOvbQyx05jImJyKeD7sf9EBGoIHvQGEUYHt5kO93Zqaqm73VOp2eVpYgK1OwHpw1OWzTppEFTD8STk8tlC//SE274HrmCse1Bl8kDOqlY/Dme+b1xPK2UJ8FzYUIsXaZeYr94rJ9BE3tKWdUtYETX3wh4SnDGy/IqaC9WO87st3wPWAciu2BohE7EvdDDJzBFITpW1TIUwhA/UHKIH73LqIhNdOuu3d+AGO8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jvh0tTNYPMRbKZu+8pJ9uaUNfGTTD4lHZwqV92yXPSw6PKFaWrafHGA0tCwyyMY+gtsnoPJdkqw6uygIQV8E4zMpErD7y7etnuts SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2015 19:15:25.6562 (UTC) X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.221];Helo=[atltwp01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0711 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1755 Lines: 52 On AMD Fam17h systems, the last level cache is not resident in Northbridge. Therefore, we cannot assign cpu_llc_id to same value as Node ID (as we have been doing currently) We should rather look at the ApicID bits of the core to provide us the last level cache ID info. Doing that here. Signed-off-by: Aravind Gopalakrishnan --- arch/x86/kernel/cpu/intel_cacheinfo.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c index e38d338..897a483 100644 --- a/arch/x86/kernel/cpu/intel_cacheinfo.c +++ b/arch/x86/kernel/cpu/intel_cacheinfo.c @@ -636,6 +636,9 @@ static int find_num_cache_leaves(struct cpuinfo_x86 *c) void init_amd_cacheinfo(struct cpuinfo_x86 *c) { + unsigned int cpu = c->cpu_index; + unsigned int apicid = c->apicid; + unsigned int socket_id, core_complex_id; if (cpu_has_topoext) { num_cache_leaves = find_num_cache_leaves(c); @@ -645,6 +648,17 @@ void init_amd_cacheinfo(struct cpuinfo_x86 *c) else num_cache_leaves = 3; } + + /* + * Fix percpu cpu_llc_id here as LLC topology is different + * for Fam17h systems. + */ + if (c->x86 != 0x17 || !cpuid_edx(0x80000006)) + return; + + socket_id = (apicid >> c->x86_coreid_bits) - 1; + core_complex_id = (apicid & ((1 << c->x86_coreid_bits) - 1)) >> 3; + per_cpu(cpu_llc_id, cpu) = (socket_id << 3) | core_complex_id; } unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c) -- 2.6.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/