mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: "rafael@kernel.org" <rafael@kernel.org>,
	"daniel.lezcano@linaro.org" <daniel.lezcano@linaro.org>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"joao.m.martins@oracle.com" <joao.m.martins@oracle.com>,
	"mtosatti@redhat.com" <mtosatti@redhat.com>
Subject: Re: [PATCH v2] cpuidle: haltpoll: Add trace points for guest_halt_poll_ns grow/shrink
Date: Thu, 26 May 2022 00:02:00 +0000	[thread overview]
Message-ID: <684B8F16-CD02-452D-9D52-F60D5147500E@nutanix.com> (raw)
In-Reply-To: <20220525120248.5cb37817@gandalf.local.home>

Hi Steven

> On May 26, 2022, at 1:02, Steven Rostedt <rostedt@goodmis.org> wrote:
> 
> On Mon, 23 May 2022 23:53:32 +0000
> Eiichi Tsukata <eiichi.tsukata@nutanix.com> wrote:
> 
>> @@ -91,16 +95,17 @@ static void adjust_poll_limit(struct cpuidle_device *dev, u64 block_ns)
>> 			val = guest_halt_poll_ns;
>> 
>> 		dev->poll_limit_ns = val;
>> +		trace_guest_halt_poll_ns_grow(smp_processor_id(), val, old);
> 
> Why are you passing in smp_processor_id()?
> 
>> 	} else if (block_ns > guest_halt_poll_ns &&
>> 		   guest_halt_poll_allow_shrink) {
>> 		unsigned int shrink = guest_halt_poll_shrink;
>> 
>> -		val = dev->poll_limit_ns;
>> 		if (shrink == 0)
>> 			val = 0;
>> 		else
>> 			val /= shrink;
>> 		dev->poll_limit_ns = val;
>> +		trace_guest_halt_poll_ns_shrink(smp_processor_id(), val, old);
>> 	}
>> }
>> 
>> diff --git a/include/trace/events/power.h b/include/trace/events/power.h
>> index af5018aa9517..db065af9c3c0 100644
>> --- a/include/trace/events/power.h
>> +++ b/include/trace/events/power.h
>> @@ -500,6 +500,39 @@ DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_remove_request,
>> 
>> 	TP_ARGS(name, type, new_value)
>> );
>> +
>> +TRACE_EVENT(guest_halt_poll_ns,
>> +
>> +	TP_PROTO(bool grow, unsigned int cpu_id,
>> +		 unsigned int new, unsigned int old),
>> +
>> +	TP_ARGS(grow, cpu_id, new, old),
>> +
>> +	TP_STRUCT__entry(
>> +		__field(bool, grow)
>> +		__field(unsigned int, cpu_id)
>> +		__field(unsigned int, new)
>> +		__field(unsigned int, old)
>> +	),
>> +
>> +	TP_fast_assign(
>> +		__entry->grow   = grow;
>> +		__entry->cpu_id = cpu_id;
> 
> You are wasting space to save the cpu_id, as the trace event already knows
> what CPU it occurred on.
> 
> # echo 1 > events/sched/enable
> # cat trace
> #           TASK-PID     CPU#  |||||  TIMESTAMP  FUNCTION
> #              | |         |   |||||     |         |
>         systemd-1       [004] .....    15.872715: ftrace_boot_snapshot: ** Boot snapshot taken **
>         systemd-1       [001] .....    22.555418: initcall_start: func=fuse_len_args+0x0/0x30 [fuse]
>         systemd-1       [001] .....    22.555425: initcall_finish: func=fuse_len_args+0x0/0x30 [fuse] ret=0
>        modprobe-643     [006] .....    26.737355: initcall_start: func=wmidev_evaluate_method+0x46/0x100 [wmi]
>        modprobe-643     [006] .....    26.742491: initcall_finish: func=wmidev_evaluate_method+0x46/0x100 [wmi] ret=0
> 
> -- Steve

Thanks for your suggestion.
I added cpu_id as there is a similar precedent “trace_cpu_idle” but I think we can remove cpu_id.
Will fix it in v3.

Eiichi

  reply	other threads:[~2022-05-26  0:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-23 23:53 Eiichi Tsukata
2022-05-25 16:02 ` Steven Rostedt
2022-05-26  0:02   ` Eiichi Tsukata [this message]
2022-05-25 17:31 ` Marcelo Tosatti
2022-05-27  0:42   ` Eiichi Tsukata

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=684B8F16-CD02-452D-9D52-F60D5147500E@nutanix.com \
    --to=eiichi.tsukata@nutanix.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=joao.m.martins@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=rafael@kernel.org \
    --cc=rostedt@goodmis.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®