mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: rafael@kernel.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, Amit Kucheria <amitk@kernel.org>,
	Zhang Rui <rui.zhang@intel.com>,
	Lukasz Luba <lukasz.luba@arm.com>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	"open list:TRACING" <linux-trace-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 20/20] thermal/traces: Replace the thermal zone structure parameter with the field value
Date: Mon, 27 Feb 2023 17:01:39 +0100	[thread overview]
Message-ID: <b7b99ec6-5c6f-34a1-05be-a109b4328eab@linaro.org> (raw)
In-Reply-To: <20230227100715.7d896836@gandalf.local.home>


Hi Steven,


On 27/02/2023 16:07, Steven Rostedt wrote:
> On Sun, 26 Feb 2023 23:54:06 +0100
> Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
> 
>> In the work of the thermal zone device self-encapsulation, let's pass
>> the field value instead of dereferencing them in the traces which
>> force us to export publicly the thermal_zone_device structure.
>>
>> No fonctionnal change intended.
>>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
>> ---
>>   drivers/thermal/gov_fair_share.c              |  4 +++-
>>   drivers/thermal/gov_power_allocator.c         |  6 +++--
>>   drivers/thermal/gov_step_wise.c               |  4 +++-
>>   drivers/thermal/thermal_core.c                |  8 +++++--
>>   include/trace/events/thermal.h                | 24 +++++++++----------
>>   .../trace/events/thermal_power_allocator.h    | 12 +++++-----
>>   6 files changed, 34 insertions(+), 24 deletions(-)
>>
>> diff --git a/drivers/thermal/gov_fair_share.c b/drivers/thermal/gov_fair_share.c
>> index aad7d5fe3a14..cdddd593021d 100644
>> --- a/drivers/thermal/gov_fair_share.c
>> +++ b/drivers/thermal/gov_fair_share.c
>> @@ -35,7 +35,9 @@ static int get_trip_level(struct thermal_zone_device *tz)
>>   	 * point, in which case, trip_point = count - 1
>>   	 */
>>   	if (count > 0)
>> -		trace_thermal_zone_trip(tz, count - 1, trip.type);
>> +		trace_thermal_zone_trip(thermal_zone_device_type(tz),
>> +					thermal_zone_device_id(tz),
>> +					count - 1, trip.type);
> 
> The problem with this approach is that you are moving all the work to
> dereference the pointers into the hot paths (the code execution), instead
> of doing it in the slow path (where the tracepoint work is done).

Good point, that is something I did not realize, thanks for pointing it out.

> If you are concerned with exporting a structure then move the trace file
> from:
>
>    include/trace/events/thermal.h to drivers/thermal/trace.h
> 
> like drivers/vfio/pci/trace.h and many other drivers do.

Good idea, I'll do that

> Read
>     https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/samples/trace_events/Makefile
> to see how to use a trace header outside the include/trace/events directory.
> 
> also, by removing the pointer, you lose out on BPF and kprobe traces that
> could dereference the pointer if you needed to trace something that was not
> exported by the trace point itself.

As the trace will be in the drivers/thermal/trace.h, it will be able to 
use the thermal_core.h private file and no longer 
include/linux/thermal.h, so preventing to unexport the thermal zone 
structure from thermal.h. Consequently, we no longer have to change the 
prototype of the traces and the pointer will stay in place.

Thanks for your suggestions


-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


      reply	other threads:[~2023-02-27 16:01 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-26 22:53 [PATCH v3 00/20] Self-encapsulate the thermal zone device structure Daniel Lezcano
2023-02-26 22:53 ` [PATCH v3 01/20] thermal/core: Add a thermal zone 'devdata' accessor Daniel Lezcano
2023-02-26 22:53 ` [PATCH v3 02/20] thermal/core: Use the thermal zone 'devdata' accessor in thermal located drivers Daniel Lezcano
2023-02-27  1:57   ` kernel test robot
2023-02-27  6:43   ` kernel test robot
2023-02-26 22:53 ` [PATCH v3 03/20] thermal/core: Use the thermal zone 'devdata' accessor in hwmon " Daniel Lezcano
2023-02-26 22:53 ` [PATCH v3 04/20] thermal/core: Use the thermal zone 'devdata' accessor in remaining drivers Daniel Lezcano
2023-02-26 22:59   ` Damien Le Moal
2023-02-26 22:53 ` [PATCH v3 05/20] thermal/core: Show a debug message when get_temp() fails Daniel Lezcano
2023-02-26 22:53 ` [PATCH v3 06/20] thermal: Remove debug or error messages in get_temp() ops Daniel Lezcano
2023-02-26 22:53 ` [PATCH v3 07/20] thermal/hwmon: Do not set no_hwmon before calling thermal_add_hwmon_sysfs() Daniel Lezcano
2023-02-26 22:53 ` [PATCH v3 08/20] thermal/hwmon: Use the right device for devm_thermal_add_hwmon_sysfs() Daniel Lezcano
2023-02-26 22:53 ` [PATCH v3 09/20] thermal: Don't use 'device' internal thermal zone structure field Daniel Lezcano
2023-02-26 22:53 ` [PATCH v3 10/20] thermal/core: Add thermal_zone_device structure 'type' accessor Daniel Lezcano
2023-02-26 22:53 ` [PATCH v3 11/20] thermal/drivers/spear: Don't use tz->device but pdev->dev Daniel Lezcano
2023-02-26 22:53 ` [PATCH v3 12/20] thermal: Add a thermal zone id accessor Daniel Lezcano
2023-02-26 22:53 ` [PATCH v3 13/20] thermal: Use thermal_zone_device_type() accessor Daniel Lezcano
2023-02-26 22:54 ` [PATCH v3 14/20] thermal/drivers/da9062: Don't access the thermal zone device fields Daniel Lezcano
2023-02-27 18:14   ` Daniel Lezcano
2023-02-28 10:04     ` DLG Adam Ward
2023-02-28 11:01       ` Daniel Lezcano
2023-02-26 22:54 ` [PATCH v3 15/20] thermal/hwmon: Use the thermal_core.h header Daniel Lezcano
2023-02-27 14:21   ` Jean Delvare
2023-02-26 22:54 ` [PATCH v3 16/20] thermal/drivers/tegra: Remove unneeded lock when setting a trip point Daniel Lezcano
2023-02-26 22:54 ` [PATCH v3 17/20] thermal/tegra: Do not enable the thermal zone, it is already enabled Daniel Lezcano
2023-02-26 22:54 ` [PATCH v3 18/20] thermal/drivers/acerhdf: Make interval setting only at module load time Daniel Lezcano
2023-02-26 22:54 ` [PATCH v3 19/20] thermal/drivers/acerhdf: Remove pointless governor test Daniel Lezcano
2023-02-26 22:54 ` [PATCH v3 20/20] thermal/traces: Replace the thermal zone structure parameter with the field value Daniel Lezcano
2023-02-27 15:07   ` Steven Rostedt
2023-02-27 16:01     ` Daniel Lezcano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b7b99ec6-5c6f-34a1-05be-a109b4328eab@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=amitk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=mhiramat@kernel.org \
    --cc=rafael@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=rui.zhang@intel.com \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®