Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp46103lqm; Tue, 30 Apr 2024 12:13:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUIpQlkdTZkpP91ptYh2AnA4OQOimsWNLK3E8i71aJvkH4uLyXpiGMPqn6RbvX2fT9i8CyWBbLfkYopojsZATqFaFtoSdATTXE53d+UJA== X-Google-Smtp-Source: AGHT+IHHPjFlVnGp3+eCsAOC/RVpqzDqYiI5ztXvcanmySokcl+c0wi35KVutX3ANRyTjlihsRVv X-Received: by 2002:a05:6358:7f0d:b0:17e:89bb:e545 with SMTP id p13-20020a0563587f0d00b0017e89bbe545mr859432rwn.19.1714504435985; Tue, 30 Apr 2024 12:13:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714504435; cv=pass; d=google.com; s=arc-20160816; b=zVixIzQNo+BubXgv3Q27fHHmlt+VkbrdxBWP3zwMDYZ8zWvs0hll7IoF0f4r9r9oNr 9DQpPrUwyUKafl4+V75av08J9Thon+gag/HYsZClBp+V/b6lvoQLLLU+gNF2BR34yxlX w4aFqawDfnAuo61XDE2KJY6e18Uujvexq/kD94FfhjXbOZmThDHhSZHBvZ5NWez7GLTq TQ8jC/2mbGIzx5clPoxJeB1S3KjE6FrOBIbat9WbR42PODtvNNJQu+xjK8tEVLxriuHy DSGynD6ZBgmpr3GPPuxFV609DFOHGeiZZZ+eKuLMugxZ3bS2IOxQmvnxYODkZGe1X4We UPxA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=QEQ1pC31JMEPtBmLc5eHk08AtoHNYnp1ao40j2iO6Ig=; fh=45SwHrgYA5da9P5dZz0WGTyXH9IH5VMTKc4vuuuk9ps=; b=onil/iTtppLaw/pPMDo9dKiwvc8lCLZ7vPK7yUjaWywrv5pOtjQP6ccrIG6u3Iq2gl h3fI7Kh9kcwVC7SlMugty/V2DUa6hk19ozwyfnQrqncD401Kw3GQGLUjmXz0XTcHMjzh lGDJf9r7sbo25leXLd27wn9aIfjq2pvscUZCceGwnEpj2D8eYiKktHpEsU9AfSHexPlA HmuscSQRBl6eT5u2hbArueeeG4rfYWUySEm8UyW9ZrsXciLyxrlaiUOUtoboV9/4BSK/ l/5mVSen1epZrEzuqtyTPa96Bmav5+XvLeF6dYsgkSt7llx5ss7G0kUZPE2vOG9uEP6W /vhA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="smEyfi/E"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-164628-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164628-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id k4-20020a636f04000000b005fd6ec933cbsi17245784pgc.436.2024.04.30.12.13.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 12:13:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-164628-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="smEyfi/E"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-164628-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164628-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id A67CAB2250B for ; Tue, 30 Apr 2024 19:13:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F203194C96; Tue, 30 Apr 2024 19:13:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="smEyfi/E" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 761AF172BD7; Tue, 30 Apr 2024 19:13:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714504421; cv=none; b=CLuS82ab0NSvG2BjFw7EHkAq1tq0t4OjxMKPBTqlg9drKRE+rFIA+h491uPRK8jiWRsTo0GsAWVHm2kqan3lkx3t03kTciVi0KgFI/q2hMGMA34Q/vNSgMB+1cUSMnAAKbYYnCbVxblGrUkqg3jAIpWS7gPXhQ5TscUqKy49ceY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714504421; c=relaxed/simple; bh=Urq3LK4nbrE0DFxUYkRFrryw4CWIaUGFevJJUvp2tSs=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=CsBP5ca/bist5zdNCuVrAq+V3sTIxLiIsZlS6ZbIi6/cC6V6ta2jRe4GvISeNTqog557v7TWK6YHqVPfK1dxevcYJauYRg45L+snQpFBldB1TPafVuDZrU1kHCpqrsPbhSyQBnY+B4Ha2HzSk84Xdl8azazD4H7JnnQsgMPmybY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=smEyfi/E; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00771C4AF17; Tue, 30 Apr 2024 19:13:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714504421; bh=Urq3LK4nbrE0DFxUYkRFrryw4CWIaUGFevJJUvp2tSs=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=smEyfi/EUdc2ONslX1BfnnSGon+y2tAJqOixYdh2BKIdMHU8GqPMSMt54qi7mt518 tG8cXBMyWww9n4tHUmlFdRcgGiT6xScvQUiiyTDj6QbOUVhhla4HNK2th/kZSco3s7 Ghdx2hJFs8XGxF3JCwABJbpMJuyEEkU4GcyPAVB+vz3R8ePKNFRMLuPZNwXSNK6ijM Hk+/gFljoGx3wQDO3r8EX6311JFgC6WC3khD6PoflnNG2qVuH02R5oCuFtXq2MA0or 4KqotpOnPKN+WU99E3Y4lZYn76BGwLkeqztvdG3ryTfOv5pj5SzdxQgwbWgZBxIaE/ VuhZFM4/UhFaw== Received: by mail-oi1-f174.google.com with SMTP id 5614622812f47-3c70418ef53so551543b6e.1; Tue, 30 Apr 2024 12:13:40 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCUF4Ar4Azds4MoVMiNZMDt5C2J7kvlXRtPlvO2laaM2LPSpY2vLtpkOLiR4zI/2+nTAxJm/0bx+3lK8fH5dHKAc1iQYPylG7g5GoaP8GxQDDRXxJRa4A8kfyTcZgjY+4oPN6+8segE= X-Gm-Message-State: AOJu0YyGJeLuGTnDMoBmdI5v1y1sQn6hp0tl7ojZrI/0MjL97kiiJBbK wgQjMlhenll9lp4v5HZV1BN5V5NeyrQFnP+0/S4miICdkHLmEMNl4eCaUgIhhM9QZwTZvy+6+J1 zkQE9L4K53QOP7XQ46TKHqSX2s80= X-Received: by 2002:a4a:654d:0:b0:5aa:241a:7f4b with SMTP id z13-20020a4a654d000000b005aa241a7f4bmr378497oog.1.1714504419959; Tue, 30 Apr 2024 12:13:39 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240428092427.24959-1-rui.zhang@intel.com> In-Reply-To: <20240428092427.24959-1-rui.zhang@intel.com> From: "Rafael J. Wysocki" Date: Tue, 30 Apr 2024 21:13:28 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH V4 0/2] powercap: Introduce TPMI RAPL PMU support To: Zhang Rui Cc: rafael.j.wysocki@intel.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, srinivas.pandruvada@intel.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Apr 28, 2024 at 11:24=E2=80=AFAM Zhang Rui wr= ote: > > 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 V3: > - Fix is_rp_pmu_cpu() return value. (Rafael) > - Following the conversion in other PMU drivers to use > local64_try_cmpxchg() instead of local64_cmpxchg(). E.g. bcc6ec3d954b > ("perf/x86/rapl: Use local64_try_cmpxchg in rapl_event_update()"), and > update with a comment. > > 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 | 582 +++++++++++++++++++++++++++++= ++++++ > drivers/powercap/intel_rapl_tpmi.c | 3 + > include/linux/intel_rapl.h | 32 ++ > 3 files changed, 617 insertions(+) Both patches applied as 6.10 material, thanks!