Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3092446imj; Mon, 18 Feb 2019 19:42:21 -0800 (PST) X-Google-Smtp-Source: AHgI3IYEXO5P7C3GW5XfrVSy/pjK4dyItyrU0D3HwWk2m4OjfvK7JkRL0cUgeMQ6DIuKwYaK/eRq X-Received: by 2002:a63:545:: with SMTP id 66mr21640480pgf.102.1550547741009; Mon, 18 Feb 2019 19:42:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550547741; cv=none; d=google.com; s=arc-20160816; b=ocvRjmek/xXph7lt40TczvbCthp+xfZYKM8XzpOm4wCwwLySj3zgEWk9Qto4rsaoB5 sZvVTxOH8OO05wBXvMnwYrCAKcA03BD+BeYgTxkSHWAH+srvowshAc1Tg4ilMtEaqAuU 8j1qPHHqht2+7l3V+/ehcLo3WjNu4wh39C3eyShKTUrMPLZl4n8BJvlaBxch0ziZNf/G ar65Oyl9Y9DB0gjYR+DkeQMDcfT/2N9AFp2rVy7gnMbPlTwHFcCCCSSp6LYWh6Sh4BPf 59qPN03bd7Zwnq/O7vW7QHzFvinmawUwaGqZ153fKF8Na50sKBmIXv6pE3vUgvb9b2kT SCCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=vd7SXS+DM9G/S+g6dKoqWpmBLRLvj4kTz4MPUfwNqzY=; b=d8q6IM9rWJuqrYlufu1JIDq+VucDq7krtCfQcLH6Yxmd5bWrFpEJ7rjrgEbLXZpDjN WpHcvuHu/ePgXflJKr+A7lc+RC4PPuJkQlVAoIP12urI9ukOl1J0/7dNO4CU3cGgdtX4 ncjlmszvTJ4IB4s9pX1HladqeCYcnQUSchpbsaa+HMxISRMvHDsjQvJamj8OPV81tojy 0hvyNT+YIcc2Gv4R2I+6mCKctRbHYGBOd6z0Z5iugSa5c7Dj2+fotdyBQV5DBF08ZXwf nC/e5eBsLWqgBl1GkWGaRm0XxbHLCFIgLy6STX7uD/XFjyXqHtCc84VCb/kI3rJw9g7m 6VpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=KTbn0ntz; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v11si15326638pfj.155.2019.02.18.19.42.06; Mon, 18 Feb 2019 19:42:20 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=KTbn0ntz; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726994AbfBSDlF (ORCPT + 99 others); Mon, 18 Feb 2019 22:41:05 -0500 Received: from mail-qk1-f194.google.com ([209.85.222.194]:46227 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725870AbfBSDk2 (ORCPT ); Mon, 18 Feb 2019 22:40:28 -0500 Received: by mail-qk1-f194.google.com with SMTP id i5so11220033qkd.13; Mon, 18 Feb 2019 19:40:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :reply-to:organization; bh=vd7SXS+DM9G/S+g6dKoqWpmBLRLvj4kTz4MPUfwNqzY=; b=KTbn0ntzQ/+3XzAGlb3ei0HzItGTvGOBcdRtK4IWqXyPCkLRC6EBT3XpZiKzGnSVMX Uv2BP7uiKi/WJlduRTzk1zZFokbKQPbw6HZ1vrsc/3BAjGe7IkQmKaiFexgwp525I3HO s30ClDMgOSBJkcroHU+gv/9slMqA21K+POzUr7jcs+iFM5KjQOiWyr8ltFrTIKWkmuRA E4QwDCzJcA1p9lxy3QiWpHxWpcBP0QGPy1XlqrUWOETahvqMPP7ixsnVXPvatItBJ6xQ JPrmYDAEgvg+gIvDMLwviKXVu6Br8bWzALX3maIkbdMSVcX7elgdgblJLlTE92N5kvCb P+jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:reply-to:organization; bh=vd7SXS+DM9G/S+g6dKoqWpmBLRLvj4kTz4MPUfwNqzY=; b=OgRZ+jIIfNa/00MzjG8zd+v+QckajPwb/ZxU79+/m9K7z4Ej3zAuyz/pFmaA9LxJLM R1rnnYzQ3X8AzqrYRDqJIbYBqxM9q9RGPRHSrBmMPKWoZUQwDGTlvuooG+ev3aLx///G GWtBGzNJMLihzSKULmx21/LGHCbw3Ix7ok3heGbWYlWZavBwSDlQK14tXDnCycPDwN5k 5mHym7Y3xSXWqCDIs7MJRPEzem0Zj6GY3OeClZWXdTfMbGAMJ9QMQ8HcPUfLLs53m7es P0d/WGdi/LffsxS4gmt/2d8EE/sGcWWw2QQEwpXWVjibznuC3g5g48XgZY9nNbYtiHqs sK+g== X-Gm-Message-State: AHQUAuZUn0CxUIQ8yLIlFwMaOJ9EowkuFqUwNhnH/3IZ1SwA7U+AtTcp Lu0SexmuzzNmEcPXszWmZ9E= X-Received: by 2002:a37:a546:: with SMTP id o67mr19056989qke.42.1550547627089; Mon, 18 Feb 2019 19:40:27 -0800 (PST) Received: from kbl.fios-router.home (pool-96-233-42-17.bstnma.fios.verizon.net. [96.233.42.17]) by smtp.gmail.com with ESMTPSA id u5sm7327680qtg.37.2019.02.18.19.40.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Feb 2019 19:40:26 -0800 (PST) From: Len Brown To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Len Brown , linux-doc@vger.kernel.org Subject: [PATCH 04/11] cpu topology: export die_id Date: Mon, 18 Feb 2019 22:40:06 -0500 Message-Id: X-Mailer: git-send-email 2.18.0-rc0 In-Reply-To: <635b2bf8b1151a191cd9299276b75791a818c0c2.1550545163.git.len.brown@intel.com> References: <635b2bf8b1151a191cd9299276b75791a818c0c2.1550545163.git.len.brown@intel.com> Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Len Brown Export die_id in cpu topology, for the benefit of hardware that has multiple die per package. die_id is quite similar to core_id, in that it holds multiple CPUs, but is inside a package. This needed by topology-aware user-space. In particular, an application, such as turbostat(8), which needs to know the actual scope of "package-scope" MSRs. Signed-off-by: Len Brown Cc: linux-doc@vger.kernel.org Signed-off-by: Len Brown --- Documentation/cputopology.txt | 10 ++++++++-- arch/x86/include/asm/topology.h | 1 + drivers/base/topology.c | 4 ++++ include/linux/topology.h | 3 +++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Documentation/cputopology.txt b/Documentation/cputopology.txt index 2698da7e4f49..287213b4517b 100644 --- a/Documentation/cputopology.txt +++ b/Documentation/cputopology.txt @@ -12,6 +12,12 @@ physical_package_id: socket number, but the actual value is architecture and platform dependent. +die_id: + + the CPU die ID of cpuX. Typically it is the hardware platform's + identifier (rather than the kernel's). The actual value is + architecture and platform dependent. + core_id: the CPU core ID of cpuX. Typically it is the hardware platform's @@ -43,12 +49,12 @@ thread_siblings_list: core_siblings: internal kernel map of cpuX's hardware threads within the same - physical_package_id. + die_id. core_siblings_list: human-readable list of cpuX's hardware threads within the same - physical_package_id. + die_id. book_siblings: diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h index 453cf38a1c33..281be6bbc80d 100644 --- a/arch/x86/include/asm/topology.h +++ b/arch/x86/include/asm/topology.h @@ -106,6 +106,7 @@ extern const struct cpumask *cpu_coregroup_mask(int cpu); #define topology_logical_package_id(cpu) (cpu_data(cpu).logical_proc_id) #define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id) +#define topology_die_id(cpu) (cpu_data(cpu).cpu_die_id) #define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id) #ifdef CONFIG_SMP diff --git a/drivers/base/topology.c b/drivers/base/topology.c index 5fd9f167ecc1..50352cf96f85 100644 --- a/drivers/base/topology.c +++ b/drivers/base/topology.c @@ -43,6 +43,9 @@ static ssize_t name##_list_show(struct device *dev, \ define_id_show_func(physical_package_id); static DEVICE_ATTR_RO(physical_package_id); +define_id_show_func(die_id); +static DEVICE_ATTR_RO(die_id); + define_id_show_func(core_id); static DEVICE_ATTR_RO(core_id); @@ -72,6 +75,7 @@ static DEVICE_ATTR_RO(drawer_siblings_list); static struct attribute *default_attrs[] = { &dev_attr_physical_package_id.attr, + &dev_attr_die_id.attr, &dev_attr_core_id.attr, &dev_attr_thread_siblings.attr, &dev_attr_thread_siblings_list.attr, diff --git a/include/linux/topology.h b/include/linux/topology.h index cb0775e1ee4b..5cc8595dd0e4 100644 --- a/include/linux/topology.h +++ b/include/linux/topology.h @@ -184,6 +184,9 @@ static inline int cpu_to_mem(int cpu) #ifndef topology_physical_package_id #define topology_physical_package_id(cpu) ((void)(cpu), -1) #endif +#ifndef topology_die_id +#define topology_die_id(cpu) ((void)(cpu), -1) +#endif #ifndef topology_core_id #define topology_core_id(cpu) ((void)(cpu), 0) #endif -- 2.18.0-rc0