lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220420194451.6b9661a0@gandalf.local.home>
Date:   Wed, 20 Apr 2022 19:44:51 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Lukasz Luba <lukasz.luba@....com>
Cc:     linux-kernel@...r.kernel.org, sudeep.holla@....com,
        dietmar.eggemann@....com, vincent.guittot@...aro.org,
        gregkh@...uxfoundation.org, rafael@...nel.org, mingo@...hat.com
Subject: Re: [PATCH] arch_topology: Trace the update thermal pressure

On Tue, 19 Apr 2022 17:48:01 +0100
Lukasz Luba <lukasz.luba@....com> 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 <linux/rcupdate.h>
>  #include <linux/sched.h>
>  
> +#include <trace/events/thermal.h>
> +
>  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,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