public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* live migration between kernel/user irqchip
@ 2007-07-19 13:52 Dong, Eddie
       [not found] ` <10EA09EFD8728347A513008B6B0DA77A01CBE671-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Dong, Eddie @ 2007-07-19 13:52 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

When thinking about live migration support for in kernel irqchip, one
question comes out which need to be solved first:
Do we need to support live migration among user level irqchip and kernel
level? If the answer is yes, kernel level irqchip must keep same state
with user level, i.e. if Qemu changes the pic/apic/ioapic state
definition, we need to do corresponding changes too, otherwise kernel
side can stay as it is.
thx,eddie

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

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

* Re: live migration between kernel/user irqchip
       [not found] ` <10EA09EFD8728347A513008B6B0DA77A01CBE671-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2007-07-19 14:04   ` Avi Kivity
       [not found]     ` <469F6F83.3060700-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Avi Kivity @ 2007-07-19 14:04 UTC (permalink / raw)
  To: Dong, Eddie; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Dong, Eddie wrote:
> When thinking about live migration support for in kernel irqchip, one
> question comes out which need to be solved first:
> Do we need to support live migration among user level irqchip and kernel
> level? 

Yes.

> If the answer is yes, kernel level irqchip must keep same state
> with user level, i.e. if Qemu changes the pic/apic/ioapic state
> definition, we need to do corresponding changes too, otherwise kernel
> side can stay as it is.
>   

The qemu state mimics the device state and should be independent of 
implementation details.  If the qemu state is added too, this most 
likely indicates a but that needs to be fixed in kvm as well.

The best way to do live migration is to copy the kernel state into the 
qemu device model, and let qemu do state serialization.  This ensures 
compatibility.

-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

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

* Re: live migration between kernel/user irqchip
       [not found]     ` <469F6F83.3060700-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-07-19 14:13       ` Dong, Eddie
       [not found]         ` <10EA09EFD8728347A513008B6B0DA77A01CBE67A-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Dong, Eddie @ 2007-07-19 14:13 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Avi Kivity wrote:
> Dong, Eddie wrote:
>> When thinking about live migration support for in kernel irqchip, one
>> question comes out which need to be solved first:
>> Do we need to support live migration among user level irqchip and
>> kernel level?
> 
> Yes.
> 
>> If the answer is yes, kernel level irqchip must keep same state
>> with user level, i.e. if Qemu changes the pic/apic/ioapic state
>> definition, we need to do corresponding changes too, otherwise
>> kernel side can stay as it is. 
>> 
> 
> The qemu state mimics the device state and should be independent of
> implementation details.  If the qemu state is added too, this most
> likely indicates a but that needs to be fixed in kvm as well.
> 
> The best way to do live migration is to copy the kernel state into the
> qemu device model, and let qemu do state serialization.  This ensures

"copy" means we define some device "state" both in kernel & user. 
I.e.  kernel use user level state definition.

> compatibility. 
> 
> --
> error compiling committee.c: too many arguments to function

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

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

* Re: live migration between kernel/user irqchip
       [not found]         ` <10EA09EFD8728347A513008B6B0DA77A01CBE67A-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2007-07-19 14:24           ` Avi Kivity
       [not found]             ` <469F7432.5050806-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Avi Kivity @ 2007-07-19 14:24 UTC (permalink / raw)
  To: Dong, Eddie; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Dong, Eddie wrote:
> Avi Kivity wrote:
>   
>> Dong, Eddie wrote:
>>     
>>> When thinking about live migration support for in kernel irqchip, one
>>> question comes out which need to be solved first:
>>> Do we need to support live migration among user level irqchip and
>>> kernel level?
>>>       
>> Yes.
>>
>>     
>>> If the answer is yes, kernel level irqchip must keep same state
>>> with user level, i.e. if Qemu changes the pic/apic/ioapic state
>>> definition, we need to do corresponding changes too, otherwise
>>> kernel side can stay as it is. 
>>>
>>>       
>> The qemu state mimics the device state and should be independent of
>> implementation details.  If the qemu state is added too, this most
>> likely indicates a but that needs to be fixed in kvm as well.
>>
>> The best way to do live migration is to copy the kernel state into the
>> qemu device model, and let qemu do state serialization.  This ensures
>>     
>
> "copy" means we define some device "state" both in kernel & user. 
> I.e.  kernel use user level state definition.
>   

Sorry, I don't understand.

Here's apic_save(), for example:

