qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH]: Fix i2c_bus_save, which fixes KVM live migration
@ 2008-07-29  6:55 Chris Lalancette
  2008-07-29 13:06 ` [Qemu-devel] " Avi Kivity
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Chris Lalancette @ 2008-07-29  6:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: kvm

[-- Attachment #1: Type: text/plain, Size: 523 bytes --]

Attached is a simple patch to make i2c_bus_save() put a 32-bit quantity in the
save file, which matches what i2c_bus_load() expects to pull out of the save
file later.  Without this fix in place, KVM live migration fails since the
sender is only sending 1 byte while the receiver is waiting to receive 4 bytes.

Avi, I don't know when you plan to next rebase KVM to upstream QEMU, but it's
probably a good idea to carry this patch so that live migration works at all.

Signed-off-by: Chris Lalancette <clalance@redhat.com>

[-- Attachment #2: qemu-i2c-migrate-fix.patch --]
[-- Type: text/x-patch, Size: 448 bytes --]

diff --git a/qemu/hw/i2c.c b/qemu/hw/i2c.c
index 5d283fb..f711db7 100644
--- a/qemu/hw/i2c.c
+++ b/qemu/hw/i2c.c
@@ -21,7 +21,7 @@ static void i2c_bus_save(QEMUFile *f, void *opaque)
 {
     i2c_bus *bus = (i2c_bus *)opaque;
 
-    qemu_put_byte(f, bus->current_dev ? bus->current_dev->address : -1);
+    qemu_put_be32(f, bus->current_dev ? bus->current_dev->address : -1);
 }
 
 static int i2c_bus_load(QEMUFile *f, void *opaque, int version_id)

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

* [Qemu-devel] Re: [PATCH]: Fix i2c_bus_save, which fixes KVM live migration
  2008-07-29  6:55 [Qemu-devel] [PATCH]: Fix i2c_bus_save, which fixes KVM live migration Chris Lalancette
@ 2008-07-29 13:06 ` Avi Kivity
  2008-07-29 13:43 ` [Qemu-devel] " Anthony Liguori
  2008-07-29 13:59 ` andrzej zaborowski
  2 siblings, 0 replies; 7+ messages in thread
From: Avi Kivity @ 2008-07-29 13:06 UTC (permalink / raw)
  To: Chris Lalancette; +Cc: qemu-devel, kvm

Chris Lalancette wrote:
> Attached is a simple patch to make i2c_bus_save() put a 32-bit quantity in the
> save file, which matches what i2c_bus_load() expects to pull out of the save
> file later.  Without this fix in place, KVM live migration fails since the
> sender is only sending 1 byte while the receiver is waiting to receive 4 bytes.
>
> Avi, I don't know when you plan to next rebase KVM to upstream QEMU, but it's
> probably a good idea to carry this patch so that live migration works at all.
>
>   

I'll merge qemu upstream as soon as I see this go in.

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

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

* Re: [Qemu-devel] [PATCH]: Fix i2c_bus_save, which fixes KVM live migration
  2008-07-29  6:55 [Qemu-devel] [PATCH]: Fix i2c_bus_save, which fixes KVM live migration Chris Lalancette
  2008-07-29 13:06 ` [Qemu-devel] " Avi Kivity
@ 2008-07-29 13:43 ` Anthony Liguori
  2008-07-29 13:59 ` andrzej zaborowski
  2 siblings, 0 replies; 7+ messages in thread
From: Anthony Liguori @ 2008-07-29 13:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paul Brook, kvm

Chris Lalancette wrote:
> Attached is a simple patch to make i2c_bus_save() put a 32-bit quantity in the
> save file, which matches what i2c_bus_load() expects to pull out of the save
> file later.  Without this fix in place, KVM live migration fails since the
> sender is only sending 1 byte while the receiver is waiting to receive 4 bytes.
>
> Avi, I don't know when you plan to next rebase KVM to upstream QEMU, but it's
> probably a good idea to carry this patch so that live migration works at all.
>
> Signed-off-by: Chris Lalancette <clalance@redhat.com>
>   
> diff --git a/qemu/hw/i2c.c b/qemu/hw/i2c.c
> index 5d283fb..f711db7 100644
> --- a/qemu/hw/i2c.c
> +++ b/qemu/hw/i2c.c
> @@ -21,7 +21,7 @@ static void i2c_bus_save(QEMUFile *f, void *opaque)
>  {
>      i2c_bus *bus = (i2c_bus *)opaque;
>  
> -    qemu_put_byte(f, bus->current_dev ? bus->current_dev->address : -1);
> +    qemu_put_be32(f, bus->current_dev ? bus->current_dev->address : -1);
>  }
>   

Looking at the code, I suspect it's really supposed to be a byte.  
Perhaps pbrook can clarify?

Regards,

Anthony Liguori


>  static int i2c_bus_load(QEMUFile *f, void *opaque, int version_id)
>   

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

* Re: [Qemu-devel] [PATCH]: Fix i2c_bus_save, which fixes KVM live migration
  2008-07-29  6:55 [Qemu-devel] [PATCH]: Fix i2c_bus_save, which fixes KVM live migration Chris Lalancette
  2008-07-29 13:06 ` [Qemu-devel] " Avi Kivity
  2008-07-29 13:43 ` [Qemu-devel] " Anthony Liguori
@ 2008-07-29 13:59 ` andrzej zaborowski
  2008-07-29 18:18   ` Paul Brook
  2 siblings, 1 reply; 7+ messages in thread
From: andrzej zaborowski @ 2008-07-29 13:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: kvm

2008/7/29 Chris Lalancette <clalance@redhat.com>:
> Attached is a simple patch to make i2c_bus_save() put a 32-bit quantity in the
> save file, which matches what i2c_bus_load() expects to pull out of the save
> file later.  Without this fix in place, KVM live migration fails since the
> sender is only sending 1 byte while the receiver is waiting to receive 4 bytes.

Thanks, I committed this modified to use byte width afterall since the
addresses are 7-bit quantities, as noted by Anthony. Means that
existing snapshots are not invalidated.

Cheers

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

* Re: [Qemu-devel] [PATCH]: Fix i2c_bus_save, which fixes KVM live migration
  2008-07-29 13:59 ` andrzej zaborowski
