Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp304990ybg; Mon, 1 Jun 2020 01:37:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzd+0gOtaGrf+IKPVwYPWr5+jMYpknCXyaKAo1Nu4MMQu4Bd2YXFr7zfQd7OSk709m8TNJ5 X-Received: by 2002:aa7:d98f:: with SMTP id u15mr20157011eds.42.1591000677788; Mon, 01 Jun 2020 01:37:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591000677; cv=none; d=google.com; s=arc-20160816; b=jdR/xTBUo1sVmVE9XR1v62fXo28B2ghN7XCXLGe0JPy0mwRlgT9FFOOUfSSd8TVo9T XfFvkkE09JFzMFaYZAcXka9yxvyrvUoyOLX+H5F1kiCntzDmMYbkU7vvSGjPouOn5tx9 1q49eu1VTv34jKPmi+jTmMLZ0WW//ZFFU98+Dbhvymah0HaDcN3C2CSLF4JWQtxP7MNj GJIjaC6ZY99eFwRP+g0ntwVsDfi0XFNDcgW0r69AXaBAngWXuTXe/ZqRuo506/ezUBhK uhn3iMPI6avji87Fr1RzbUn64m9uOE8anmzLk/SMgYa/B4scblmGD+Kml8rAZlfMRwgN onbA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=+1mi6uNajr3rc4sHd+WcdHqMYmI7MKkW1ACOIkmHapM=; b=WHUqTtia6f02v55jUw1SAfRgGUn5gxnPdvd4pM+xWFm3wabRh7d6W/yUSHYw62deiT VYnEAqIS9QdJQR++5jIJMFfGO+deX2ITfwNzN36KtxlMeB6/ta98Kj9PrARogbhs1a9P /7wKCPjCSZe4MxDBQQ0IDbkbp9UWotbWU/6OUO/HConlvI6KArd/hapdwzxWPt+9E5q/ lID1prXy8JZw12btiVXwQdtZTdXMlm1bTLEw5eUWKjI0LUtEpPDyazrZUK/CmwcyqVpm vKe3Z7T8TlnxNQVdKhQdepnzybX2fZQqdPHg5OngK9jLN31DgD4RU8RXIvT/Tixr2kPi S5sQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id c17si10397023ejn.336.2020.06.01.01.37.35; Mon, 01 Jun 2020 01:37:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1728266AbgFAIfx (ORCPT + 99 others); Mon, 1 Jun 2020 04:35:53 -0400 Received: from mga06.intel.com ([134.134.136.31]:62255 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726142AbgFAIfw (ORCPT ); Mon, 1 Jun 2020 04:35:52 -0400 IronPort-SDR: +EQeT4bL+7vSHYc5xquIjr3kndxE3TQt9e6g+ia9x9taq4Gk7jCkrIsDjunVUh/6A3K6Pw5jmm ukXNueiGg5MQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2020 01:35:51 -0700 IronPort-SDR: c3+Op6Jb8jbeZi7UgNe1c78ZH//v+gWcy3mTLXdEsAPGrcibsPe2S6+Q0xRBaM4miDioJLJqG0 RQcvliMaDtbg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,460,1583222400"; d="scan'208";a="303565663" Received: from nntpdsd52-183.inn.intel.com ([10.125.52.183]) by fmsmga002.fm.intel.com with ESMTP; 01 Jun 2020 01:35:47 -0700 From: alexander.antonov@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, lkp@intel.com Cc: alexander.antonov@linux.intel.com Subject: [PATCH v10 1/3] perf/x86/intel/uncore: Expose an Uncore unit to PMON mapping Date: Mon, 1 Jun 2020 11:35:41 +0300 Message-Id: <20200601083543.30011-2-alexander.antonov@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20200601083543.30011-1-alexander.antonov@linux.intel.com> References: <20200601083543.30011-1-alexander.antonov@linux.intel.com> 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 Each Uncore unit type, by its nature, can be mapped to its own context - which platform component each PMON block of that type is supposed to monitor. 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. Usage example: ls /sys/devices/uncore__/die* Co-developed-by: Alexander Antonov Signed-off-by: Alexander Antonov Signed-off-by: Roman Sudarikov Reviewed-by: Kan Liang Reviewed-by: Alexander Shishkin --- arch/x86/events/intel/uncore.c | 8 ++++++++ arch/x86/events/intel/uncore.h | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c index cf76d6631afa..b71e8f7529a4 100644 --- a/arch/x86/events/intel/uncore.c +++ b/arch/x86/events/intel/uncore.c @@ -843,10 +843,12 @@ static int uncore_pmu_register(struct intel_uncore_pmu *pmu) .read = uncore_pmu_event_read, .module = THIS_MODULE, .capabilities = PERF_PMU_CAP_NO_EXCLUDE, + .attr_update = pmu->type->attr_update, }; } else { pmu->pmu = *pmu->type->pmu; pmu->pmu.attr_groups = pmu->type->attr_groups; + pmu->pmu.attr_update = pmu->type->attr_update; } if (pmu->type->num_boxes == 1) { @@ -887,6 +889,9 @@ static void uncore_type_exit(struct intel_uncore_type *type) struct intel_uncore_pmu *pmu = type->pmus; int i; + if (type->cleanup_mapping) + type->cleanup_mapping(type); + if (pmu) { for (i = 0; i < type->num_boxes; i++, pmu++) { uncore_pmu_unregister(pmu); @@ -954,6 +959,9 @@ static int __init uncore_type_init(struct intel_uncore_type *type, bool setid) type->pmu_group = &uncore_pmu_attr_group; + if (type->set_mapping) + type->set_mapping(type); + return 0; err: diff --git a/arch/x86/events/intel/uncore.h b/arch/x86/events/intel/uncore.h index 0da4a4605536..8f2b77d27513 100644 --- a/arch/x86/events/intel/uncore.h +++ b/arch/x86/events/intel/uncore.h @@ -72,7 +72,19 @@ struct intel_uncore_type { struct uncore_event_desc *event_descs; struct freerunning_counters *freerunning; const struct attribute_group *attr_groups[4]; + const struct attribute_group **attr_update; struct pmu *pmu; /* for custom pmu ops */ + /* + * Uncore PMU would store relevant platform topology configuration here + * to identify which platform component each PMON block of that type is + * supposed to monitor. + */ + u64 *topology; + /* + * Optional callbacks for managing mapping of Uncore units to PMONs + */ + int (*set_mapping)(struct intel_uncore_type *type); + void (*cleanup_mapping)(struct intel_uncore_type *type); }; #define pmu_group attr_groups[0] -- 2.19.1