Received: by 2002:ab2:715a:0:b0:1fd:c064:50c with SMTP id l26csp79213lqm; Mon, 10 Jun 2024 13:18:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXokbA5Iy9LTavtRjpcdcxF4AbFTPsNYB50LEAYTNXqItnokUXymqRrOHSA8cu1fvsHs+JTiss2i45k2Zc84TWY7DS5iIYkICqnMBLP0w== X-Google-Smtp-Source: AGHT+IFkw6DPbDr5knP0JJSgSnRvEiyVUZ1NIh93GiI1wu1RqtbZDS1wpGLQURj8vTMQB96D6qKX X-Received: by 2002:a05:6358:c00f:b0:17f:6b3f:1b0a with SMTP id e5c5f4694b2df-19f1fe6649cmr1388945455d.15.1718050686194; Mon, 10 Jun 2024 13:18:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718050686; cv=pass; d=google.com; s=arc-20160816; b=enRj/hLTF42RdDVHRTXiaJBSOlEM+VgrldyHRFCd00yYkrrJ+pQ8auPfetdaghZNqS TV9afStb/viOGpskVvfE0bUofB4SXgMll48t8U+5tjXks4zObpZlOm7DkSqLGYSYmR5t CMw4WxwNo4rh+OVwD5PWEoDFEAPI1hT2uM0hoCGRZaffCJziwr0D+yy3BMAHwphu6uo1 s5g3ytrJKj6PsTM2xPnO0QgmCtKpvuzD9f1b1X+3UcJhpxcu/HpkvQ9VouGEi9NZSmuN ehIR6/xX801zf31YwjcFPGYDHclhGghlNNMUaYJWkOW5PyzneeWUNQCz/HudTkIYJEKt 8Z7Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=cLmp+eCaHc5T8SIJCROIfTUp6uT+XJ0If/SoMffxHCc=; fh=t8PCxyR+qT0Nfk8VGk3BF8Qwoax2ycHp2O6dm1yrDi8=; b=NvieDQV9eiSlYuHoCn/wy3Ag7m3PM3tJGbnO8CNKW31WE8PYq5NC+yJSpQkKASY6Lg wzoCl+ZR23f4vFZPZv/URHYJ3JU9cuJoDeuI/q8/dP9OR7VxwnK2dW9uzXLdIVrUMaoT dFEoheqqFdZFGQWOYVcYooP2D1i9PfXg0hT88Qf/S/6uVtDNRGkNaTR47rb0dZqDRTFB cZoUjAKzDAT9mN6ItiP8FJ4MbUGEtsHv3ypXpM+8XRqSukBTC5CzujOXQ0ZeWC2hQwbt FBqDpKgYThgOd+2QjjwxsCKMIqd7hEg6UuTE3qLLeROVuLZXwKDbVZl/um5TrtV5LSXn VDxA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ga4HRyK4; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-208845-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208845-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6e52bd4133dsi5402505a12.485.2024.06.10.13.18.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 13:18:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208845-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ga4HRyK4; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-208845-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208845-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C6CA4283232 for ; Mon, 10 Jun 2024 20:18:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4AF6947779; Mon, 10 Jun 2024 20:17:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ga4HRyK4" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F1B1818C36 for ; Mon, 10 Jun 2024 20:17:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718050672; cv=none; b=Ei9wwznHrbCHelIMwj7Uen+yQwXugyZz043FQVAN5RW+OrxkVJZC8ZlStLGlEUKiJFEcHFgS3SF380j4iONJ6F4TiUJv+feEmb3lULzMe4PpKsz0YHo63ok3uMBd2OjeMBe0tOPx93lpzRcrNcaUbvmt4AIEyY/p+CagK8FPIbw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718050672; c=relaxed/simple; bh=AYTpGtiiDl/GWww+5fNx+6OoZbf8us7Cx62MMH1msxo=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=WBya2UMzKA2Z/v5I/dpGaNoXFjeMKJnFnO+12dpbHmU40EchHdrTvGKMV1I67VmnGS2LNG9nsNQlKEEDQ8RrOA97dV3ZNjv7QBmjED0Dd5O9hYcK8+rhSFGl0HaIDwgYuNmGwk5crlMHz/yasqncYg8q4lmyahDgqQ0XoRjaQLY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ga4HRyK4; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718050671; x=1749586671; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=AYTpGtiiDl/GWww+5fNx+6OoZbf8us7Cx62MMH1msxo=; b=ga4HRyK493bSKGdqOf0+eoyzGVwoB/Jg8hZmJfbHNFNcvtBs6ZnKyyBK SxFt4oMOrdYCpAMs+ljm8YUFEF9LYuJdRYegDgvmBUEYiDV4TCGTGD2VQ VagumTpL+HMMQr7YRg4p4Clr+xydHP4PGQkblMbM0Rp03Ps5m1L020jFh CPigw5r97mQEg1ndrN56+MF+/a3HnEGpoceETcnHSqpRhrffXWxdwcDIk sNYNybenl+qMBu9ZceL7nTeSqT/WJpADxOhg21l3LEKanUJ8aA+prSG2p a2TzHgptmudDPofznxAD8bkOop6TTFUmPde8Npk4YuxhfDXR6lVSlI7oB A==; X-CSE-ConnectionGUID: BMj2fPBoT1Os15aaPhvSyA== X-CSE-MsgGUID: dmErzIqESliBgpnCtJAUzw== X-IronPort-AV: E=McAfee;i="6600,9927,11099"; a="18561502" X-IronPort-AV: E=Sophos;i="6.08,227,1712646000"; d="scan'208";a="18561502" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jun 2024 13:17:50 -0700 X-CSE-ConnectionGUID: EeidUscLSGCAm76zB+afAQ== X-CSE-MsgGUID: EvCfPsOvSZm3tXus72jHDQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,227,1712646000"; d="scan'208";a="39169064" Received: from kanliang-dev.jf.intel.com ([10.165.154.102]) by fmviesa008.fm.intel.com with ESMTP; 10 Jun 2024 13:17:49 -0700 From: kan.liang@linux.intel.com To: peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org Cc: acme@kernel.org, namhyung@kernel.org, irogers@google.com, eranian@google.com, ak@linux.intel.com, yunying.sun@intel.com, Kan Liang Subject: [PATCH 0/8] Support HBM and CXL PMON uncore counters Date: Mon, 10 Jun 2024 13:16:11 -0700 Message-Id: <20240610201619.884021-1-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.35.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Kan Liang The uncore PMON information of both HBM and CXL can be retrieved from the discovery table. However, the CXL entries break the driver's assumption for the discovery table. The first 7 patches update the generic support of the discovery table. The last patch enables the HBM and CXL PMON uncore counters. The discovery table support was introduced since commit edae1f06c2cd ("perf/x86/intel/uncore: Parse uncore discovery tables"). It's a self-describing mechanism for the uncore PerfMon hardware. By reading through an MMIO page worth of information, SW can ‘discover’ all the standard uncore PMON registers. The entire discovery table could be big and contain duplicate information. To save space, the perf uncore driver only stores some key data. Others are calculated from the key data. The driver further assumes that the uncore PMON units are symmetric among dies. So only the unit control addresses on Die 0 are completely stored. The addresses on other Dies can be calculated via the address of the first entry on the Die + a fixed offset. However, it doesn't work for the CXL PMON units. The CXL PMON units could be asymmetric among Dies. The offset between CXL PMON units may be different on different Die. To address the issue, the complete unit control addresses for all Dies are stored in an RB tree. For a 2-socket EMR, it requires at most ~6KB extra space, which should be acceptable. Kan Liang (8): perf/x86/uncore: Save the unit control address of all units perf/x86/uncore: Support per PMU cpumask perf/x86/uncore: Retrieve the unit ID from the unit control RB tree perf/x86/uncore: Apply the unit control RB tree to MMIO uncore units perf/x86/uncore: Apply the unit control RB tree to MSR uncore units perf/x86/uncore: Apply the unit control RB tree to PCI uncore units perf/x86/uncore: Cleanup unused unit structure perf/x86/intel/uncore: Support HBM and CXL PMON counters arch/x86/events/intel/uncore.c | 97 ++++--- arch/x86/events/intel/uncore.h | 8 +- arch/x86/events/intel/uncore_discovery.c | 306 +++++++++++++++-------- arch/x86/events/intel/uncore_discovery.h | 22 +- arch/x86/events/intel/uncore_snbep.c | 128 ++++++++-- 5 files changed, 388 insertions(+), 173 deletions(-) -- 2.35.1