Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp299031pxb; Fri, 22 Apr 2022 00:40:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyu4wmOK5MJwSMEekXFoDjF7o1VhY3oECojuoi/RiUu2cfYwZ+/mBHgRh8wOMQ7frfALpBu X-Received: by 2002:a17:902:be13:b0:159:8e2:b72d with SMTP id r19-20020a170902be1300b0015908e2b72dmr3268678pls.79.1650613242059; Fri, 22 Apr 2022 00:40:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650613242; cv=none; d=google.com; s=arc-20160816; b=Vbfyyum0WdHn7gRfmxsOfXlfpeN/ruaxS8g3Mp0forkry466PCNhTmJ62gQOe3EWg8 NA/Lhk9Da0wAcnV9KPNbfo+Yp+mtbDWxvX8E3bjupelzDZH0bLdnJHMjvad4h3H2KYiv YiLHcj7aK9ibEnyS7STHGKHNuH6laKxpMmHBem+ecNqny/pMqb60mlOtEupU54U/KLuO YcR4R1hGNgka9NAuOKUB3+7SMVxkdIz52NnDSpbJflcHDk9xa4BL/mlDfEUUEQ14M0SD FsTUDvU6n17gxdTqOqOPcM3oebAMJfuZMrqyBaIr/fdhOLXib5Ogt4+ROBHn+DdaJs6s p90Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=9pslpD25HgykIqt3xH7tKtMNEx/2eim5jPdR1OaqY0Q=; b=knczmlOuqUwvlBG0EohZCiXesR2mGuak3CCwXh2RTiTqtuA+xYD7oFwpMe6Wo3HGjV tuCA5jBOIqZT52aYJnnGSuLj6taq7x4+j6G6YmFzTJVlWEaxOJsZVHU4ANjvEnp9coE1 ADztl9mGrFnSLGIsy5eN1utUDsKYaFRbQrKpn05zpurjUDiFQcfUAm6mgxOcAizBi+q2 1CO0MesGjD87yboH5q8vM8dKGQ0ssdj4NX8nZfpTFT738mahEHONcrmGzPHoFBI/LfxH EvLgQHTH2doLuiTBMfOMcmtB+E1tpDi+GDTO/OPmg+gHFGJXZLJu9k6vauZpYlASnPf/ GMxA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l14-20020a63570e000000b003816043f15asi7188331pgb.847.2022.04.22.00.40.25; Fri, 22 Apr 2022 00:40:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355162AbiDSQ4k (ORCPT + 99 others); Tue, 19 Apr 2022 12:56:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349413AbiDSQuz (ORCPT ); Tue, 19 Apr 2022 12:50:55 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CA2943B288 for ; Tue, 19 Apr 2022 09:48:11 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CA0E71063; Tue, 19 Apr 2022 09:48:10 -0700 (PDT) Received: from e123648.arm.com (unknown [10.57.10.212]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 26FAC3F73B; Tue, 19 Apr 2022 09:48:09 -0700 (PDT) From: Lukasz Luba To: linux-kernel@vger.kernel.org Cc: sudeep.holla@arm.com, dietmar.eggemann@arm.com, vincent.guittot@linaro.org, gregkh@linuxfoundation.org, rafael@kernel.org, rostedt@goodmis.org, mingo@redhat.com, lukasz.luba@arm.com Subject: [PATCH] arch_topology: Trace the update thermal pressure Date: Tue, 19 Apr 2022 17:48:01 +0100 Message-Id: <20220419164801.29078-1-lukasz.luba@arm.com> X-Mailer: git-send-email 2.17.1 X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add trace event to capture the moment of the call for updating the thermal pressure value. It's helpful to investigate how often those events occurs in a system dealing with throttling. This trace event is needed since the old 'cdev_update' might not be used by some drivers. Also, the new trace event shows capacity value, not a cooling state. We already have a trace point 'pelt_thermal_tp' which after a change to trace event can be paired with this new 'thermal_pressure_update' and derive more insight what is going on in the system under pressure (and why). Signed-off-by: Lukasz Luba --- drivers/base/arch_topology.c | 4 ++++ include/trace/events/thermal.h | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 1d6636ebaac5..4f0392de3081 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -19,6 +19,8 @@ #include #include +#include + static DEFINE_PER_CPU(struct scale_freq_data __rcu *, sft_data); static struct cpumask scale_freq_counters_mask; static bool scale_freq_invariant; @@ -195,6 +197,8 @@ void topology_update_thermal_pressure(const struct cpumask *cpus, th_pressure = max_capacity - capacity; + trace_thermal_pressure_update(cpu, th_pressure); + for_each_cpu(cpu, cpus) WRITE_ONCE(per_cpu(thermal_pressure, cpu), th_pressure); } diff --git a/include/trace/events/thermal.h b/include/trace/events/thermal.h index 8a5f04888abd..1bf08ee1a25b 100644 --- a/include/trace/events/thermal.h +++ b/include/trace/events/thermal.h @@ -65,6 +65,25 @@ TRACE_EVENT(cdev_update, TP_printk("type=%s target=%lu", __get_str(type), __entry->target) ); +TRACE_EVENT(thermal_pressure_update, + + TP_PROTO(int cpu, unsigned long thermal_pressure), + + TP_ARGS(cpu, thermal_pressure), + + TP_STRUCT__entry( + __field(int, cpu) + __field(unsigned long, thermal_pressure) + ), + + TP_fast_assign( + __entry->cpu = cpu; + __entry->thermal_pressure = thermal_pressure; + ), + + TP_printk("cpu=%d thermal_pressure=%lu", __entry->cpu, __entry->thermal_pressure) +); + TRACE_EVENT(thermal_zone_trip, TP_PROTO(struct thermal_zone_device *tz, int trip, -- 2.17.1