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]
Date:   Mon, 3 Apr 2023 14:46:46 +0100
From:   Qais Yousef <qyousef@...alina.io>
To:     Lukasz Luba <lukasz.luba@....com>
Cc:     linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org,
        rostedt@...dmis.org, mhiramat@...nel.org, mingo@...hat.com,
        peterz@...radead.org, juri.lelli@...hat.com,
        vincent.guittot@...aro.org, dietmar.eggemann@....com,
        bsegall@...gle.com, mgorman@...e.de, bristot@...hat.com,
        vschneid@...hat.com, delyank@...com, qyousef@...gle.com
Subject: Re: [PATCH 3/3] schedutil: trace: Add tracing to capture filter out
 requests

On 03/22/23 15:18, Lukasz Luba wrote:
> Some of the frequency update requests coming form the task scheduler
> might be filter out. It can happen when the previous request was served
> not that long ago (in a period smaller than provided by the cpufreq driver
> as minimum for frequency update). In such case, we want to know if some of
> the frequency updates cannot make through.
> Export the new tracepoint as well. That would allow to handle it by a
> toolkit for trace analyzes.

I think you can use register_kretprobe() for this one. When functions are not
inlined it should be easy to hook into them and you can get the return value of
the function too.

Check the usage in lib/test_kprobes.c. Creating the event in sched_tp should be
the same way when registering for a tracepoint. They both are essentially the
same.

Patches to sched_tp module would be welcome ;-)


Cheers

--
Qais Yousef

> 
> Signed-off-by: Lukasz Luba <lukasz.luba@....com>
> ---
>  include/trace/events/schedutil.h | 17 +++++++++++++++++
>  kernel/sched/cpufreq_schedutil.c | 14 ++++++++++++--
>  2 files changed, 29 insertions(+), 2 deletions(-)
>  create mode 100644 include/trace/events/schedutil.h
> 
> diff --git a/include/trace/events/schedutil.h b/include/trace/events/schedutil.h
> new file mode 100644
> index 000000000000..7f25122f7257
> --- /dev/null
> +++ b/include/trace/events/schedutil.h
> @@ -0,0 +1,17 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#undef TRACE_SYSTEM
> +#define TRACE_SYSTEM schedutil
> +
> +#if !defined(_TRACE_SCHEDUTIL_H) || defined(TRACE_HEADER_MULTI_READ)
> +#define _TRACE_SCHEDUTIL_H
> +
> +#include <linux/tracepoint.h>
> +
> +DECLARE_TRACE(schedutil_update_filtered_tp,
> +	TP_PROTO(int cpu),
> +	TP_ARGS(cpu));
> +
> +#endif /* _TRACE_SCHEDUTIL_H */
> +
> +/* This part must be outside protection */
> +#include <trace/define_trace.h>
> diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
> index f462496e5c07..45c18559f3a8 100644
> --- a/kernel/sched/cpufreq_schedutil.c
> +++ b/kernel/sched/cpufreq_schedutil.c
> @@ -6,6 +6,12 @@
>   * Author: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
>   */
>  
> +#define CREATE_TRACE_POINTS
> +#include <trace/events/schedutil.h>
> +#undef CREATE_TRACE_POINTS
> +
> +EXPORT_TRACEPOINT_SYMBOL_GPL(schedutil_update_filtered_tp);
> +
>  #define IOWAIT_BOOST_MIN	(SCHED_CAPACITY_SCALE / 8)
>  
>  struct sugov_tunables {
> @@ -318,8 +324,10 @@ static inline bool sugov_update_single_common(struct sugov_cpu *sg_cpu,
>  
>  	ignore_dl_rate_limit(sg_cpu);
>  
> -	if (!sugov_should_update_freq(sg_cpu->sg_policy, time))
> +	if (!sugov_should_update_freq(sg_cpu->sg_policy, time)) {
> +		trace_schedutil_update_filtered_tp(sg_cpu->cpu);
>  		return false;
> +	}
>  
>  	sugov_get_util(sg_cpu);
>  	sugov_iowait_apply(sg_cpu, time, max_cap);
> @@ -446,8 +454,10 @@ sugov_update_shared(struct update_util_data *hook, u64 time, unsigned int flags)
>  
>  	ignore_dl_rate_limit(sg_cpu);
>  
> -	if (!sugov_should_update_freq(sg_policy, time))
> +	if (!sugov_should_update_freq(sg_policy, time)) {
> +		trace_schedutil_update_filtered_tp(sg_cpu->cpu);
>  		goto unlock;
> +	}
>  
>  	next_f = sugov_next_freq_shared(sg_cpu, time);
>  
> -- 
> 2.17.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