From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 4/4] xen/arm: account for stolen ticks
Date: Wed, 08 May 2013 17:07:18 +0100 [thread overview]
Message-ID: <518A7836.4030705@arm.com> (raw)
In-Reply-To: <1368027714-14506-4-git-send-email-stefano.stabellini@eu.citrix.com>
Hi Stefano,
On 08/05/13 16:41, Stefano Stabellini wrote:
> Register the runstate_memory_area with the hypervisor.
> Use pv_time_ops.steal_clock to account for stolen ticks.
>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
>
> Changes in v3:
> - use BUG_ON and smp_processor_id.
> ---
> arch/arm/xen/enlighten.c | 22 ++++++++++++++++++++++
> 1 files changed, 22 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
> index 13609e0..dfa7738 100644
> --- a/arch/arm/xen/enlighten.c
> +++ b/arch/arm/xen/enlighten.c
> @@ -14,7 +14,10 @@
> #include <xen/xen-ops.h>
> #include <asm/xen/hypervisor.h>
> #include <asm/xen/hypercall.h>
> +#include <asm/arch_timer.h>
> #include <asm/system_misc.h>
> +#include <asm/paravirt.h>
> +#include <linux/jump_label.h>
> #include <linux/interrupt.h>
> #include <linux/irqreturn.h>
> #include <linux/module.h>
> @@ -152,6 +155,19 @@ int xen_unmap_domain_mfn_range(struct vm_area_struct *vma,
> }
> EXPORT_SYMBOL_GPL(xen_unmap_domain_mfn_range);
>
> +unsigned long long xen_stolen_accounting(int cpu)
> +{
> + struct vcpu_runstate_info state;
> +
> + BUG_ON(cpu != smp_processor_id());
> +
> + xen_get_runstate_snapshot(&state);
> +
> + WARN_ON(state.state != RUNSTATE_running);
> +
> + return state.time[RUNSTATE_runnable] + state.time[RUNSTATE_offline];
> +}
> +
> static void __init xen_percpu_init(void *unused)
> {
> struct vcpu_register_vcpu_info info;
> @@ -169,6 +185,8 @@ static void __init xen_percpu_init(void *unused)
> BUG_ON(err);
> per_cpu(xen_vcpu, cpu) = vcpup;
>
> + xen_setup_runstate_info(cpu);
> +
> enable_percpu_irq(xen_events_irq, 0);
> }
>
> @@ -300,6 +318,10 @@ static int __init xen_init_events(void)
>
> on_each_cpu(xen_percpu_init, NULL, 0);
>
> + pv_time_ops.steal_clock = xen_stolen_accounting;
What guarantee do we have that this is done before the rest of the
kernel calls paravirt_steal_clock()? What if we have Xen support enabled
but don't run as a Xen guest?
> + static_key_slow_inc(¶virt_steal_enabled);
> + static_key_slow_inc(¶virt_steal_rq_enabled);
> +
> return 0;
> }
> postcore_initcall(xen_init_events);
>
Thanks,
M.
--
Jazz is not dead. It just smells funny...
WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <marc.zyngier@arm.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"konrad.wilk@oracle.com" <konrad.wilk@oracle.com>,
Will Deacon <Will.Deacon@arm.com>
Subject: Re: [PATCH v3 4/4] xen/arm: account for stolen ticks
Date: Wed, 08 May 2013 17:07:18 +0100 [thread overview]
Message-ID: <518A7836.4030705@arm.com> (raw)
In-Reply-To: <1368027714-14506-4-git-send-email-stefano.stabellini@eu.citrix.com>
Hi Stefano,
On 08/05/13 16:41, Stefano Stabellini wrote:
> Register the runstate_memory_area with the hypervisor.
> Use pv_time_ops.steal_clock to account for stolen ticks.
>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
>
> Changes in v3:
> - use BUG_ON and smp_processor_id.
> ---
> arch/arm/xen/enlighten.c | 22 ++++++++++++++++++++++
> 1 files changed, 22 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
> index 13609e0..dfa7738 100644
> --- a/arch/arm/xen/enlighten.c
> +++ b/arch/arm/xen/enlighten.c
> @@ -14,7 +14,10 @@
> #include <xen/xen-ops.h>
> #include <asm/xen/hypervisor.h>
> #include <asm/xen/hypercall.h>
> +#include <asm/arch_timer.h>
> #include <asm/system_misc.h>
> +#include <asm/paravirt.h>
> +#include <linux/jump_label.h>
> #include <linux/interrupt.h>
> #include <linux/irqreturn.h>
> #include <linux/module.h>
> @@ -152,6 +155,19 @@ int xen_unmap_domain_mfn_range(struct vm_area_struct *vma,
> }
> EXPORT_SYMBOL_GPL(xen_unmap_domain_mfn_range);
>
> +unsigned long long xen_stolen_accounting(int cpu)
> +{
> + struct vcpu_runstate_info state;
> +
> + BUG_ON(cpu != smp_processor_id());
> +
> + xen_get_runstate_snapshot(&state);
> +
> + WARN_ON(state.state != RUNSTATE_running);
> +
> + return state.time[RUNSTATE_runnable] + state.time[RUNSTATE_offline];
> +}
> +
> static void __init xen_percpu_init(void *unused)
> {
> struct vcpu_register_vcpu_info info;
> @@ -169,6 +185,8 @@ static void __init xen_percpu_init(void *unused)
> BUG_ON(err);
> per_cpu(xen_vcpu, cpu) = vcpup;
>
> + xen_setup_runstate_info(cpu);
> +
> enable_percpu_irq(xen_events_irq, 0);
> }
>
> @@ -300,6 +318,10 @@ static int __init xen_init_events(void)
>
> on_each_cpu(xen_percpu_init, NULL, 0);
>
> + pv_time_ops.steal_clock = xen_stolen_accounting;
What guarantee do we have that this is done before the rest of the
kernel calls paravirt_steal_clock()? What if we have Xen support enabled
but don't run as a Xen guest?
> + static_key_slow_inc(¶virt_steal_enabled);
> + static_key_slow_inc(¶virt_steal_rq_enabled);
> +
> return 0;
> }
> postcore_initcall(xen_init_events);
>
Thanks,
M.
--
Jazz is not dead. It just smells funny...
next prev parent reply other threads:[~2013-05-08 16:07 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-08 13:50 [PATCH v3 0/4] xen/arm: CONFIG_PARAVIRT and stolen ticks accounting Stefano Stabellini
2013-05-08 13:50 ` Stefano Stabellini
2013-05-08 15:41 ` [PATCH v3 1/4] xen: move xen_setup_runstate_info and get_runstate_snapshot to drivers/xen/time.c Stefano Stabellini
2013-05-08 15:41 ` Stefano Stabellini
2013-05-08 15:41 ` Stefano Stabellini
2013-05-08 17:54 ` Konrad Rzeszutek Wilk
2013-05-08 17:54 ` Konrad Rzeszutek Wilk
2013-05-08 17:54 ` Konrad Rzeszutek Wilk
2013-05-08 18:13 ` Stefano Stabellini
2013-05-08 18:13 ` Stefano Stabellini
2013-05-09 8:12 ` [Xen-devel] " Ian Campbell
2013-05-09 8:12 ` Ian Campbell
2013-05-08 15:41 ` [PATCH v3 2/4] kernel: missing include in cputime.c Stefano Stabellini
2013-05-08 15:41 ` Stefano Stabellini
2013-05-08 15:41 ` Stefano Stabellini
2013-05-08 15:41 ` [PATCH v3 3/4] arm: introduce CONFIG_PARAVIRT, PARAVIRT_TIME_ACCOUNTING and pv_time_ops Stefano Stabellini
2013-05-08 15:41 ` Stefano Stabellini
2013-05-08 15:41 ` Stefano Stabellini
2013-05-08 16:03 ` Marc Zyngier
2013-05-08 16:03 ` Marc Zyngier
2013-05-08 16:07 ` Stefano Stabellini
2013-05-08 16:07 ` Stefano Stabellini
2013-05-08 15:41 ` [PATCH v3 4/4] xen/arm: account for stolen ticks Stefano Stabellini
2013-05-08 15:41 ` Stefano Stabellini
2013-05-08 15:41 ` Stefano Stabellini
2013-05-08 16:07 ` Marc Zyngier [this message]
2013-05-08 16:07 ` Marc Zyngier
2013-05-08 17:03 ` Stefano Stabellini
2013-05-08 17:03 ` Stefano Stabellini
2013-05-09 8:12 ` [Xen-devel] " Ian Campbell
2013-05-09 8:12 ` Ian Campbell
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=518A7836.4030705@arm.com \
--to=marc.zyngier@arm.com \
--cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.