Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp822392lqs; Fri, 14 Jun 2024 06:47:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVldh+PvO8F/ptBsWrmLvUhRDSUYi/5sqoUXQ5IQr5XeOcZQMRibwVAkYZ0z64mDFF/iPoVwwLOVbPZvnkrGh46JdCVWt45NrYMJs4gMw== X-Google-Smtp-Source: AGHT+IFh7xpsc9wufrjj8mgmXCy9HoZKrvZEd+pOPe5ivsqZcqWL65raQ11BKFDKdG2H7kfurYkF X-Received: by 2002:a05:620a:28cc:b0:795:eb86:af7f with SMTP id af79cd13be357-798d23fb7e0mr297603985a.1.1718372879332; Fri, 14 Jun 2024 06:47:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718372879; cv=pass; d=google.com; s=arc-20160816; b=HECNeoUZnNReuujTqivnscJKk4CsUDYNAv+3oLL0L3OCDtADBnBYxL0piDU9rYXg6Y Fm7MpG9cPEoULg1s3OY2baGGckBMSNt7BRQq9fgJ6td8aNxlMVmDiWJkMEYiiiznu1t2 AAWShGxCd5UgCJMggNJfqhDPjESxTe8yGdJKe1/LU53gSA4NGF3id445Fg1V20qovctB FlqHVrUI0GgXhOHeHM+pHR1nFclzI7IZqEr5ZTmWkZElnD6hI0nbDDKUGtQYMILJ5OqS L3FceGbUfcYJ1b0ykfgC/fKA+/htx0wvN03wZXd7Dn3cJPOiyVWZY3YEBFRdsHmO66O9 Zggw== 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=V16nPUzv2M20DjN8XrHyRNcpUgapkw2s16RAkSFishg=; fh=5JoQxhsJbLMLJHjQe+sefb1k8QiuAwygiIvASzDsp2Y=; b=Dg8fp3/ekXfAfedtLI7JAodFQqTb15EM6TpcBgugd2t/fIYLywibSbVqs+X9j5Yy0L roajgyJgqiBhfw6QSIiaRUs1fS42b6uERzr1FXR1QEtJQQ+BQQ03oBwME7R3ak3PlW/c X45Cx04KYNa7ZJS7tiiS8kIFptkeBR5XniOltIqpSgozeRhzAcDk2bAX8+0X73zAba4P 88szMS94634AuLbQLCYHHEkmnRyVibetRqdjJZi6R5Q1qJiq5kvbSn4WrvFsAeBa3Xmd RRNiDAMPj9Ztv8/G+kyIbopEJ4AQdO6jGnYUdpHjdz6hjNguwRXguIByCbvbCSO2pFnI WMCA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KcElkRG1; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-214956-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214956-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-798aac9b942si372896085a.55.2024.06.14.06.47.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 06:47:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-214956-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KcElkRG1; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-214956-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214956-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id F20341C237D6 for ; Fri, 14 Jun 2024 13:47:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 669C379EA; Fri, 14 Jun 2024 13:47:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="KcElkRG1" 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 244787464 for ; Fri, 14 Jun 2024 13:47: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=1718372872; cv=none; b=DKYvV25fYcrJWOA29P12nXlWsrmYnsiqAYxhkTN1t99TZX261XXud9crNmZFRQYkY16jfTi7nsHoToUPAJ+LtYyIEw/ah5PKQaet//Ymm4quITJ+IEHE1mghI+enqGI0JceqG31QMyju6HZxI+g4gcH/48Lp1lt0Gm/cVUAUIKs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718372872; c=relaxed/simple; bh=X5lWuRC9cQCfM/Lx3VW6kbFigETvm9nUWQ204bvMWeE=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=mRPLIM9LF5ZGCjWiQFb6cwThFYUtPcBRJRuAyl2dodOmxVKKuQoBslD0fLn2wO9GeiTr/j6Mqz4fbqa0A2GmE62SFLz7jGngl9IYVoHPjamIpJXUj5NPKylCfJDXYojX8qiTGMMFt8JBXupoPBh5Vk716L6Jb307rKs2Bw0Rz3s= 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=KcElkRG1; 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=1718372872; x=1749908872; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=X5lWuRC9cQCfM/Lx3VW6kbFigETvm9nUWQ204bvMWeE=; b=KcElkRG1slineCGb5C1FM9YOxY/xOoHnUW5EWnI9X+5gtK40ddwgNgBz hUhFqNS7pDjDgfwPpubc9ZD/B2XY5ph7ZSiOKZ6pPHIUOi5lQMUEUlRp9 +pHsfbBMcfJG11rshEUZE2vuUzGtTu9jOCJgkp6DDUsGk9fO2uW3oQ1bR gstPaSPIORvrvwryN7CPyr5EnoG5rGVH4pa9it5a0wimWpdGMKaBGqcp5 lX2FklI75snSihDoUL+yzaIAucynWgf/uX+BKTDTx/09TMKG+U1uo2IUd odO25DxKPQ/m5oMPtllx4S38hU/igR7ykF+iDrS+btVNZ17CMnbeKSvth A==; X-CSE-ConnectionGUID: XgewpyPISG+3daMjBX7Onw== X-CSE-MsgGUID: nYdOF6ZVQvehnVedOX5c1w== X-IronPort-AV: E=McAfee;i="6700,10204,11103"; a="19079142" X-IronPort-AV: E=Sophos;i="6.08,237,1712646000"; d="scan'208";a="19079142" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2024 06:47:51 -0700 X-CSE-ConnectionGUID: Dvl8LunhQc++GEFUGFdTdg== X-CSE-MsgGUID: XosrriLTStKbB5UnHxAzbg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,237,1712646000"; d="scan'208";a="40386661" Received: from kanliang-dev.jf.intel.com ([10.165.154.102]) by fmviesa006.fm.intel.com with ESMTP; 14 Jun 2024 06:47:50 -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, tim.c.chen@linux.intel.com, Kan Liang Subject: [PATCH V2 0/8] Support HBM and CXL PMON uncore counters Date: Fri, 14 Jun 2024 06:46:23 -0700 Message-Id: <20240614134631.1092359-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 Changes since V2: - Update the description of patch 1 to explain the design of the new RB tree. (Tim) 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