public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
Cc: rafael@kernel.org, daniel.lezcano@linaro.org,
	rostedt@goodmis.org, mingo@redhat.com, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, joao.m.martins@oracle.com
Subject: Re: [PATCH v4] cpuidle: haltpoll: Add trace points for guest_halt_poll_ns grow/shrink
Date: Mon, 30 May 2022 12:17:49 -0300	[thread overview]
Message-ID: <YpTgHeSJA4Ha3Gs4@fuller.cnet> (raw)
In-Reply-To: <20220527005345.189906-1-eiichi.tsukata@nutanix.com>

On Fri, May 27, 2022 at 12:53:45AM +0000, Eiichi Tsukata wrote:
> Add trace points as are implemented in KVM host halt polling.
> This helps tune guest halt polling params.
> 
> Signed-off-by: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
> ---
>  drivers/cpuidle/governors/haltpoll.c |  3 +++
>  include/trace/events/power.h         | 29 ++++++++++++++++++++++++++++
>  2 files changed, 32 insertions(+)
> 
> diff --git a/drivers/cpuidle/governors/haltpoll.c b/drivers/cpuidle/governors/haltpoll.c
> index cb2a96eafc02..1dff3a52917d 100644
> --- a/drivers/cpuidle/governors/haltpoll.c
> +++ b/drivers/cpuidle/governors/haltpoll.c
> @@ -19,6 +19,7 @@
>  #include <linux/sched.h>
>  #include <linux/module.h>
>  #include <linux/kvm_para.h>
> +#include <trace/events/power.h>
>  
>  static unsigned int guest_halt_poll_ns __read_mostly = 200000;
>  module_param(guest_halt_poll_ns, uint, 0644);
> @@ -90,6 +91,7 @@ static void adjust_poll_limit(struct cpuidle_device *dev, u64 block_ns)
>  		if (val > guest_halt_poll_ns)
>  			val = guest_halt_poll_ns;
>  
> +		trace_guest_halt_poll_ns_grow(val, dev->poll_limit_ns);
>  		dev->poll_limit_ns = val;
>  	} else if (block_ns > guest_halt_poll_ns &&
>  		   guest_halt_poll_allow_shrink) {
> @@ -100,6 +102,7 @@ static void adjust_poll_limit(struct cpuidle_device *dev, u64 block_ns)
>  			val = 0;
>  		else
>  			val /= shrink;
> +		trace_guest_halt_poll_ns_shrink(val, dev->poll_limit_ns);
>  		dev->poll_limit_ns = val;
>  	}
>  }
> diff --git a/include/trace/events/power.h b/include/trace/events/power.h
> index af5018aa9517..c708521e4ed5 100644
> --- a/include/trace/events/power.h
> +++ b/include/trace/events/power.h
> @@ -500,6 +500,35 @@ 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 new, unsigned int old),
> +
> +	TP_ARGS(grow, new, old),
> +
> +	TP_STRUCT__entry(
> +		__field(bool, grow)
> +		__field(unsigned int, new)
> +		__field(unsigned int, old)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->grow   = grow;
> +		__entry->new    = new;
> +		__entry->old    = old;
> +	),
> +
> +	TP_printk("halt_poll_ns %u (%s %u)",
> +		__entry->new,
> +		__entry->grow ? "grow" : "shrink",
> +		__entry->old)
> +);
> +
> +#define trace_guest_halt_poll_ns_grow(new, old) \
> +	trace_guest_halt_poll_ns(true, new, old)
> +#define trace_guest_halt_poll_ns_shrink(new, old) \
> +	trace_guest_halt_poll_ns(false, new, old)
>  #endif /* _TRACE_POWER_H */
>  
>  /* This part must be outside protection */
> -- 
> 2.36.1
> 
> 

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>


  reply	other threads:[~2022-05-30 17:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-27  0:53 [PATCH v4] cpuidle: haltpoll: Add trace points for guest_halt_poll_ns grow/shrink Eiichi Tsukata
2022-05-30 15:17 ` Marcelo Tosatti [this message]
2022-06-14 14:03   ` Rafael J. Wysocki

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=YpTgHeSJA4Ha3Gs4@fuller.cnet \
    --to=mtosatti@redhat.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=eiichi.tsukata@nutanix.com \
    --cc=joao.m.martins@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mingo@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