Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1682267pxb; Sat, 23 Jan 2021 02:08:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJy+nzm5w//VFNeF2guMIAGUAHNN9e7D54UPmpFcp8M92oF86HWLlbDRHgMB70kVSwsW8Szk X-Received: by 2002:a17:906:6d49:: with SMTP id a9mr757651ejt.32.1611396522300; Sat, 23 Jan 2021 02:08:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611396522; cv=none; d=google.com; s=arc-20160816; b=nY9CSDu/oAY2C3ry7llKy2/T+uJzzYUX+w/bcjj4itUDIpQWWwLmI6dqIb4MSpv8n7 L/mfCcIiI4CFFMFbNMrZlaemd4UrEyALK0UPhIN24PTNtDiBi+REgQQBJ96yPAa9Th1a j0Be107QV/n+GGJds2pDasDXnDhWr0McarTwV2TdLRUaGz3NjqSYbDeUx2r1fgGWmQlT HWdYWVIGOlHHMVmlGTzZ3tzIvUE14j3IVa+clIHd/byJcKltymSeuzbf9kgU8eABtytR 7SmSxgxAAfAqEGJeBGenPFY3DdC1TcGLhAO4zR8hBaekPLki6ECS5S7SY8/6lRNH61Ev B/4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=8pqJdnqTorEr9COR2dSZroPtUoKmFz/obPBagaFpLuk=; b=QCUGEMP5Vetdb3CVKZGOSNBr6X5jCaLDZbGdBhqjlNfHpEs8A0VxKiIJhWGSjGHFEP xyk90YB37TJdlGfjXSCmwhrjD2UaFHbqlYGRilWARZUAgNu1AWHj8R0pBdF9VLGxLK0s hnbXtn0JOvoEPeGbuWKBM0V3SRJM8vXX8Uqfu2EpSOQVobrlveoROUcjVO2JjbF0Rot9 by0m2W83iX4vXYde/XEyU7Y0urFK0pcKBJE1BpeFan7j8O80Mv54RwALETSsgFhdxG7q 8dntjeebiwjPpj9KnbqMtisUGzTcRqOn6IjL3mEZiD+6jHh4zYccZTyQ0L+7xhDFigha YpEw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ca12si4654974edb.260.2021.01.23.02.08.17; Sat, 23 Jan 2021 02:08:42 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726859AbhAWKGu (ORCPT + 99 others); Sat, 23 Jan 2021 05:06:50 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:11578 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725940AbhAWKGt (ORCPT ); Sat, 23 Jan 2021 05:06:49 -0500 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4DNBYy48pszMNFw; Sat, 23 Jan 2021 18:04:38 +0800 (CST) Received: from huawei.com (10.175.127.234) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.498.0; Sat, 23 Jan 2021 18:05:57 +0800 From: Yunfeng Ye To: , , CC: , , , Subject: [PATCH 1/2] powercap/intel_rapl: Use topology interface in rapl_add_package() Date: Sat, 23 Jan 2021 05:06:07 -0500 Message-ID: <20210123100608.2349629-1-yeyunfeng@huawei.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.234] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It's not a good way to access phys_proc_id and cpu_die_id directly. So using topology_physical_package_id(cpu) and topology_die_id(cpu) instead. Signed-off-by: Yunfeng Ye --- drivers/powercap/intel_rapl_common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/powercap/intel_rapl_common.c b/drivers/powercap/intel_rapl_common.c index c9e57237d778..5f3d39b8212a 100644 --- a/drivers/powercap/intel_rapl_common.c +++ b/drivers/powercap/intel_rapl_common.c @@ -1309,7 +1309,6 @@ struct rapl_package *rapl_add_package(int cpu, struct rapl_if_priv *priv) { int id = topology_logical_die_id(cpu); struct rapl_package *rp; - struct cpuinfo_x86 *c = &cpu_data(cpu); int ret; if (!rapl_defaults) @@ -1326,10 +1325,11 @@ struct rapl_package *rapl_add_package(int cpu, struct rapl_if_priv *priv) if (topology_max_die_per_package() > 1) snprintf(rp->name, PACKAGE_DOMAIN_NAME_LENGTH, - "package-%d-die-%d", c->phys_proc_id, c->cpu_die_id); + "package-%d-die-%d", + topology_physical_package_id(cpu), topology_die_id(cpu)); else snprintf(rp->name, PACKAGE_DOMAIN_NAME_LENGTH, "package-%d", - c->phys_proc_id); + topology_physical_package_id(cpu)); /* check if the package contains valid domains */ if (rapl_detect_domains(rp, cpu) || rapl_defaults->check_unit(rp, cpu)) { -- 2.27.0