xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Huang <w1.huang@samsung.com>
To: Julien Grall <julien.grall@linaro.org>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>,
	xen-devel <xen-devel@lists.xen.org>
Subject: Re: [RFC v2 1/6] xen/arm: Save and restore support with hvm context hypercalls
Date: Tue, 13 May 2014 11:18:24 -0500	[thread overview]
Message-ID: <537245D0.2010908@samsung.com> (raw)
In-Reply-To: <53723D48.2050800@linaro.org>

On 05/13/2014 10:42 AM, Julien Grall wrote:
> (Adding back Xen devel)
>
> On 05/13/2014 04:31 PM, Wei Huang wrote:
>> On 05/12/2014 07:04 AM, Julien Grall wrote:
>>> On 05/12/2014 10:16 AM, Ian Campbell wrote:
>>>> On Thu, 2014-04-17 at 16:06 +0100, Julien Grall wrote:
>>>>> I thought a bit more about the {phys,virt}_timer_base.offset.
>>>>>
>>>>> When you are migrating a guest, this offset will be invalidated. This
>>>>> offset is used to get a relative offset from the Xen timer counter.
>>>>>
>>>>> That also made me think the context switch in Xen for the timer looks
>>>>> wrong to me.
>>>>>
>>>>> When a guest VCPU is context switch, the Xen timer counter continue to
>>>>> run. But not CVAL, so the timer_base.offset will drift a bit. It will
>>>>> result by setting a wrong timer via set_timer in Xen.
>>>>>
>>>>> Did I miss something?
>>>>
>>>> The timer offset is mainly accounting for the fact that the domain is
>>>> not booted when the hardware is started.
>>>>
>>>> However time does continue while a VCPU is not scheduled, this is
>>>> exposed via the PV "stolen time" mechanism.
>>>>
>>>> Now it is in theory possible to virtualise time differently so that
>>>> stolen time is not possible, but unless you want to cope with different
>>>> VCPUs seeing different times (because they have been descheduled for
>>>> differently lengths of times) then you either need to do gang scheduling
>>>> or play other (likely complicated) tricks. With the model we have on ARM
>>>> paravirtualising this is the right thing to do.
>>>>
>>>> Not sure what you mean about CVAL (the timer compare val) not running,
>>>> when we deschedule a VCPU we figure out when CVAL would have caused the
>>>> timer interrupt to fire and setup a Xen timer to make sure we unblock
>>>> the VCPU at that point. When we switch back to the VCPU we of course
>>>> restore the compare value to what the guest wrote, nothing else would
>>>> make sense.
>>>
>>> After reading your explanation and the ARM ARM again, I think I mingled
>>> CNT (the counter) and CVAL (the compare val).
>>>
>>> Thank you for the explanation.
>>>
>> Other than the code comments (case/switch), are you OK with the design
>> of the latest ARCH_TIMER patch?
>
> I made some comment on the v3. Once you will address comments from
> Andrew and me, the patch will be in good shape.
>
Given the comments from you and Andrew, I will revise the context struct 
to the following format. With this, we can get rid of most problems 
(switch/case/...).

struct hvm_arm_timer
{
     /* phys_timer */
     uint64_t phys_vtb_offset;
     uint64_t phys_cval;
     uint32_t phys_ctl;

     /* virt_timer */
     uint64_t virt_vtb_offset;
     uint64_t virt_cval;
     uint32_t virt_ctl;
};
DECLARE_HVM_SAVE_TYPE(TIMER, 4, struct hvm_arm_timer);

Any comments, please let me know.

> Regards,
>

  reply	other threads:[~2014-05-13 16:18 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-15 21:05 [RFC v2 0/6] xen/arm: Support guest VM save/restore/migration Wei Huang
2014-04-15 21:05 ` [RFC v2 1/6] xen/arm: Save and restore support with hvm context hypercalls Wei Huang
2014-04-15 23:37   ` Andrew Cooper
2014-04-16 21:50     ` Wei Huang
2014-04-17 12:55       ` Andrew Cooper
2014-04-16  9:48   ` Julien Grall
2014-04-16 10:30     ` Jan Beulich
2014-04-16 15:54       ` Wei Huang
2014-04-17 15:06   ` Julien Grall
2014-04-17 16:55     ` Wei Huang
2014-05-12  9:16     ` Ian Campbell
2014-05-12 12:04       ` Julien Grall
     [not found]         ` <53723ACC.8040402@samsung.com>
2014-05-13 15:42           ` Julien Grall
2014-05-13 16:18             ` Wei Huang [this message]
2014-05-13 16:37               ` Julien Grall
2014-05-13 16:44                 ` Wei Huang
2014-05-13 17:33                   ` Julien Grall
2014-04-15 21:05 ` [RFC v2 2/6] xen/arm: implement support for XENMEM_maximum_gpfn hypercall Wei Huang
2014-04-15 22:46   ` Julien Grall
2014-04-16 15:33     ` Wei Huang
2014-04-15 21:05 ` [RFC v2 3/6] xen/arm: support guest do_suspend function Wei Huang
2014-04-15 23:38   ` Andrew Cooper
2014-04-15 23:39   ` Andrew Cooper
2014-04-16  9:10   ` Julien Grall
2014-04-15 21:05 ` [RFC v2 4/6] xen/arm: Implement VLPT for guest p2m mapping in live migration Wei Huang
2014-04-15 22:29   ` Julien Grall
2014-04-15 23:40   ` Andrew Cooper
2014-04-22 17:54   ` Julien Grall
2014-04-15 21:05 ` [RFC v2 5/6] xen/arm: Implement hypercall for dirty page tracing Wei Huang
2014-04-15 23:38   ` Andrew Cooper
2014-04-15 21:05 ` [RFC v2 6/6] xen/arm: Implement toolstack for xl restore/save and migrate Wei Huang
2014-04-15 23:40   ` Andrew Cooper
2014-04-15 21:05 ` [RFC v2 0/6] xen/arm: Support guest VM save/restore/migration Wei Huang
2014-04-15 22:23   ` Julien Grall
2014-04-15 21:05 ` [RFC v2 1/6] xen/arm: Save and restore support with hvm context hypercalls Wei Huang
2014-04-15 21:05 ` [RFC v2 2/6] xen/arm: implement support for XENMEM_maximum_gpfn hypercall Wei Huang
2014-04-15 21:05 ` [RFC v2 3/6] xen/arm: support guest do_suspend function Wei Huang
2014-04-15 21:05 ` [RFC v2 4/6] xen/arm: Implement VLPT for guest p2m mapping in live migration Wei Huang
2014-04-15 21:05 ` [RFC v2 5/6] xen/arm: Implement hypercall for dirty page tracing Wei Huang
2014-04-15 23:35   ` Julien Grall
2014-04-23 11:59   ` Julien Grall
2014-04-15 21:05 ` [RFC v2 6/6] xen/arm: Implement toolstack for xl restore/save and migrate Wei Huang
2014-04-16 16:29 ` [RFC v2 0/6] xen/arm: Support guest VM save/restore/migration Julien Grall
2014-04-16 16:41   ` Wei Huang
2014-04-16 16:50     ` Julien Grall
2014-04-23 11:49 ` Ian Campbell
2014-04-23 18:41   ` Wei Huang

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=537245D0.2010908@samsung.com \
    --to=w1.huang@samsung.com \
    --cc=ian.campbell@citrix.com \
    --cc=julien.grall@linaro.org \
    --cc=stefano.stabellini@eu.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).