Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4417911ybc; Tue, 26 Nov 2019 08:38:04 -0800 (PST) X-Google-Smtp-Source: APXvYqwYox3eLIT8PIaifISMcdE0B55Aw4J3YKadX+BtBoS0llCwlWAx2RJlRbQ5K4TDu7T9PCAI X-Received: by 2002:a50:b6e1:: with SMTP id f30mr26174011ede.212.1574786284536; Tue, 26 Nov 2019 08:38:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574786284; cv=none; d=google.com; s=arc-20160816; b=A3gnBnwLxINCIsvUpk62vIFTD6eovTuQElTjIq/fj72xAN10JNEHwpx7FQ3mQiwpfE 2cWx7Fk1R58sbuD1WqbbQHSssotO/V8LTFvCsLaHAAfveFrdvHaEuQHAH2bNc3IZbuOA k2ZaMzXiLyfxzWAcy1bO7qlYLnn8+e4bwuz3TKvbyP7244Ik1UjNzM/mohL6nECuhyY4 KDvOixZjTs/nMW/l9qLtH7TOajaEoJibWxt5LI++uGw3YG+T6xCyylT2jIM+b99lWhTy H9IBzGADQKBZCo0xN/6fwOePxcuC34ZQLWQ7IwDxhQRoS+9dlVU2OJnmN22rTL0IOek2 dm6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=5yIZvvfihg85BA1VzafJEs9+NkDkAfBg+/T1rpFCwHE=; b=T1DL3rW5MN0OzSsvszMcyXbn9ZUwG+0twsUlYtFuK+B8Zohwhq025EGpTgojKX5Tk7 IDdnzdb37SfuG8/ako0tFcS9oTKt1ZUZG33Abnf5ldnftpcqCRDal0VX2UMJFmU8rtAZ Ou2VBFkfTBRQHghNZcpOvgOOEaoJqlPB4F18zNSmeiNfGvHG4QsNENcypYJ4fVsfPq8+ AaOy+WHiBVH/vCmv1bLHt7gSEeG10I/cu2ukl0UIdf6s9aIfoHt2LBHnwEOpUNK75gvD Fr9octVAOXxH37VyFl/yP+kNZYZfVFQS+p08g2Fi7qCRUVcdFf7n7SHmnDAS4bCUrMvY /2Gw== ARC-Authentication-Results: i=1; mx.google.com; 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c44si8118671ede.398.2019.11.26.08.37.40; Tue, 26 Nov 2019 08:38:04 -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; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727925AbfKZQgg (ORCPT + 99 others); Tue, 26 Nov 2019 11:36:36 -0500 Received: from mga05.intel.com ([192.55.52.43]:53760 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725995AbfKZQgf (ORCPT ); Tue, 26 Nov 2019 11:36:35 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Nov 2019 08:36:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,246,1571727600"; d="scan'208";a="359212403" Received: from nntpdsd52-183.inn.intel.com ([10.125.52.183]) by orsmga004.jf.intel.com with ESMTP; 26 Nov 2019 08:36:31 -0800 From: roman.sudarikov@linux.intel.com To: peterz@infradead.org, mingo@redhat.com, acme@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, linux-kernel@vger.kernel.org, eranian@google.com, bgregg@netflix.com, ak@linux.intel.com, kan.liang@linux.intel.com Cc: alexander.antonov@intel.com, roman.sudarikov@linux.intel.com Subject: [PATCH 0/6] perf x86: Exposing IO stack to IO PMON mapping through sysfs Date: Tue, 26 Nov 2019 19:36:24 +0300 Message-Id: <20191126163630.17300-1-roman.sudarikov@linux.intel.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Roman Sudarikov Intel® Xeon® Scalable processor family (code name Skylake-SP) makes significant changes in the integrated I/O (IIO) architecture. The new solution introduces IIO stacks which are responsible for managing traffic between the PCIe domain and the Mesh domain. Each IIO stack has its own PMON block and can handle either DMI port, x16 PCIe root port, MCP-Link or various built-in accelerators. IIO PMON blocks allow concurrent monitoring of I/O flows up to 4 x4 bifurcation within each IIO stack. Software is supposed to program required perf counters within each IIO stack and gather performance data. The tricky thing here is that IIO PMON reports data per IIO stack but users have no idea what IIO stacks are - they only know devices which are connected to the platform. Understanding IIO stack concept to find which IIO stack that particular IO device is connected to, or to identify an IIO PMON block to program for monitoring specific IIO stack assumes a lot of implicit knowledge about given Intel server platform architecture. This patch set introduces: An infrastructure for exposing an Uncore unit to Uncore PMON mapping through sysfs-backend A new --iiostat mode in perf stat to provide I/O performance metrics per I/O device Usage examples: 1. List all devices below IIO stacks ./perf stat --iiostat=show Sample output w/o libpci: S0-RootPort0-uncore_iio_0<00:00.0> S1-RootPort0-uncore_iio_0<81:00.0> S0-RootPort1-uncore_iio_1<18:00.0> S1-RootPort1-uncore_iio_1<86:00.0> S1-RootPort1-uncore_iio_1<88:00.0> S0-RootPort2-uncore_iio_2<3d:00.0> S1-RootPort2-uncore_iio_2 S1-RootPort3-uncore_iio_3 Sample output with libpci: S0-RootPort0-uncore_iio_0<00:00.0 Sky Lake-E DMI3 Registers> S1-RootPort0-uncore_iio_0<81:00.0 Ethernet Controller X710 for 10GbE SFP+> S0-RootPort1-uncore_iio_1<18:00.0 Omni-Path HFI Silicon 100 Series [discrete]> S1-RootPort1-uncore_iio_1<86:00.0 Ethernet Controller XL710 for 40GbE QSFP+> S1-RootPort1-uncore_iio_1<88:00.0 Ethernet Controller XL710 for 40GbE QSFP+> S0-RootPort2-uncore_iio_2<3d:00.0 Ethernet Connection X722 for 10GBASE-T> S1-RootPort2-uncore_iio_2 S1-RootPort3-uncore_iio_3 2. Collect metrics for all I/O devices below IIO stack ./perf stat --iiostat -- dd if=/dev/zero of=/dev/nvme0n1 bs=1M oflag=direct 357708+0 records in 357707+0 records out 375083606016 bytes (375 GB, 349 GiB) copied, 215.381 s, 1.7 GB/s Performance counter stats for 'system wide': device Inbound Read(MB) Inbound Write(MB) Outbound Read(MB) Outbound Write(MB) 00:00.0 0 0 0 0 81:00.0 0 0 0 0 18:00.0 0 0 0 0 86:00.0 0 0 0 0 88:00.0 0 0 0 0 3b:00.0 3 0 0 0 3c:03.0 3 0 0 0 3d:00.0 3 0 0 0 af:00.0 0 0 0 0 da:00.0 358559 44 0 22 215.383783574 seconds time elapsed 3. Collect metrics for comma separted list of I/O devices ./perf stat --iiostat=da:00.0 -- dd if=/dev/zero of=/dev/nvme0n1 bs=1M oflag=direct 381555+0 records in 381554+0 records out 400088457216 bytes (400 GB, 373 GiB) copied, 374.044 s, 1.1 GB/s Performance counter stats for 'system wide': device Inbound Read(MB) Inbound Write(MB) Outbound Read(MB) Outbound Write(MB) da:00.0 382462 47 0 23 374.045775505 seconds time elapsed Roman Sudarikov (6): perf x86: Infrastructure for exposing an Uncore unit to PMON mapping perf tools: Helper functions to enumerate and probe PCI devices perf stat: Helper functions for list of IIO devices perf stat: New --iiostat mode to provide I/O performance metrics perf tools: Add feature check for libpci perf stat: Add PCI device name to --iiostat output arch/x86/events/intel/uncore.c | 61 +- arch/x86/events/intel/uncore.h | 13 +- arch/x86/events/intel/uncore_snbep.c | 144 ++++ tools/build/Makefile.feature | 2 + tools/build/feature/Makefile | 4 + tools/build/feature/test-all.c | 5 + tools/build/feature/test-libpci.c | 10 + tools/perf/Documentation/perf-stat.txt | 12 + tools/perf/Makefile.config | 10 + tools/perf/arch/x86/util/Build | 1 + tools/perf/arch/x86/util/iiostat.c | 718 ++++++++++++++++++ tools/perf/builtin-stat.c | 32 +- tools/perf/builtin-version.c | 1 + tools/perf/tests/make | 1 + tools/perf/util/Build | 1 + tools/perf/util/evsel.h | 1 + tools/perf/util/iiostat.h | 35 + tools/perf/util/pci.c | 99 +++ tools/perf/util/pci.h | 27 + .../scripting-engines/trace-event-python.c | 2 +- tools/perf/util/stat-display.c | 53 +- tools/perf/util/stat-shadow.c | 12 +- tools/perf/util/stat.c | 3 +- tools/perf/util/stat.h | 2 + 24 files changed, 1237 insertions(+), 12 deletions(-) create mode 100644 tools/build/feature/test-libpci.c create mode 100644 tools/perf/arch/x86/util/iiostat.c create mode 100644 tools/perf/util/iiostat.h create mode 100644 tools/perf/util/pci.c create mode 100644 tools/perf/util/pci.h base-commit: 219d54332a09e8d8741c1e1982f5eae56099de85 -- 2.19.1