@ 2008-07-29 18:18   ` Paul Brook
  2008-07-29 18:35     ` andrzej zaborowski
  0 siblings, 1 reply; 7+ messages in thread
From: Paul Brook @ 2008-07-29 18:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: kvm

On Tuesday 29 July 2008, andrzej zaborowski wrote:
> 2008/7/29 Chris Lalancette <clalance@redhat.com>:
> > Attached is a simple patch to make i2c_bus_save() put a 32-bit quantity
> > in the save file, which matches what i2c_bus_load() expects to pull out
> > of the save file later.  Without this fix in place, KVM live migration
> > fails since the sender is only sending 1 byte while the receiver is
> > waiting to receive 4 bytes.
>
> Thanks, I committed this modified to use byte width afterall since the
> addresses are 7-bit quantities.

No they aren't. I2C also supports 10-bit addressing.

Paul

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

* Re: [Qemu-devel] [PATCH]: Fix i2c_bus_save, which fixes KVM live migration
  2008-07-29 18:18   ` Paul Brook
@ 2008-07-29 18:35     ` andrzej zaborowski
  2008-07-29 18:38       ` Anthony Liguori
  0 siblings, 1 reply; 7+ messages in thread
From: andrzej zaborowski @ 2008-07-29 18:35 UTC (permalink / raw)
  To: Paul Brook; +Cc: qemu-devel, kvm

2008/7/29 Paul Brook <paul@codesourcery.com>:
> On Tuesday 29 July 2008, andrzej zaborowski wrote:
>> 2008/7/29 Chris Lalancette <clalance@redhat.com>:
>> > Attached is a simple patch to make i2c_bus_save() put a 32-bit quantity
>> > in the save file, which matches what i2c_bus_load() expects to pull out
>> > of the save file later.  Without this fix in place, KVM live migration
>> > fails since the sender is only sending 1 byte while the receiver is
>> > waiting to receive 4 bytes.
>>
>> Thanks, I committed this modified to use byte width afterall since the
>> addresses are 7-bit quantities.
>
> No they aren't. I2C also supports 10-bit addressing.

Addresses in qemu are still <= 8-bit, for example i2c_slave_load()
assumes this and current i2c api users do.

Regards

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

* Re: [Qemu-devel] [PATCH]: Fix i2c_bus_save, which fixes KVM live migration
  2008-07-29 18:35     ` andrzej zaborowski
@ 2008-07-29 18:38       ` Anthony Liguori
  0 siblings, 0 replies; 7+ messages in thread
From: Anthony Liguori @ 2008-07-29 18:38 UTC (permalink / raw)
  To: andrzej zaborowski; +Cc: Paul Brook, kvm, qemu-devel

andrzej zaborowski wrote:
> 2008/7/29 Paul Brook <paul@codesourcery.com>:
>   
>> No they aren't. I2C also supports 10-bit addressing.
>>     
>
> Addresses in qemu are still <= 8-bit, for example i2c_slave_load()
> assumes this and current i2c api users do.
>   

But for the save/restore format, if the spec can support 10-bit 
addressing, then we should use be16s to avoid having to change 
save/restore format if we ever expand the supported address size.

Regards,

Anthony Liguori

> Regards
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>   

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

end of thread, other threads:[~2008-07-29 18:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-29  6:55 [Qemu-devel] [PATCH]: Fix i2c_bus_save, which fixes KVM live migration Chris Lalancette
2008-07-29 13:06 ` [Qemu-devel] " Avi Kivity
2008-07-29 13:43 ` [Qemu-devel] " Anthony Liguori
2008-07-29 13:59 ` andrzej zaborowski
2008-07-29 18:18   ` Paul Brook
2008-07-29 18:35     ` andrzej zaborowski
2008-07-29 18:38       ` Anthony Liguori

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).