Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1521368ybm; Thu, 23 May 2019 02:26:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqwuQYFlVmnjVJN8NOM9rGEU3Jv6KlniRIUK+0obVYK/6W5/pU1XekROaRel/F45RCh3jXh9 X-Received: by 2002:a17:902:d890:: with SMTP id b16mr48353766plz.91.1558603578219; Thu, 23 May 2019 02:26:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558603578; cv=none; d=google.com; s=arc-20160816; b=PaqU4uKZNun68RALoSwd34MciNN+GQS+KHOKDcFyJW1qPK455pgWqRV7DS/Ae2MQ/B DmvTx+BiczRx0yiUTlIWlvaeKk+eIawBTl/MXVWeg56p7ELIANMZdDsKRkc33C3i0kXu vcLCeLbYaGXz5z8JobyfysHpjvXfU/QmJE1+wc8DeAqLllDg1Wu96+PZVfoOtkuLCHDt e2NcxmnndyhUT/MbvKIbR2rQwG2cv0dBa/rx3uo2/2xoE4iXL0Awm6Qwo9hevsBCQwSz uma2zjyYgXq+remOkgN5KUgp4NBUfbQRkbxquLbOG+GwM0m6xVtxcc0DcMawwr/4Gr4P 9/YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:dkim-signature:dkim-filter; bh=Yl/n558itPzqtGfLOzc2St/VFW5ipWNb7KMyIjz/Mng=; b=0l73Xj81xOezkG/yeH8oVkcbfTl79biKngXowk6f+XJMXnrtmtoVttYQT6Ex7Sg9vT ZguZ0VlY+IgPqu0epsTuL+nANopfC2+adopLKZ6RY5X2zIgO9J3BzfC3m2PXSAv/fAr6 YHTsmRREw8L2+urQ8OaZLinBtchCPEHGp/4SnmEVNiUxEakNL77L6K6/wMMgBSAKx2eY 7hyTG+uXiJRudLpgKJitWjvjIFEprmdlM7aNgfPRiabcV3JUmgJ+6JzHUPi4Bd8UORKf GqbCpO5xWCqv1IHyDSn7Qg4UhMjLF1hEoZ09vECD329Vx/oWfMQbgGyWVqz2og5Cu7ou DaBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2019051801 header.b=JRBFZ1sB; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s24si25447879pga.515.2019.05.23.02.26.02; Thu, 23 May 2019 02:26:18 -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; dkim=pass header.i=@zytor.com header.s=2019051801 header.b=JRBFZ1sB; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729934AbfEWJXc (ORCPT + 99 others); Thu, 23 May 2019 05:23:32 -0400 Received: from terminus.zytor.com ([198.137.202.136]:60947 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726081AbfEWJXb (ORCPT ); Thu, 23 May 2019 05:23:31 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x4N9NJvM4039623 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 23 May 2019 02:23:19 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 terminus.zytor.com x4N9NJvM4039623 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2019051801; t=1558603399; bh=Yl/n558itPzqtGfLOzc2St/VFW5ipWNb7KMyIjz/Mng=; h=Date:From:Cc:Reply-To:In-Reply-To:References:To:Subject:From; b=JRBFZ1sBmH+j+gWAndWWzA6M0HZ9uXz9EsZ8YUM37Z5YNPihblLmt3+loMY33SsND XnT01nMut+tL+8F937kxEYcDS8T1xkFnSDs73oHDDFx6Vkus8f/CrexmCgIhwdsmqf 2Ff+wdqOIx+u/nTXCmm3dLHRS8EuFUR5pkWf03W0pCn7xoH6l47vcRelJNCah8bMJt 3VKYLMBsLVer8tt6knbKmIQH5t8LzWezilzwScrk9Y56xSfw2M4IWnpcso1W8mh94N KSWQfaQLOd4kwqYobfdpz6fmUUb9l3OqS/OKtmTARi+eo66OGI5G6D+bjSfH6m35RL ya7swvxj/VmYg== Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x4N9NI444039620; Thu, 23 May 2019 02:23:18 -0700 Date: Thu, 23 May 2019 02:23:18 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Len Brown Message-ID: Cc: tglx@linutronix.de, mingo@kernel.org, peterz@infradead.org, hpa@zytor.com, linux-kernel@vger.kernel.org, len.brown@intel.com Reply-To: linux-kernel@vger.kernel.org, len.brown@intel.com, tglx@linutronix.de, mingo@kernel.org, peterz@infradead.org, hpa@zytor.com In-Reply-To: References: To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/topology] x86/topology: Create topology_max_die_per_package() Git-Commit-ID: 14d96d6c06b5d8116b8d52c9c5530f5528ef1e61 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-3.1 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 14d96d6c06b5d8116b8d52c9c5530f5528ef1e61 Gitweb: https://git.kernel.org/tip/14d96d6c06b5d8116b8d52c9c5530f5528ef1e61 Author: Len Brown AuthorDate: Mon, 13 May 2019 13:58:46 -0400 Committer: Thomas Gleixner CommitDate: Thu, 23 May 2019 10:08:30 +0200 x86/topology: Create topology_max_die_per_package() topology_max_packages() is available to size resources to cover all packages in the system. But now multi-die/package systems are coming up, and some resources are per-die. Create topology_max_die_per_package(), for detecting multi-die/package systems, and sizing any per-die resources. Signed-off-by: Len Brown Signed-off-by: Thomas Gleixner Reviewed-by: Ingo Molnar Acked-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/e6eaf384571ae52ac7d0ca41510b7fb7d2fda0e4.1557769318.git.len.brown@intel.com --- arch/x86/include/asm/processor.h | 1 - arch/x86/include/asm/topology.h | 10 ++++++++++ arch/x86/kernel/cpu/topology.c | 5 ++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index ef0a44fccaec..7c17343946dd 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -106,7 +106,6 @@ struct cpuinfo_x86 { unsigned long loops_per_jiffy; /* cpuid returned max cores value: */ u16 x86_max_cores; - u16 x86_max_dies; u16 apicid; u16 initial_apicid; u16 x86_clflush_size; diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h index 453cf38a1c33..e0232f7042c3 100644 --- a/arch/x86/include/asm/topology.h +++ b/arch/x86/include/asm/topology.h @@ -115,6 +115,13 @@ extern const struct cpumask *cpu_coregroup_mask(int cpu); extern unsigned int __max_logical_packages; #define topology_max_packages() (__max_logical_packages) +extern unsigned int __max_die_per_package; + +static inline int topology_max_die_per_package(void) +{ + return __max_die_per_package; +} + extern int __max_smt_threads; static inline int topology_max_smt_threads(void) @@ -131,6 +138,9 @@ bool topology_smt_supported(void); static inline int topology_update_package_map(unsigned int apicid, unsigned int cpu) { return 0; } static inline int topology_phys_to_logical_pkg(unsigned int pkg) { return 0; } +static inline int topology_phys_to_logical_die(unsigned int die, + unsigned int cpu) { return 0; } +static inline int topology_max_die_per_package(void) { return 1; } static inline int topology_max_smt_threads(void) { return 1; } static inline bool topology_is_primary_thread(unsigned int cpu) { return true; } static inline bool topology_smt_supported(void) { return false; } diff --git a/arch/x86/kernel/cpu/topology.c b/arch/x86/kernel/cpu/topology.c index 4d17e699657d..ee48c3fc8a65 100644 --- a/arch/x86/kernel/cpu/topology.c +++ b/arch/x86/kernel/cpu/topology.c @@ -26,6 +26,9 @@ #define LEVEL_MAX_SIBLINGS(ebx) ((ebx) & 0xffff) #ifdef CONFIG_SMP +unsigned int __max_die_per_package __read_mostly = 1; +EXPORT_SYMBOL(__max_die_per_package); + /* * Check if given CPUID extended toplogy "leaf" is implemented */ @@ -146,7 +149,7 @@ int detect_extended_topology(struct cpuinfo_x86 *c) c->apicid = apic->phys_pkg_id(c->initial_apicid, 0); c->x86_max_cores = (core_level_siblings / smp_num_siblings); - c->x86_max_dies = (die_level_siblings / core_level_siblings); + __max_die_per_package = (die_level_siblings / core_level_siblings); #endif return 0; }