From: Ian Campbell <ian.campbell@citrix.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: julien.grall@citrix.com, wei.liu2@citrix.com,
andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com,
xen-devel@lists.xen.org
Subject: Re: [PATCH RFC XEN v1 08/14] xen: arm: Save and restore arch timer state.
Date: Wed, 16 Dec 2015 16:02:36 +0000 [thread overview]
Message-ID: <1450281756.4053.65.camel@citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1512161510070.17516@kaball.uk.xensource.com>
On Wed, 2015-12-16 at 15:53 +0000, Stefano Stabellini wrote:
> On Wed, 9 Dec 2015, Ian Campbell wrote:
> > Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> > ---
> > xen/arch/arm/vtimer.c | 72
> > ++++++++++++++++++++++++++++++++++
> > xen/include/public/arch-arm/hvm/save.h | 15 ++++++-
> > 2 files changed, 86 insertions(+), 1 deletion(-)
> >
> > diff --git a/xen/arch/arm/vtimer.c b/xen/arch/arm/vtimer.c
> > index 629feb4..9dfc699 100644
> > --- a/xen/arch/arm/vtimer.c
> > +++ b/xen/arch/arm/vtimer.c
> > @@ -22,6 +22,7 @@
> > #include <xen/timer.h>
> > #include <xen/sched.h>
> > #include <xen/perfc.h>
> > +#include <xen/hvm/save.h>
> > #include <asm/div64.h>
> > #include <asm/irq.h>
> > #include <asm/time.h>
> > @@ -355,6 +356,77 @@ int vtimer_emulate(struct cpu_user_regs *regs,
> > union hsr hsr)
> > }
> > }
> >
> > +static int timer_save_one(hvm_domain_context_t *h,
> > + struct vcpu *v, struct vtimer *t,
> > + int type, uint64_t offset)
> > +{
> > + struct hvm_hw_timer ctxt;
> > +
> > + ctxt.cval = t->cval;
> > + ctxt.ctl = t->ctl;
> > + ctxt.vtb_offset = offset;
> > + ctxt.type = type;
> > + if ( hvm_save_entry(A15_TIMER, v->vcpu_id, h, &ctxt) != 0 )
> > + return 1;
> > + return 0;
> > +}
> > +
> > +static int timer_save(struct domain *d, hvm_domain_context_t *h)
> > +{
> > + struct vcpu *v;
> > +
> > + /* Save the state of vtimer and ptimer */
> > + for_each_vcpu( d, v )
> > + {
> > + timer_save_one(h, v, &v->arch.phys_timer,
> > + HVM_SAVE_TIMER_TYPE_PHYS, d-
> > >arch.phys_timer_base.offset);
> > + timer_save_one(h, v, &v->arch.virt_timer,
> > + HVM_SAVE_TIMER_TYPE_VIRT, d-
> > >arch.virt_timer_base.offset);
> > + }
>
> I don't think we should save phys_timer_base.offset and
> virt_timer_base.offset: they represent host specific offsets. I think we
> need to save:
>
> phys_timer:
> ctxt.offset = NOW() - d->arch.phys_timer_base.offset;
> virt_timer:
> ctxt.offset = READ_SYSREG64(CNTPCT_EL0) - d-
> >arch.virt_timer_base.offset
Yes, I meant to come back to this (and the restore side) with a bigger
thinking cap on and forgot.
> > +#define HVM_SAVE_TIMER_TYPE_VIRT 0
> > +#define HVM_SAVE_TIMER_TYPE_PHYS 1
> > +
> > +struct hvm_hw_timer
> > +{
> > + uint64_t vtb_offset; /* XXX Should be abs time since guest booted
> > */
>
> I would call this simply "offset" with a comment
OK. The comment here was supposed to remind me about the bigger thinking
cap. Oops.
> > + uint32_t ctl;
> > + uint64_t cval;
> > + uint32_t type;
>
> Isn't a uint32_t a bit too much for one bit?
> Don't we need to save and restore the PPIs too?
This is an ABI, so I wanted to avoid bit fields etc, I could make it a
uint8_t but then array alignment gets interesting. Really I guess this is
actually a uint8_t and 3 bytes of padding.
I don't think the save record format has density of the information as a
particularly high priority though.
The PPI state is saved by the GIC. Perhaps we should save the actual number
used by the guest here though.
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2015-12-16 16:02 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-09 14:31 [PATCH RFC v1 00/14] xen: arm: support for save restore and dead migration Ian Campbell
2015-12-09 14:32 ` [PATCH RFC XEN v1 01/14] xen: arm: Add gic_hw_desc Ian Campbell
2015-12-15 16:15 ` Stefano Stabellini
2015-12-15 16:21 ` Ian Campbell
2015-12-15 16:35 ` Andrew Cooper
2015-12-15 16:56 ` Ian Campbell
2015-12-09 14:32 ` [PATCH RFC XEN v1 02/14] xen: arm: Provide a mechanism to read (and decode) an LR from a saved VCPU Ian Campbell
2015-12-15 16:22 ` Stefano Stabellini
2015-12-09 14:32 ` [PATCH RFC XEN v1 03/14] xen: arm: switch arch_do_domctl to a common exit path Ian Campbell
2015-12-15 16:34 ` Stefano Stabellini
2015-12-15 16:57 ` Ian Campbell
2015-12-15 17:07 ` Andrew Cooper
2015-12-15 17:11 ` Jan Beulich
2015-12-09 14:32 ` [PATCH RFC XEN v1 04/14] xen: arm: Implement XEN_DOMCTL_getpageframeinfo3 Ian Campbell
2015-12-15 16:44 ` Stefano Stabellini
2015-12-09 14:32 ` [PATCH RFC XEN v1 05/14] xen: arm: Implement basic XEN_DOMCTL_{set, get}hvmcontext support Ian Campbell
2015-12-15 18:00 ` Stefano Stabellini
2015-12-16 10:18 ` Ian Campbell
2015-12-09 14:32 ` [PATCH RFC XEN v1 06/14] xen: arm: Add some basic platform info to save header Ian Campbell
2015-12-15 18:37 ` Stefano Stabellini
2015-12-16 10:20 ` Ian Campbell
2015-12-09 14:32 ` [PATCH RFC XEN v1 07/14] xen: arm: Save and restore basic per-VCPU state Ian Campbell
2015-12-16 14:55 ` Stefano Stabellini
2015-12-16 15:04 ` Ian Campbell
2015-12-09 14:32 ` [PATCH RFC XEN v1 08/14] xen: arm: Save and restore arch timer state Ian Campbell
2015-12-16 15:53 ` Stefano Stabellini
2015-12-16 16:02 ` Ian Campbell [this message]
2015-12-16 16:17 ` Julien Grall
2015-12-16 16:37 ` Ian Campbell
2015-12-16 18:05 ` Stefano Stabellini
2015-12-17 9:33 ` Ian Campbell
2015-12-09 14:32 ` [PATCH RFC XEN v1 09/14] xen: arm: Save and restore GIC state Ian Campbell
2015-12-16 18:30 ` Stefano Stabellini
2015-12-17 9:54 ` Ian Campbell
2015-12-22 16:44 ` Stefano Stabellini
2015-12-09 14:32 ` [PATCH RFC XEN v1 10/14] tools: Switch a few CONFIG_MIGRATE features to CONFIG_X86 Ian Campbell
2015-12-09 15:16 ` Andrew Cooper
2015-12-09 14:32 ` [PATCH RFC XEN v1 11/14] tools: migrate: refactor selection of save/restore ops to be arch specific Ian Campbell
2015-12-09 15:26 ` Andrew Cooper
2015-12-09 15:33 ` Ian Campbell
2015-12-09 14:32 ` [PATCH RFC XEN v1 12/14] tools: libxc: implement modify_returncode for ARM Ian Campbell
2015-12-16 16:22 ` Stefano Stabellini
2015-12-16 16:36 ` Ian Campbell
2015-12-09 14:32 ` [PATCH RFC XEN v1 13/14] tools: libxc: wire up migration " Ian Campbell
2015-12-09 15:48 ` Andrew Cooper
2015-12-09 14:32 ` [PATCH RFC XEN v1 14/14] tools/libxl: BODGE ARM save/restore and (dead) migration Ian Campbell
2015-12-09 14:33 ` [PATCH RFC LINUX v1] xen: arm: enable migration on ARM Ian Campbell
2016-01-06 17:47 ` Stefano Stabellini
2016-01-06 17:57 ` Stefano Stabellini
2016-01-07 9:47 ` Ian Campbell
2016-01-07 9:43 ` Ian Campbell
2016-01-06 17:55 ` Stefano Stabellini
2016-01-07 9:47 ` Ian Campbell
2016-01-07 11:32 ` Stefano Stabellini
2015-12-09 15:51 ` [PATCH RFC v1 00/14] xen: arm: support for save restore and dead migration Andrew Cooper
2015-12-09 16:09 ` 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=1450281756.4053.65.camel@citrix.com \
--to=ian.campbell@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=julien.grall@citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.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).