static void apic_save(QEMUFile *f, void *opaque)
{
    APICState *s = opaque;
    int i;

    qemu_put_be32s(f, &s->apicbase);
    qemu_put_8s(f, &s->id);
    qemu_put_8s(f, &s->arb_id);
    qemu_put_8s(f, &s->tpr);
    qemu_put_be32s(f, &s->spurious_vec);
    qemu_put_8s(f, &s->log_dest);
    qemu_put_8s(f, &s->dest_mode);
    for (i = 0; i < 8; i++) {
        qemu_put_be32s(f, &s->isr[i]);
        qemu_put_be32s(f, &s->tmr[i]);
        qemu_put_be32s(f, &s->irr[i]);
    }
    for (i = 0; i < APIC_LVT_NB; i++) {
        qemu_put_be32s(f, &s->lvt[i]);
    }
    qemu_put_be32s(f, &s->esr);
    qemu_put_be32s(f, &s->icr[0]);
    qemu_put_be32s(f, &s->icr[1]);
    qemu_put_be32s(f, &s->divide_conf);
    qemu_put_be32s(f, &s->count_shift);
    qemu_put_be32s(f, &s->initial_count);
    qemu_put_be64s(f, &s->initial_count_load_time);
    qemu_put_be64s(f, &s->next_time);

    qemu_put_timer(f, s->timer);
}

Do you see state here that does not exist in the kernel?  Or kernel 
state that is missing from here?

->timer and ->next_time may be non-trivial, but both are needed.

-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

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

* Re: live migration between kernel/user irqchip
       [not found]             ` <469F7432.5050806-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-07-20  9:18               ` Dong, Eddie
       [not found]                 ` <10EA09EFD8728347A513008B6B0DA77A01CBEB95-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Dong, Eddie @ 2007-07-20  9:18 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

>> 
>> "copy" means we define some device "state" both in kernel & user.
>> I.e.  kernel use user level state definition.
>> 
> 
> Sorry, I don't understand.
> 
> Here's apic_save(), for example:
> 
> static void apic_save(QEMUFile *f, void *opaque)
> {
>    APICState *s = opaque;
>    int i;
> 
>    qemu_put_be32s(f, &s->apicbase);
>    qemu_put_8s(f, &s->id);
>    qemu_put_8s(f, &s->arb_id);
>    qemu_put_8s(f, &s->tpr);
>    qemu_put_be32s(f, &s->spurious_vec);
>    qemu_put_8s(f, &s->log_dest);
>    qemu_put_8s(f, &s->dest_mode);
>    for (i = 0; i < 8; i++) {
>        qemu_put_be32s(f, &s->isr[i]);
>        qemu_put_be32s(f, &s->tmr[i]);
>        qemu_put_be32s(f, &s->irr[i]);
>    }
>    for (i = 0; i < APIC_LVT_NB; i++) {
>        qemu_put_be32s(f, &s->lvt[i]);
>    }
>    qemu_put_be32s(f, &s->esr);
>    qemu_put_be32s(f, &s->icr[0]);
>    qemu_put_be32s(f, &s->icr[1]);
>    qemu_put_be32s(f, &s->divide_conf);
>    qemu_put_be32s(f, &s->count_shift);
>    qemu_put_be32s(f, &s->initial_count);
>    qemu_put_be64s(f, &s->initial_count_load_time);
>    qemu_put_be64s(f, &s->next_time);
> 
>    qemu_put_timer(f, s->timer);
> }
> 
> Do you see state here that does not exist in the kernel?  Or kernel
> state that is missing from here?
> 
> ->timer and ->next_time may be non-trivial, but both are needed.
> 

timer state is different, krenel uses hrtimer. But maybe not that
critical.

Maybe I didn't exactly understand what "copy" means for you. There are 2
ways 
in my mind to do save/restore:
1:  We provide a new apic_load/apic_save function. In this function we
may convert kernel state into user level state.


2: We use user level apic_load/apic_save, but at some point we read the
whole kernel state and then copy to user level APICState data structure
(use save as example).  IN this way normal user level save/load will
service us, but then kernel side struct kvm_apic should be same with
APICState.

BTW, we will take half week leave next week, will u work on apic too?
thx,eddie

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

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

* Re: live migration between kernel/user irqchip
       [not found]                 ` <10EA09EFD8728347A513008B6B0DA77A01CBEB95-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2007-07-20  9:26                   ` Avi Kivity
       [not found]                     ` <46A07FB6.8030603-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Avi Kivity @ 2007-07-20  9:26 UTC (permalink / raw)
  To: Dong, Eddie; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Dong, Eddie wrote:
