Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2389983lqt; Mon, 22 Apr 2024 09:21:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWssLPK6EjUdFXmV3XSFPyqxd22PZeSyqsS+3GNtpgPrW6VftgfilxVUt0+BaBk/Lm/La0f7Uqs6ufy6cEuw9qMpLC9RKS7OhjJ83bdlg== X-Google-Smtp-Source: AGHT+IEkjNRZ8VdIai7HmcResbYxmsqi0+9IGYX43TxEqwmjs9SfksNlEroV2+HmsoyDDz03boHN X-Received: by 2002:a05:6a20:9150:b0:1ac:34cc:b323 with SMTP id x16-20020a056a20915000b001ac34ccb323mr14109364pzc.33.1713802883977; Mon, 22 Apr 2024 09:21:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713802883; cv=pass; d=google.com; s=arc-20160816; b=mD/0zewKLMVUP7cci1pS2Yjf33z2zgjUWg2o17y9iXgIwfMg8eXm+Efy4NJYwGuc77 ZF4PYxljfpgfxPWfIg1nJr/WYTsDP7RicQfGYTnT6VrEXjCaKIRXvY9zojJGS9xz3Ptf UuRcwopYM9lrkJgYoY4x7hgQf2tXGx/DD4SUs75oxtM7F8rvyyaifCpqAnSeVdYW27wZ WGSPkugCwSIhBTZQJRHTXIH0h5d2AjXrC8SLPSJHMd2YCIFiAJP5doQKFj/OQoDSlcGO AIV/jXOeQP22YVCARSrtojzqTJE7XnaxbojMCcbQNPuQeiNm+sneAGhAg9XXOF1KmDbw +lvQ== 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=0y8PF6X4M0doMCfuHZls81ewN17EzfM5b0uvKmE2uH0=; fh=XRyktAWfBDGbJ1xUPdkSh8aAML3CriornvGZAw15ShM=; b=NBos+uUgESPiZTnypNeB3tuoWVTAT0FCoQp22YRdMQVvyRPj2LEkqsvRmuE3CHBf82 St9+kk+5plaK18/0HSfC8+h59C09Dj0mGLvkvmYCSHzeRu3kb/k0Febr12KbkAMUDyA2 QkumoYcvbGC1YhrfAh1LG7mP3gxpZ5SZGKIjTUpgSiBzglkRlNuAF4hS0CTeKQLCBOen /gBoe1xJHUpR3mvBwYzMVAsKDaSvutCbxFASUzcyx4aaQaKG6yWsVjM8ENONg4a/mP21 BzXYW9o/2gASgOAYMlGYEi6cnhNZJlHiLuINXXYsFaBqTFLcFbIgtnYct3+sH9MTeL2u xOEw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GRd38Ero; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-153695-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153695-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id j71-20020a638b4a000000b005ff1b947573si2380449pge.758.2024.04.22.09.21.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 09:21:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-153695-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GRd38Ero; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-153695-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153695-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 C4D47280F1A for ; Mon, 22 Apr 2024 16:21:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1F688153807; Mon, 22 Apr 2024 16:20:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="GRd38Ero" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 276391474D2; Mon, 22 Apr 2024 16:20:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713802858; cv=none; b=E+RpiZPhBndCwvqg/F0fEQ7HJUkAQ1lrA+i5C6/kzLAD4ntNQjWRrEJVaZxq1IuBaK51/+wmg0db14idRqcVraog8wYUPXJh3U281JOc5zrko+mH3yLlQL681XFNgRMT5zwAoQp43hauv8Zsslsp7Ds1EoTBb8FNbJBXkDEENe4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713802858; c=relaxed/simple; bh=euB9xiHJ0ccVpu4VLR6T/Kab+BOh3URfAC/WOlN5Gos=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=BRojWiEVQi6zajZI/Kp/4++oBKhHsludZ6DKalh1n3Nc7h4I4tixjZvvKTCk23Em4leSQnzq2c1HqDre8hbGCziYWtpHd+ckM0u3dAR4f6LlKKlFVfeJFJzD/KTgq4GezibD58DaILd4ocMinU/DFD1MCiami3zZ1RTu8hPX/pE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=GRd38Ero; arc=none smtp.client-ip=192.198.163.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713802856; x=1745338856; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=euB9xiHJ0ccVpu4VLR6T/Kab+BOh3URfAC/WOlN5Gos=; b=GRd38EroC5vttlIJOKESCxBQap3MYzs7kgFQMtvcAR2r/DNXzeR3IhTr 20L2E7POx8okIxl0yLcmyV6Uns2Mkypi90qH9R+EUO0t4z1ajXlruZ6On 6QsTVeZBBM2JG9KQd9fW/c+tI7l3/HE9QEuy7RcEi8tD70d6DlyLrit9r URq7hk4I6ZJKM3BuaQCjOPUGZUtjyhpObOwukw5dvNV+LPWeWmWcr24QH H5obKlw8q+ad7o2R9/vNq/yIPPmA0dA1gCiOTAG/3+MuDKb7H5pk/aQS3 zQTy4ljXvR7XtxGKqSBfLU+NmzYHXL+8N/8n2kESS3vStIhAquj0dsW2l Q==; X-CSE-ConnectionGUID: cCzaZf3jRmq7DuoRFsswiA== X-CSE-MsgGUID: u/0C10ppRZmSGe3zPbLCWA== X-IronPort-AV: E=McAfee;i="6600,9927,11052"; a="20754868" X-IronPort-AV: E=Sophos;i="6.07,221,1708416000"; d="scan'208";a="20754868" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Apr 2024 09:20:55 -0700 X-CSE-ConnectionGUID: S5DNLaSiSFaelJ20/iLS0g== X-CSE-MsgGUID: 1izRHuorTDuGqouMcS3uPw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,221,1708416000"; d="scan'208";a="28738993" Received: from lxia1-mobl2.ccr.corp.intel.com (HELO rzhang1-mobl7.ccr.corp.intel.com) ([10.254.209.16]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Apr 2024 09:20:53 -0700 From: Zhang Rui To: rafael.j.wysocki@intel.com Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, srinivas.pandruvada@intel.com Subject: [PATCH V3 0/2] powercap: Introduce TPMI RAPL PMU support Date: Tue, 23 Apr 2024 00:20:38 +0800 Message-Id: <20240422162040.1502626-1-rui.zhang@intel.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit RAPL energy counter MSRs are exposed via perf PMU. But this is done by separate code which is not part of RAPL framework, and it cannot be reused by other RAPL Interface drivers like TPMI RAPL. Introduce two new APIs for PMU support in RAPL framework. This allows TPMI RAPL PMU support and also makes it possible for future cleanups of MSR RAPL PMU code. Changes since V2: - drop patch 1/3 and rebase on PM tree bleeding-edge branch. - fix a regression introduced in patch V2 that RAPL PMU is not successfully unregisted when unbinding the device. This causes kernel calltrace about duplicate PMU name in sysfs when reloading the module. Our unit test cases reproduced this but the test framework failed to catch it, and now that problem is also fixed. - add comment for RAPL PMU implementation details. - add comment/document for struct rapl_pmu and rapl_package_pmu_data. - remove unneeded global RAPL PMU cpumask. - use an array to map RAPL PMU events to RAPL Domains. - Other minor improvements. Changes since V1: - remove the MSR RAPL PMU conversion because it is a separate work that can be done later. - instead of using a flag to indicate the need of PMU support, introduce two APIs for the RAPL Interface driver to invoke explicitly. - minor code/comments/changelog improvements. thanks, rui ---------------------------------------------------------------- Zhang Rui (2): powercap: intel_rapl: Introduce APIs for PMU support powercap: intel_rapl_tpmi: Enable PMU support drivers/powercap/intel_rapl_common.c | 578 +++++++++++++++++++++++++++++++++++ drivers/powercap/intel_rapl_tpmi.c | 3 + include/linux/intel_rapl.h | 32 ++ 3 files changed, 613 insertions(+)