Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1953659rwb; Thu, 17 Nov 2022 04:41:08 -0800 (PST) X-Google-Smtp-Source: AA0mqf4fZ3XPvQhO3fMd3X1yNKgxKB9XZ7Tj1TXG0kkB+qnOeYEL61GS851VRLLdwPowav9fxx/O X-Received: by 2002:a17:90b:154:b0:213:cb7e:ee9d with SMTP id em20-20020a17090b015400b00213cb7eee9dmr8528744pjb.101.1668688867882; Thu, 17 Nov 2022 04:41:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668688867; cv=none; d=google.com; s=arc-20160816; b=ePcuLRxC3xWmj1o1m3xAN4V0OI1iVQJ/H81XZTw6ExXZMWydRBZU0d2Fkesi/3aJB4 aLZjbxz/4j+2BGFpBFMeqzXART9iW0VghNUgTLAbcvoYf9/X2s8G3pB3d/Xo4VfyefmP EOLC+MK8GY7DixCPwabGtMyie8BX8KwqB3HoofBYc9YgfjGRJv8wvV+3OLGMBBNuqrQK 0Trg/YBOs0zi3frOsIaQWHq9rVtYcu/ojYs3gRf5uBK7CYfBlz3s7Lo5mqsUPlxSXEzB VcbXgjxr4bKN739s8FdKOnLeBUYdFrYhc4ByrSjYGhToNpMoOFEDMeppq1Df/p0Og+5X CG5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=5OMrdULrDmUEUs3WWh6HgPF+vXupsya08Nmoocats04=; b=bHg1wkEm/sHgGDBpn4rvae7Tz7DnuEpbSOcYA20vulPgwwGlboFY090RnT6vIyIEsX kiMDUTFmstcAYoj2RbuJLPt6XqSvuvG4W+3R5UxO0239jaeQsgfDAynFdLRzKx30KNT1 D1Zv5StvqAQQ23yZriXYGiLoWiebDkaKmpELCzUXhGL13DR6TZJF+7Iy5YG0zJY3FbIe e9JFDyYJZWa1h5ePidU7Hdgh6m2HxlTJYJhKQIIZl/TSOEflBKnoditJRvFTpmMc2Hn+ h/spAq4bxUA+8EjeA3kK5XTob3UryXbX/mUj7RryRAUjSvaDLSahIj/3XBX5Tbym+1Tn kz2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LuHt3y6t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h21-20020a632115000000b0044fb27b64c7si931196pgh.326.2022.11.17.04.40.56; Thu, 17 Nov 2022 04:41:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LuHt3y6t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234609AbiKQM30 (ORCPT + 92 others); Thu, 17 Nov 2022 07:29:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239767AbiKQM3B (ORCPT ); Thu, 17 Nov 2022 07:29:01 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44CD871F27 for ; Thu, 17 Nov 2022 04:28:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668688127; x=1700224127; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=DtN4CkXkt6eq5LzrsmnWO65yn0Pr82pVWRG0Hofj8BI=; b=LuHt3y6tyG4ZqnmAmTIJiVtJOxXtvjv1cV7KX1a5hAhlb5l/RjhomErS GG8r+1GWhGo1hY8q3Ez2vK/od7eKvMH4SMNm2uoPhEiIn+OSi3H9wenww QOpPRcExiYpjBmcIAr+02Mb3qCJwyLB+lbLC8GEb08knq27ZGnZrhR135 bpZwYuB/oGRCqfy2Wf8+Hn5h8esHdmiLCLcW7Nz+vNvSC/AGjmsBK0RsN X+XnugG7JLxWnmfFzmiAHTVg+QsUvKPblBnAI2eNHV/wAdSIWIDb8V1z7 lQ5OrmJclV7VQfC6l4edq2h0r8V0Wj2SQOGR3mN97qCWNB4XOnfwS4u+T Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10533"; a="296199865" X-IronPort-AV: E=Sophos;i="5.96,171,1665471600"; d="scan'208";a="296199865" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2022 04:28:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10533"; a="590604550" X-IronPort-AV: E=Sophos;i="5.96,171,1665471600"; d="scan'208";a="590604550" Received: from jfdev013vml03.jf.intel.com ([10.23.26.52]) by orsmga003.jf.intel.com with ESMTP; 17 Nov 2022 04:28:46 -0800 From: alexander.antonov@linux.intel.com To: peterz@infradead.org, linux-kernel@vger.kernel.org Cc: kan.liang@linux.intel.com, alexey.v.bayduraev@linux.intel.com, alexander.antonov@linux.intel.com Subject: [PATCH 00/11] UPI topology discovery for SKX/ICX/SPR Date: Thu, 17 Nov 2022 12:28:22 +0000 Message-Id: <20221117122833.3103580-1-alexander.antonov@linux.intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander Antonov Starting with the Intel Xeon Scalable family, Intel processors use a coherent interconnect for scaling to multiple sockets, known as Intel Ultra Path Interconnect (Intel UPI). The Intel UPI technology provides a cache-coherent socket-to-socket external communication interface between processors. Unfortunately, users have little idea on how sockets are connected to each other. This patchset extends the current mapping implementation by adding sysfs attributes for UPI PMON blocks in the same manner as was done for IIO blocks. These attributes reveal the topology of the system by showing which how sockets and UPI controllers are connected to each other. Example for a 4-socket Sapphire Rapids server: # tail /sys/devices/uncore_upi_*/die* ==> /sys/devices/uncore_upi_0/die0 <== upi_1,die_1 ==> /sys/devices/uncore_upi_0/die1 <== upi_0,die_3 ==> /sys/devices/uncore_upi_0/die2 <== upi_1,die_3 ==> /sys/devices/uncore_upi_0/die3 <== upi_0,die_1 ==> /sys/devices/uncore_upi_1/die0 <== upi_1,die_2 ==> /sys/devices/uncore_upi_1/die1 <== upi_0,die_0 ==> /sys/devices/uncore_upi_1/die2 <== upi_1,die_0 ==> /sys/devices/uncore_upi_1/die3 <== upi_0,die_2 ==> /sys/devices/uncore_upi_2/die0 <== upi_2,die_3 ==> /sys/devices/uncore_upi_2/die1 <== upi_2,die_2 ==> /sys/devices/uncore_upi_2/die2 <== upi_2,die_1 ==> /sys/devices/uncore_upi_2/die3 <== upi_2,die_0 The following output: # cat /sys/devices/uncore_upi_X/dieY upi_Z,die_W means that UPI link number X on die Y is connected to UPI link Z on die W. Changes are splitted into two separate parts: 1. kernel part - adds and fills new sysfs attributes for UPI PMON blocks 2. perf-tool part - enables UPI topology info and per-link UPI metrics for 'perf iostat' mode. See example below. The 'perf iostat list' will be extend to show IIO and UPI mappings, for example: # perf iostat list S0-uncore_iio_0<0000:00> S1-uncore_iio_0<0000:80> S0-uncore_iio_1<0000:17> S1-uncore_iio_1<0000:85> S0-uncore_iio_2<0000:3a> S1-uncore_iio_2<0000:ae> S0-uncore_iio_3<0000:5d> S1-uncore_iio_3<0000:d7> UPI Link 0 on Socket 0 -> UPI Link 1 on Socket 1 UPI Link 0 on Socket 1 -> UPI Link 1 on Socket 0 UPI Link 1 on Socket 0 -> UPI Link 0 on Socket 1 UPI Link 1 on Socket 1 -> UPI Link 0 on Socket 0 The 'perf iostat upi' mode will be added to show per-link UPI metrics: # perf iostat upi link Outgoing Data(GB) Outgoing Non-Data(GB) UPI Link 0 on Socket 0 -> UPI Link 1 on Socket 1 0 0 UPI Link 0 on Socket 1 -> UPI Link 1 on Socket 0 0 0 UPI Link 1 on Socket 0 -> UPI Link 0 on Socket 1 0 0 UPI Link 1 on Socket 1 -> UPI Link 0 on Socket 0 0 0 1.437023089 seconds time elapsed Alexander Antonov (11): perf/x86/intel/uncore: Generalize IIO topology support perf/x86/intel/uncore: Introduce UPI topology type perf/x86/intel/uncore: Clear attr_update properly perf/x86/intel/uncore: Disable I/O stacks to PMU mapping on ICX-D perf/x86/intel/uncore: Generalize get_topology() for SKX PMUs perf/x86/intel/uncore: Enable UPI topology discovery for Skylake Server perf/x86/intel/uncore: Get UPI NodeID and GroupID perf/x86/intel/uncore: Enable UPI topology discovery for Icelake Server perf/x86/intel/uncore: Enable UPI topology discovery for Sapphire Rapids perf/x86/intel/uncore: Update sysfs-devices-mapping file perf/x86/intel/uncore: Make set_mapping() procedure void .../ABI/testing/sysfs-devices-mapping | 30 +- arch/x86/events/intel/uncore.h | 24 +- arch/x86/events/intel/uncore_snbep.c | 492 +++++++++++++++--- 3 files changed, 480 insertions(+), 66 deletions(-) base-commit: ee6050c8af96bba2f81e8b0793a1fc2f998fcd20 -- 2.25.1