>>> "copy" means we define some device "state" both in kernel & user.
>>> I.e.  kernel use user level state definition.
>>>
>>>       
>> Sorry, I don't understand.
>>
>> Here's apic_save(), for example:
>>
>> static void apic_save(QEMUFile *f, void *opaque)
>> {
>>    APICState *s = opaque;
>>    int i;
>>
>>    qemu_put_be32s(f, &s->apicbase);
>>    qemu_put_8s(f, &s->id);
>>    qemu_put_8s(f, &s->arb_id);
>>    qemu_put_8s(f, &s->tpr);
>>    qemu_put_be32s(f, &s->spurious_vec);
>>    qemu_put_8s(f, &s->log_dest);
>>    qemu_put_8s(f, &s->dest_mode);
>>    for (i = 0; i < 8; i++) {
>>        qemu_put_be32s(f, &s->isr[i]);
>>        qemu_put_be32s(f, &s->tmr[i]);
>>        qemu_put_be32s(f, &s->irr[i]);
>>    }
>>    for (i = 0; i < APIC_LVT_NB; i++) {
>>        qemu_put_be32s(f, &s->lvt[i]);
>>    }
>>    qemu_put_be32s(f, &s->esr);
>>    qemu_put_be32s(f, &s->icr[0]);
>>    qemu_put_be32s(f, &s->icr[1]);
>>    qemu_put_be32s(f, &s->divide_conf);
>>    qemu_put_be32s(f, &s->count_shift);
>>    qemu_put_be32s(f, &s->initial_count);
>>    qemu_put_be64s(f, &s->initial_count_load_time);
>>    qemu_put_be64s(f, &s->next_time);
>>
>>    qemu_put_timer(f, s->timer);
>> }
>>
>> Do you see state here that does not exist in the kernel?  Or kernel
>> state that is missing from here?
>>
>> ->timer and ->next_time may be non-trivial, but both are needed.
>>
>>     
>
> timer state is different, krenel uses hrtimer. But maybe not that
> critical.
>
> Maybe I didn't exactly understand what "copy" means for you. There are 2
> ways 
> in my mind to do save/restore:
> 1:  We provide a new apic_load/apic_save function. In this function we
> may convert kernel state into user level state.
>
>
> 2: We use user level apic_load/apic_save, but at some point we read the
> whole kernel state and then copy to user level APICState data structure
> (use save as example).  IN this way normal user level save/load will
> service us, but then kernel side struct kvm_apic should be same with
> APICState.
>   

This is what I'd like.  The kernel apic state doesn't have to be exactly
equal to APICState; we just have to write functions to convert into
APICState and back.  That ensures the protocol doesn't change.

(in this way we can even switch kernel apic on and off at runtime (not
that we want to)).


> BTW, we will take half week leave next week, will u work on apic too?
> thx,eddie
>   

Yes.  Let me know when you leave so we don't conflict.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

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

* Re: live migration between kernel/user irqchip
       [not found]                     ` <46A07FB6.8030603-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-07-20  9:36                       ` Dong, Eddie
  0 siblings, 0 replies; 7+ messages in thread
From: Dong, Eddie @ 2007-07-20  9:36 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

> 
> This is what I'd like.  The kernel apic state doesn't have to
> be exactly
> equal to APICState; we just have to write functions to convert into
> APICState and back.  That ensures the protocol doesn't change.
> 
> (in this way we can even switch kernel apic on and off at runtime
> (not that we want to)). 
> 
> 
>> BTW, we will take half week leave next week, will u work on apic
>> too? thx,eddie 
>> 
> 
> Yes.  Let me know when you leave so we don't conflict.
> 
I will leave next Tuesday evening :-(

BTW, can anybody do more testing on stability of lapic2 branch after
you pulled in 3 pending patches? I will ask Intel guys to do too. I 
expect there will have some time to get it into certain level of
stability.
Eddie

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

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

end of thread, other threads:[~2007-07-20  9:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-19 13:52 live migration between kernel/user irqchip Dong, Eddie
     [not found] ` <10EA09EFD8728347A513008B6B0DA77A01CBE671-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-07-19 14:04   ` Avi Kivity
     [not found]     ` <469F6F83.3060700-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-07-19 14:13       ` Dong, Eddie
     [not found]         ` <10EA09EFD8728347A513008B6B0DA77A01CBE67A-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-07-19 14:24           ` Avi Kivity
     [not found]             ` <469F7432.5050806-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-07-20  9:18               ` Dong, Eddie
     [not found]                 ` <10EA09EFD8728347A513008B6B0DA77A01CBEB95-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-07-20  9:26                   ` Avi Kivity
     [not found]                     ` <46A07FB6.8030603-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-07-20  9:36                       ` Dong, Eddie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox