All of lore.kernel.org
 help / color / mirror / Atom feed
* A simple question regarding hvm_context_save
@ 2013-05-31 10:46 Jaeyong Yoo
  2013-05-31 10:53 ` Ian Campbell
  2013-05-31 10:55 ` Andrew Cooper
  0 siblings, 2 replies; 3+ messages in thread
From: Jaeyong Yoo @ 2013-05-31 10:46 UTC (permalink / raw)
  To: xen-devel

Hello,
I'm reading live migration related code and got a simple question 
in function hvm_context_save:

static int hvm_save_cpu_ctxt(struct domain *d, hvm_domain_context_t *h)
{
blah...
        /* We don't need to save state for a vcpu that is down; the restore 
         * code will leave it down if there is nothing saved. */
        if ( test_bit(_VPF_down, &v->pause_flags) )
            continue;
blah...

In the above, if the vcpu is paused, we don't need to store cpu registers
(since vcpu structure already stored them). But, as far as I know, before
we save the hvm context, we suspend the domain, which calls shutdown 
sched_op, and the vcpu is paused. 
Then, I guess testing pause_flags always returns down and we don't
need to store cpu ctxts. Do I miss something here?

best,
Jaeyong

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: A simple question regarding hvm_context_save
  2013-05-31 10:46 A simple question regarding hvm_context_save Jaeyong Yoo
@ 2013-05-31 10:53 ` Ian Campbell
  2013-05-31 10:55 ` Andrew Cooper
  1 sibling, 0 replies; 3+ messages in thread
From: Ian Campbell @ 2013-05-31 10:53 UTC (permalink / raw)
  To: jaeyong.yoo; +Cc: xen-devel

On Fri, 2013-05-31 at 10:46 +0000, Jaeyong Yoo wrote:
> Hello,
> I'm reading live migration related code and got a simple question 
> in function hvm_context_save:
> 
> static int hvm_save_cpu_ctxt(struct domain *d, hvm_domain_context_t *h)
> {
> blah...
>         /* We don't need to save state for a vcpu that is down; the restore 
>          * code will leave it down if there is nothing saved. */
>         if ( test_bit(_VPF_down, &v->pause_flags) )
>             continue;
> blah...
> 
> In the above, if the vcpu is paused, we don't need to store cpu registers
> (since vcpu structure already stored them). But, as far as I know, before
> we save the hvm context, we suspend the domain, which calls shutdown 
> sched_op, and the vcpu is paused. 
> Then, I guess testing pause_flags always returns down and we don't
> need to store cpu ctxts. Do I miss something here?

I don't think _VPF_down == paused. Rather it indicates that the VCPU is
"down" in the sense of having been hot unplugged.

In other words we only skip saving the CPU state if the CPU is not
actually in use by the guest, otherwise it does need saving.

Pausing a domain changes the vcpu's runstate, but doesn't affect
pause_flags. Or at least I think that is the case, I've only had a quick
look.

Ian.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: A simple question regarding hvm_context_save
  2013-05-31 10:46 A simple question regarding hvm_context_save Jaeyong Yoo
  2013-05-31 10:53 ` Ian Campbell
@ 2013-05-31 10:55 ` Andrew Cooper
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Cooper @ 2013-05-31 10:55 UTC (permalink / raw)
  To: jaeyong.yoo; +Cc: xen-devel

On 31/05/13 11:46, Jaeyong Yoo wrote:
> Hello,
> I'm reading live migration related code and got a simple question 
> in function hvm_context_save:
>
> static int hvm_save_cpu_ctxt(struct domain *d, hvm_domain_context_t *h)
> {
> blah...
>         /* We don't need to save state for a vcpu that is down; the restore 
>          * code will leave it down if there is nothing saved. */
>         if ( test_bit(_VPF_down, &v->pause_flags) )
>             continue;
> blah...
>
> In the above, if the vcpu is paused, we don't need to store cpu registers
> (since vcpu structure already stored them). But, as far as I know, before
> we save the hvm context, we suspend the domain, which calls shutdown 
> sched_op, and the vcpu is paused. 

_VPF_down is only one possible pause reason.  See
xen/include/xen/sched.h for all of them.

In particular, _VPF_migrating is a different pause reason.

If a VCPU is down, the guest is required to reinitialise it from
scratch.  This is why the state does not need saving.

~Andrew

> Then, I guess testing pause_flags always returns down and we don't
> need to store cpu ctxts. Do I miss something here?
>
> best,
> Jaeyong
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-05-31 10:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-31 10:46 A simple question regarding hvm_context_save Jaeyong Yoo
2013-05-31 10:53 ` Ian Campbell
2013-05-31 10:55 ` Andrew Cooper

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.