xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Anisov <andrii.anisov@gmail.com>
To: Julien Grall <julien.grall@arm.com>, xen-devel@lists.xenproject.org
Cc: Tim Deegan <tim@xen.org>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Andrii Anisov <andrii_anisov@epam.com>, Wei Liu <wl@xen.org>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	George Dunlap <george.dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Dario Faggioli <dfaggioli@suse.com>,
	Jan Beulich <jbeulich@suse.com>
Subject: Re: [Xen-devel] [RFC 2/9] sysctl: extend XEN_SYSCTL_getcpuinfo interface
Date: Wed, 6 Nov 2019 13:25:51 +0200	[thread overview]
Message-ID: <beec2cdd-aa44-0059-28cc-cb6cc3276aae@gmail.com> (raw)
In-Reply-To: <0bd624d0-adbc-c14f-54ad-26dae1f67bf6@arm.com>

Hello Julien

On 28.10.19 16:52, Julien Grall wrote:
> Hi,
> 
> On 11/09/2019 11:32, Andrii Anisov wrote:
>> From: Andrii Anisov <andrii_anisov@epam.com>
>>
>> Extend XEN_SYSCTL_getcpuinfo interface with timing information
>> provided by introduced time accounting infrastructure.
>>
>> Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
>> ---
>>   xen/common/schedule.c       | 33 ++++++++++++++++++++++++++++-----
>>   xen/common/sysctl.c         |  4 ++++
>>   xen/include/public/sysctl.h |  4 ++++
>>   xen/include/xen/sched.h     |  4 ++++
>>   4 files changed, 40 insertions(+), 5 deletions(-)
>>
>> diff --git a/xen/common/schedule.c b/xen/common/schedule.c
>> index 6dd6603..2007034 100644
>> --- a/xen/common/schedule.c
>> +++ b/xen/common/schedule.c
>> @@ -208,13 +208,36 @@ void vcpu_runstate_get(struct vcpu *v, struct vcpu_runstate_info *runstate)
>>   uint64_t get_cpu_idle_time(unsigned int cpu)
>>   {
>> -    struct vcpu_runstate_info state = { 0 };
>> -    struct vcpu *v = idle_vcpu[cpu];
>> +    struct tacc *tacc = &per_cpu(tacc, cpu);
>> -    if ( cpu_online(cpu) && v )
>> -        vcpu_runstate_get(v, &state);
>> +    return tacc->state_time[TACC_IDLE];
> 
> So what's the difference between the current idle time and the new version?

Currently, idle time is the idle vcpu run time, what includes tasklets, scheduling, irq processing etc.
IMO it may confuse cpufreq and power management.

> 
>> +}
>> +
>> +uint64_t get_cpu_guest_time(unsigned int cpu)
>> +{
>> +    struct tacc *tacc = &per_cpu(tacc, cpu);
>> +
>> +    return tacc->state_time[TACC_GUEST];
>> +}
>> +
>> +uint64_t get_cpu_hyp_time(unsigned int cpu)
>> +{
>> +    struct tacc *tacc = &per_cpu(tacc, cpu);
>> +
>> +    return tacc->state_time[TACC_HYP];
>> +}
>> +
>> +uint64_t get_cpu_irq_time(unsigned int cpu)
>> +{
>> +    struct tacc *tacc = &per_cpu(tacc, cpu);
>> +
>> +    return tacc->state_time[TACC_IRQ];
>> +}
>> +uint64_t get_cpu_gsync_time(unsigned int cpu)
>> +{
>> +    struct tacc *tacc = &per_cpu(tacc, cpu);
>> -    return state.time[RUNSTATE_running];
>> +    return tacc->state_time[TACC_GSYNC];
>>   }
> 
> You may want to introduce an helper retrieving the time for a given state rather than duplicating it.

Yep.

