Received: by 2002:ab2:715a:0:b0:1fd:c064:50c with SMTP id l26csp79486lqm; Mon, 10 Jun 2024 13:18:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX5F7JB5R8OhkbxqfSylLvYd5oPsPNmA37H3fUW+DjKHgSaFyOizWBJfeTZnSzyo07rIPc3jW2odRFzgXwanSJJoziWgY2YgNp3T56tIg== X-Google-Smtp-Source: AGHT+IGzjyVG769Z6N5b2vdIo55OKJoxNFuAoOrCCdLHtqZZH5p8fFBaVAcpHKOPawH5NUORxcOy X-Received: by 2002:a17:906:dfe5:b0:a6f:10d0:f3e0 with SMTP id a640c23a62f3a-a6f10d0f4d7mr352691766b.21.1718050722220; Mon, 10 Jun 2024 13:18:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718050722; cv=pass; d=google.com; s=arc-20160816; b=HHsSWCZH3YvL5gzc85t19v7pCDJWHw/aJZOpfK6d34qfUYeTwqq4G2r7uqCAX6Tsn9 GuK3Eod6tjMT4Vn5Ne4oerqCFDUymeN967UUtin3MzdFFEw7OFU/U7JDOwBKkhaaLKo2 prY5DIb48nYJyzesmsCOh7TKRr0JZQoYNTZOHyKJZGIZ9czH8JJeqFO53G3EPMbcR5JV Ef0r7veSJV+iiVWiflinwVOa6VAuT4FvFi4mVgGqcsuWywy1S0e4Ml/7GjYSOTKCVurK /GnytmeKdZI4tVEB2Zcd64cnCjqxOYbYcr+mDCY9SbfsXJYi/XfqAI505qAxKk7sr4GT 8+ow== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=LC15ZpknkjFwlNQFyCp8ENqIFDzpJ6zzvxG6U34hDwU=; fh=t8PCxyR+qT0Nfk8VGk3BF8Qwoax2ycHp2O6dm1yrDi8=; b=WJ2ttdfZdgatvbGX7s76FIKlio9h7NxDdXBd8PPNhUKa5KbBSglFOrrOPpNgnoidbV w3ej7SLZDIQ6p961qmfyli8nvQnz4KW0xY7Ijcng8FTzvj5I6HexWwkzQoto1Ib0/iPc n+CzqXD2wYpIWDn8tV7mKipSgMj7NgfJ8tiTOw4CCia0/mBM2g4gX5iStISACN8P/uVa 16RqAb5XOY+EweAFCLA+K4uJPxCjVtsTDR+A/sB5u3FtT2L2U5c2iD5JGOWHDI8KlfvU 269As2zqbxtPvM6inRNtQ12Zi5isNkE7r1+yKFwjFwAIs98QbSMqma7PIQn/JhlPjcYZ ZbMA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZWuWZPdl; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-208849-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208849-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f2d4a44b0si58487966b.415.2024.06.10.13.18.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 13:18:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208849-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZWuWZPdl; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-208849-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208849-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 am.mirrors.kernel.org (Postfix) with ESMTPS id EC0D21F220FB for ; Mon, 10 Jun 2024 20:18:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2DE1614E2DE; Mon, 10 Jun 2024 20:17:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ZWuWZPdl" 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 0359B4D8C5 for ; Mon, 10 Jun 2024 20:17:53 +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=1718050675; cv=none; b=DxS8DRYRQJldVPfEkfYyii+CcPXnS+152j0hmriaPfngq6faMpJfbcwCefUk5KEd3TjvPLDDMggikkV40W7QKSnZ+0OhQl+lFCorSFCOp8owZlwNuFe2oDILaS159tKYpCbjmL6Qq/Gw4hpy0Q0tsK2D7+H9CokqcKRLOLVSPZc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718050675; c=relaxed/simple; bh=Q+TO7WPwh47NG19W5uRxnauRQqMejPS2GM07LB24eWg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bAFlnp8i19/4CExn+SaKJnmds1CUFwfqbJSf3uMFoaou9pFFgQAcl0BpCToFcrHFfIb4lh6FA5QBbAP0x1ezwvltwuRRecNysikfQ2CwarIE7GZ2OQ/NgOZYJxwHhKZ/fI94PmLPRELvYhEVY52Q1KODRoY2hpUNpvIBYIZ0/cU= 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=ZWuWZPdl; 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=1718050674; x=1749586674; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Q+TO7WPwh47NG19W5uRxnauRQqMejPS2GM07LB24eWg=; b=ZWuWZPdlUWQ3C0vDmjRBTETYmnFRWi9MjIq0Z3n2oADK1aHMu+PiOmTu HNNRcRdD51HV2rGC+mdL6xWZl2Rej/t+Bh3lgEW5Bt5Dzjpuy04aecI77 WUucgmXgCdNUTDWA0NfWvMAlBYqtLlfKvBa/VHoDEt6hDeYxihmgp+R/9 G7RqN1RrVOMqlqqKJuL/skwZiBVHBeL8Apf3xtFLVV8jIxkrrCGT8rUTR RGzwxGqFC51yxEsROLTYJ4HArDm93VwKGBB/8FeJWwf8zEJgviXNJIp3/ ZVoyVNHtSEn/1wK49Gz/CDCESHBk4qug7J5u5DprvAYZ1rT7nm6PLTF6P A==; X-CSE-ConnectionGUID: jOxexuxAR/OdQJIo1VcuZg== X-CSE-MsgGUID: iOAMEQsHSNm0R4OmDmhV1w== X-IronPort-AV: E=McAfee;i="6600,9927,11099"; a="18561516" X-IronPort-AV: E=Sophos;i="6.08,227,1712646000"; d="scan'208";a="18561516" 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:51 -0700 X-CSE-ConnectionGUID: Fl05qcTsROyz5zVYtzp62g== X-CSE-MsgGUID: xl5dWpXGQjKncjNs44ReAg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,227,1712646000"; d="scan'208";a="39169084" Received: from kanliang-dev.jf.intel.com ([10.165.154.102]) by fmviesa008.fm.intel.com with ESMTP; 10 Jun 2024 13:17: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, Kan Liang Subject: [PATCH 3/8] perf/x86/uncore: Retrieve the unit ID from the unit control RB tree Date: Mon, 10 Jun 2024 13:16:14 -0700 Message-Id: <20240610201619.884021-4-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20240610201619.884021-1-kan.liang@linux.intel.com> References: <20240610201619.884021-1-kan.liang@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Kan Liang The box_ids only save the unit ID for the first die. If a unit, e.g., a CXL unit, doesn't exist in the first die. The unit ID cannot be retrieved. The unit control RB tree also stores the unit ID information. Retrieve the unit ID from the unit control RB tree Tested-by: Yunying Sun Signed-off-by: Kan Liang --- arch/x86/events/intel/uncore.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c index 075c92e0e4bc..27a0cda5cc91 100644 --- a/arch/x86/events/intel/uncore.c +++ b/arch/x86/events/intel/uncore.c @@ -863,6 +863,9 @@ static const struct attribute_group uncore_pmu_attr_group = { static inline int uncore_get_box_id(struct intel_uncore_type *type, struct intel_uncore_pmu *pmu) { + if (type->boxes) + return intel_uncore_find_discovery_unit_id(type->boxes, -1, pmu->pmu_idx); + return type->box_ids ? type->box_ids[pmu->pmu_idx] : pmu->pmu_idx; } -- 2.35.1