From patchwork Wed Sep 18 20:51:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Reed X-Patchwork-Id: 1986982 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X89mz13Mmz1y2j for ; Thu, 19 Sep 2024 06:51:46 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1sr1e3-000498-2J; Wed, 18 Sep 2024 20:51:27 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1sr1e0-00048M-OV for kernel-team@lists.ubuntu.com; Wed, 18 Sep 2024 20:51:24 +0000 Received: from mail-oi1-f199.google.com (mail-oi1-f199.google.com [209.85.167.199]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 5ED6E3F664 for ; Wed, 18 Sep 2024 20:51:24 +0000 (UTC) Received: by mail-oi1-f199.google.com with SMTP id 5614622812f47-3e047e9617fso158888b6e.0 for ; Wed, 18 Sep 2024 13:51:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726692683; x=1727297483; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kDKgONhDAz9lU1xmFP/lLj1jIvRr53V5zADrTQ4mof4=; b=RzueCrhvbsH6iu+euSRRj65PuzUsn2l21LVLN+SDrkcEWSm9yKmU8B345BgHHLfff5 OZI2v9YdjiN7I/yKuKYmser3l3tf996JtzY27XMohWaEVNUIRqz8GETksRIsPYuNELZr jWyU4PQSUN8sgO6zqvUCGgdA6ENi5IxJbECkEiZBMSUPaDrM+7H2bpkmcBMpz1SsU8TF 9F4+A4tbMhyKYQJwof2XD2Myz7r2YrLbx2WGhzkiTnE1qfUxFynR6R0R7PIvatPDlw9I JRx2IvmNC3RD5MgKiZlpfU6YEKp5csCDr4AnG/K+/Ur684wuB+WUaZ0+78RtwfgiziZT 4OLg== X-Gm-Message-State: AOJu0YyJpVNUnBC57D63S9GF6yw5hnzT8smaUxe2wLCStEFM0RMybQgz Hq8e4SbdVEe0aTvFzeMAEp00m+E8QLWp7JQ8NRtAROlpul1JVwloIqFGoP/8BrdivaJxriO7xBm mDCPRxlbYOXw9k94JArMExT7I06ZxgtuDslaD/RW+jR8GDL872Q7bXuEa7YUlVYTENDkGPP+JR6 efNu0KMu+w3xxG X-Received: by 2002:a05:6808:6491:b0:3e0:4e8e:aa2b with SMTP id 5614622812f47-3e071a8ebd6mr13989170b6e.11.1726692683041; Wed, 18 Sep 2024 13:51:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGpb4dbwgdcn6VW6d8ql26n/+/i76mB7F8c5Et4XzuOrlvHqTPGK/zdhg1Y28Qk2RKrPWPSJQ== X-Received: by 2002:a05:6808:6491:b0:3e0:4e8e:aa2b with SMTP id 5614622812f47-3e071a8ebd6mr13989162b6e.11.1726692682704; Wed, 18 Sep 2024 13:51:22 -0700 (PDT) Received: from localhost ([2600:1700:1d0:5e50:4536:727e:1556:7bf1]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3e26b6ac5basm51447b6e.14.2024.09.18.13.51.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Sep 2024 13:51:21 -0700 (PDT) From: Michael Reed To: kernel-team@lists.ubuntu.com Subject: [SRU][N][PATCH 3/8] perf/x86/uncore: Retrieve the unit ID from the unit control RB tree Date: Wed, 18 Sep 2024 15:51:09 -0500 Message-Id: <20240918205114.31083-4-michael.reed@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240918205114.31083-1-michael.reed@canonical.com> References: <20240918205114.31083-1-michael.reed@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Kan Liang BugLink: https://bugs.launchpad.net/bugs/2081079 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 Signed-off-by: Kan Liang Signed-off-by: Peter Zijlstra (Intel) Tested-by: Yunying Sun Link: https://lore.kernel.org/r/20240614134631.1092359-4-kan.liang@linux.intel.com (cherry picked from commit 585463fee64270d4b4d80b1e433d2105ef555bec) Signed-off-by: Michael Reed --- 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 117357057de3..bc662dfd8662 100644 --- a/arch/x86/events/intel/uncore.c +++ b/arch/x86/events/intel/uncore.c @@ -862,6 +862,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; }