> 
>>   /*
>> diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c
>> index 92b4ea0..b63083c 100644
>> --- a/xen/common/sysctl.c
>> +++ b/xen/common/sysctl.c
>> @@ -152,6 +152,10 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
>>           for ( i = 0; i < nr_cpus; i++ )
>>           {
>>               cpuinfo.idletime = get_cpu_idle_time(i);
>> +            cpuinfo.guesttime = get_cpu_guest_time(i);
>> +            cpuinfo.hyptime = get_cpu_hyp_time(i);
>> +            cpuinfo.gsynctime = get_cpu_gsync_time(i);
>> +            cpuinfo.irqtime = get_cpu_irq_time(i);
> 
> It feels to me we want a function that fills up the structure.

Maybe.

> 
>>               if ( copy_to_guest_offset(op->u.getcpuinfo.info, i, &cpuinfo, 1) )
>>                   goto out;
>> diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h
>> index 5401f9c..cdada1f 100644
>> --- a/xen/include/public/sysctl.h
>> +++ b/xen/include/public/sysctl.h
> 
> As a side note, SYSCTL version will need to be bumped if this wasn't done before during the current release.
> 
>> @@ -168,6 +168,10 @@ struct xen_sysctl_debug_keys {
>>   /* XEN_SYSCTL_getcpuinfo */
>>   struct xen_sysctl_cpuinfo {
>>       uint64_aligned_t idletime;
>> +    uint64_aligned_t hyptime;
>> +    uint64_aligned_t guesttime;
>> +    uint64_aligned_t irqtime;
>> +    uint64_aligned_t gsynctime;
>>   };
>>   typedef struct xen_sysctl_cpuinfo xen_sysctl_cpuinfo_t;
>>   DEFINE_XEN_GUEST_HANDLE(xen_sysctl_cpuinfo_t);
>> diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
>> index 04a8724..8167608 100644
>> --- a/xen/include/xen/sched.h
>> +++ b/xen/include/xen/sched.h
>> @@ -876,6 +876,10 @@ void restore_vcpu_affinity(struct domain *d);
>>   void vcpu_runstate_get(struct vcpu *v, struct vcpu_runstate_info *runstate);
>>   uint64_t get_cpu_idle_time(unsigned int cpu);
>> +uint64_t get_cpu_hyp_time(unsigned int cpu);
>> +uint64_t get_cpu_guest_time(unsigned int cpu);
>> +uint64_t get_cpu_gsync_time(unsigned int cpu);
>> +uint64_t get_cpu_irq_time(unsigned int cpu);
>>   /*
>>    * Used by idle loop to decide whether there is work to do:
>>
> 
> Cheers,
> 

-- 
Sincerely,
Andrii Anisov.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-11-06 11:26 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-11 10:32 [Xen-devel] [RFC 0/9] Changes to time accounting Andrii Anisov
2019-09-11 10:32 ` [Xen-devel] [RFC 1/9] schedule: Introduce per-pcpu " Andrii Anisov
2019-09-11 18:01   ` Volodymyr Babchuk
2019-09-12 10:26     ` Andrii Anisov
2019-10-28 14:28   ` Julien Grall
2019-11-06 11:24     ` Andrii Anisov
2020-05-26  2:27       ` Volodymyr Babchuk
2020-05-29  8:48         ` Dario Faggioli
2020-06-02  1:12           ` Volodymyr Babchuk
2020-06-03 15:22             ` Dario Faggioli
2019-09-11 10:32 ` [Xen-devel] [RFC 2/9] sysctl: extend XEN_SYSCTL_getcpuinfo interface Andrii Anisov
2019-10-28 14:52   ` Julien Grall
2019-11-06 11:25     ` Andrii Anisov [this message]
2019-09-11 10:32 ` [Xen-devel] [RFC 3/9] xentop: show CPU load information Andrii Anisov
2019-09-11 10:32 ` [Xen-devel] [RFC 4/9] arm64: utilize time accounting Andrii Anisov
2019-09-11 17:48   ` Volodymyr Babchuk
2019-09-12 12:09     ` Andrii Anisov
2019-09-12 12:17       ` Julien Grall
2019-09-12 12:29         ` Andrii Anisov
2019-10-28 14:47   ` Julien Grall
2019-11-06 11:31     ` Andrii Anisov
2019-09-11 10:32 ` [Xen-devel] [RFC 5/9] tacc: Introduce a lockless interface for guest time Andrii Anisov
2019-09-11 10:32 ` [Xen-devel] [RFC 6/9] sched:rtds: get guest time from time accounting code Andrii Anisov
2019-09-11 10:32 ` [Xen-devel] [RFC 7/9] tacc: Introduce a locked interface for guest time Andrii Anisov
2019-09-11 10:32 ` [Xen-devel] [RFC 8/9] sched:credit: get guest time from time accounting code Andrii Anisov
2019-09-11 10:32 ` [Xen-devel] [RFC 9/9] sched:credit2: " Andrii Anisov

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=beec2cdd-aa44-0059-28cc-cb6cc3276aae@gmail.com \
    --to=andrii.anisov@gmail.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=andrii_anisov@epam.com \
    --cc=dfaggioli@suse.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien.grall@arm.com \
    --cc=konrad.wilk@oracle.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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;
as well as URLs for NNTP newsgroup(s).