Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp932091pxb; Fri, 22 Apr 2022 14:40:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoEhtYtRJhXbrWpgZPT2u1hNf+cCoRluH5zCOEK6Yajy7XM1v/ys3SEtBiKkVaTN5uYkz8 X-Received: by 2002:a17:90b:1646:b0:1d2:b7e7:366c with SMTP id il6-20020a17090b164600b001d2b7e7366cmr18106065pjb.88.1650663636568; Fri, 22 Apr 2022 14:40:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650663636; cv=none; d=google.com; s=arc-20160816; b=c8L0PYQXV93YcBGdzuAmgpfAMu5UwzbU5WCudAhURWwl42Z5H1Js/4Xju1Zl7nduT7 D+YrGSc0PpNo65oVWpLalxooYEIOIC2VGxuWnCwo9u//BJ58CceULkwy/7wkj8Z6RUDT OCIuor9e/5ItN5rWHK0kn6ryinaNU/XvvFtB2viwdWQmrd6j0I9SSo9VQ21ID1/+d86L E+bNFgAmj/oKishNzOUbmCN2KSQNHER+BqFZm6pF/e+hHEuFY4u060k2KgboxaoB6lkq jeMSeRJ7Zrah9NhpT5KbBa55C4uALixhQPXNKDFIY3Sj/LcCr4Fae6CjGUNGdhyXPle3 Z1Mg== 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 :references:in-reply-to:message-id:subject:cc:to:from:date; bh=UzXFT0Sfq/UeT+GvvVSHh3IbEBiby14IPb3qzCX62+Q=; b=xAoQzF4cEfMCHz/2fJoE9dLJAhMSIOCWuzkIVXUPCNM7V5dmdjK9ss/JOFn2Pw6HAh zfeHLVxNNnaEyVtWGQiLwtDsjRJvC/MKRdF+UbwLJ3KD6TK3oFZHMdjs+1aDQFS0JjzN P0sX2HGJloH8a3ZLeSL3LeR8xC7u+9yge24d3qIE3M7N2mEYF09410WmFmBLdazp3qel mOc7tKtuSJtSgUEXfQNoJjN9L07n3Lv9W56ms8vwzAh7Jo7UYTTcwvY/DYHHmS+3sGrQ Qi3oibhCbqtje4oRrW+vigczZQEKYMQ6e736J9S8T37xmlYAZYe40EhNee3/xjRBj3FF 15JQ== 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:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 2-20020a17090a098200b001c664d0720bsi10364456pjo.69.2022.04.22.14.40.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 14:40:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D7607313D3F; Fri, 22 Apr 2022 12:48:13 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351318AbiDTXrn (ORCPT + 99 others); Wed, 20 Apr 2022 19:47:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230418AbiDTXrn (ORCPT ); Wed, 20 Apr 2022 19:47:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 535A3E9C for ; Wed, 20 Apr 2022 16:44:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E0DCF61B45 for ; Wed, 20 Apr 2022 23:44:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E660C385A0; Wed, 20 Apr 2022 23:44:53 +0000 (UTC) Date: Wed, 20 Apr 2022 19:44:51 -0400 From: Steven Rostedt To: Lukasz Luba Cc: linux-kernel@vger.kernel.org, sudeep.holla@arm.com, dietmar.eggemann@arm.com, vincent.guittot@linaro.org, gregkh@linuxfoundation.org, rafael@kernel.org, mingo@redhat.com Subject: Re: [PATCH] arch_topology: Trace the update thermal pressure Message-ID: <20220420194451.6b9661a0@gandalf.local.home> In-Reply-To: <20220419164801.29078-1-lukasz.luba@arm.com> References: <20220419164801.29078-1-lukasz.luba@arm.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE autolearn=no 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 On Tue, 19 Apr 2022 17:48:01 +0100 Lukasz Luba wrote: > 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) Note, it is always best to place the bigger object before the smaller one (when not properly aligned), as that will help to prevent structure "holes". That is: __field(unsigned long, thermal_pressure) __field(int, cpu) Otherwise, you are pretty much guaranteed to have a 4 byte hole between cpu and thermal_pressure on 64 bit machines. Also, for the warning you got from the test robot, if you are using this in a module and defining it in the core kernel, you need to add: EXPORT_TRACEPOINT_SYMBOL_GPL(thermal_pressure_update); Somewhere in the C file that includes this file and defines CREATE_TRACE_POINTS. -- Steve > + ), > + > + 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,