lkml.org 
[lkml]   [2022]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v2] cpuidle: haltpoll: Add trace points for guest_halt_poll_ns grow/shrink
Date
Hi Marcelo

> On May 26, 2022, at 2:31, Marcelo Tosatti <mtosatti@redhat.com> wrote:
>
> On Mon, May 23, 2022 at 11:53:32PM +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 | 15 ++++++++-----
>> include/trace/events/power.h | 33 ++++++++++++++++++++++++++++
>> 2 files changed, 43 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/cpuidle/governors/haltpoll.c b/drivers/cpuidle/governors/haltpoll.c
>> index cb2a96eafc02..a5b6ad32956c 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);
>> @@ -77,13 +78,16 @@ static int haltpoll_select(struct cpuidle_driver *drv,
>>
>> static void adjust_poll_limit(struct cpuidle_device *dev, u64 block_ns)
>> {
>> - unsigned int val;
>> + unsigned int val, old;
>>
>> - /* Grow cpu_halt_poll_us if
>> - * cpu_halt_poll_us < block_ns < guest_halt_poll_us
>> + val = dev->poll_limit_ns;
>> + old = val;
>> +
>> + /* Grow poll_limit_ns if
>> + * poll_limit_ns < block_ns < guest_halt_poll_ns
>> */
>> if (block_ns > dev->poll_limit_ns && block_ns <= guest_halt_poll_ns) {
>> - val = dev->poll_limit_ns * guest_halt_poll_grow;
>> + val *= guest_halt_poll_grow;
>>
>> if (val < guest_halt_poll_grow_start)
>> val = guest_halt_poll_grow_start;
>> @@ -91,16 +95,17 @@ static void adjust_poll_limit(struct cpuidle_device *dev, u64 block_ns)
>> val = guest_halt_poll_ns;
>>
>
> Can do it before the assignment:
>
> trace_guest_halt_poll_ns_grow(val, dev->poll_limit_ns);


Sure. Will fix it in v4.
Thanks

Eiichi
\
 
 \ /
  Last update: 2022-05-27 02:44    [W:0.073 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site