From nobody Fri Jun 19 09:50:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80D28C4167B for ; Tue, 5 Apr 2022 11:25:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376538AbiDELWW (ORCPT ); Tue, 5 Apr 2022 07:22:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241700AbiDEIsc (ORCPT ); Tue, 5 Apr 2022 04:48:32 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 325C22AE38; Tue, 5 Apr 2022 01:36:50 -0700 (PDT) Date: Tue, 05 Apr 2022 08:36:38 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1649147799; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QcaaisSy7yoGqMENp3XASjYCIhZ1dy0KEhiOvSml/rM=; b=0+SAgssOSJBn+nuIEtoTZh2t3SMHH76grHmTrE+JG6cLr4j7fmaKvodTnlZwqlMxVZNG3/ dg/vl4flXx7hZ1Kxn2g5NZpABNluW9kMeexO5i1bWyIpcbXK5V9axoOWMliPxsgogaBLDT +FBzQJzC4rmZiKgQPcmSNt9hj1mY1974KFODffLbhJ8qJf4mIzazLSDXmmXQ3mvQK1srOF tAPiRWJjhIym2eA6KYRAieb3aYbZqjsVkeFPhMklFkkkc2KCMM6MCMaqECWMqP7ZRuAJu1 D++hvFbmcm3B8tsl885hJZKaCYSKkhCwSIzPJNqwn9YS6Ci+WG+OUyZ8Z0hgkg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1649147799; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QcaaisSy7yoGqMENp3XASjYCIhZ1dy0KEhiOvSml/rM=; b=Lrw4YWtFGKUJUYLf7CQe8NhuxeFh7h8YldBEND6+NV1Jkm+l2BfsR7bMaQ1ArbH3dGU3Am ffEEZ6uJgmJAg/CQ== From: "tip-bot2 for Stephane Eranian" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] ACPI: Add perf low power callback Cc: Stephane Eranian , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220322221517.2510440-9-eranian@google.com> References: <20220322221517.2510440-9-eranian@google.com> MIME-Version: 1.0 Message-ID: <164914779839.389.6423225128965385864.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/core branch of tip: Commit-ID: 2a606a18cd672a16343d146a126721b34cc6adbd Gitweb: https://git.kernel.org/tip/2a606a18cd672a16343d146a126721b34= cc6adbd Author: Stephane Eranian AuthorDate: Tue, 22 Mar 2022 15:15:12 -07:00 Committer: Peter Zijlstra CommitterDate: Tue, 05 Apr 2022 10:24:38 +02:00 ACPI: Add perf low power callback Add an optional callback needed by some PMU features, e.g., AMD BRS, to give a chance to the perf_events code to change its state before a CPU goes to low power and after it comes back. The callback is void when the PERF_NEEDS_LOPWR_CB flag is not set. This flag must be set in arch specific perf_event.h header whenever needed. When not set, there is no impact on the ACPI code. Signed-off-by: Stephane Eranian [peterz: build fix] Signed-off-by: Peter Zijlstra (Intel) Link: https://lore.kernel.org/r/20220322221517.2510440-9-eranian@google.com --- drivers/acpi/acpi_pad.c | 7 +++++++ drivers/acpi/processor_idle.c | 5 +++++ include/linux/perf_event.h | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index f45979a..ec0e22a 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include =20 @@ -164,6 +165,9 @@ static int power_saving_thread(void *data) tsc_marked_unstable =3D 1; } local_irq_disable(); + + perf_lopwr_cb(true); + tick_broadcast_enable(); tick_broadcast_enter(); stop_critical_timings(); @@ -172,6 +176,9 @@ static int power_saving_thread(void *data) =20 start_critical_timings(); tick_broadcast_exit(); + + perf_lopwr_cb(false); + local_irq_enable(); =20 if (time_before(expire_time, jiffies)) { diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 32b20ef..05dc0e1 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -21,6 +21,7 @@ #include #include #include +#include #include =20 /* @@ -549,6 +550,8 @@ static void wait_for_freeze(void) */ static void __cpuidle acpi_idle_do_entry(struct acpi_processor_cx *cx) { + perf_lopwr_cb(true); + if (cx->entry_method =3D=3D ACPI_CSTATE_FFH) { /* Call into architectural FFH based C-state */ acpi_processor_ffh_cstate_enter(cx); @@ -559,6 +562,8 @@ static void __cpuidle acpi_idle_do_entry(struct acpi_pr= ocessor_cx *cx) inb(cx->address); wait_for_freeze(); } + + perf_lopwr_cb(false); } =20 /** diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index a411080..da75956 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -1676,4 +1676,10 @@ typedef int (perf_snapshot_branch_stack_t)(struct pe= rf_branch_entry *entries, unsigned int cnt); DECLARE_STATIC_CALL(perf_snapshot_branch_stack, perf_snapshot_branch_stack= _t); =20 +#ifndef PERF_NEEDS_LOPWR_CB +static inline void perf_lopwr_cb(bool mode) +{ +} +#endif + #endif /* _LINUX_PERF_EVENT_H */