Skip to contentSkip to conversation

(no subject)

Qemu-devel Uri Lublin 2 participants 3 messages Jan 29, 2009 – Feb 1, 2009

lore
Share & tools
lore

Uri Lublin

author
#0 lore raw

The following patch fixes saving/loading/migrating a VM with multiple e1000 NICs.

It turns out many devices use -1 as instance (for register_savevm), which is wrong in cases where there can exist multiple such devices within a single VM.

--------------------------------------------

Quoted 1 line

From e89f237fbfbeed937ccf63a4dcd20955c41f4081 Mon Sep 17 00:00:00 2001

From: Uri Lublin <[email protected]>
Date: Thu, 29 Jan 2009 21:37:53 +0200
Subject: [PATCH] e1000: fix register_savevm for multiple nics

Solution is similar to other devices (a static variable).

---
 hw/e1000.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
hw/e1000.c +2 -2
index a38ab73..f62743d 100644
@@ -1040,8 +1040,8 @@ pci_e1000_init(PCIBus *bus, NICInfo *nd, int devfn)
     E1000State *d;
     uint8_t *pci_conf;
     uint16_t checksum = 0;
-    static const char info_str[] = "e1000";
     int i;
+    static int nnics=0;
 
     d = (E1000State *)pci_register_device(bus, "e1000",
                 sizeof(E1000State), devfn, NULL, NULL);
@@ -1092,5 +1092,5 @@ pci_e1000_init(PCIBus *bus, NICInfo *nd, int devfn)
 
     qemu_format_nic_info_str(d->vc, d->nd->macaddr);
 
-    register_savevm(info_str, -1, 2, nic_save, nic_load, d);
+    register_savevm("e1000", nnics++, 2, nic_save, nic_load, d);
 }
Signature · 1 line
1.6.0.6
#1 lore raw
Quoted 2 lines · Uri Lublin

The following patch fixes saving/loading/migrating a VM with multiple e1000 NICs.

I don't know what problems you're seeing, but this is definitely not the right way to fix them.

Quoted 3 lines

It turns out many devices use -1 as instance (for register_savevm), which is wrong in cases where there can exist multiple such devices within a single VM.

No it isn't. -1 means automatically assign IDs, and is what everything should be using. The explicit ID argument is a historcal wart. Read the comment above register_savevm.

Paul

author
#2 lore raw
Quoted 6 lines · Paul Brook
Quoted 2 lines · Uri Lublin

The following patch fixes saving/loading/migrating a VM with multiple e1000 NICs.

I don't know what problems you're seeing, but this is definitely not the right way to fix them.

Quoted 8 lines
Quoted 3 lines

It turns out many devices use -1 as instance (for register_savevm), which is wrong in cases where there can exist multiple such devices within a single VM.

No it isn't. -1 means automatically assign IDs, and is what everything should be using. The explicit ID argument is a historcal wart. Read the comment above register_savevm.

Paul

Paul,

You are right, I was wrong.
This patch is a fix for an older qemu, and is not needed.

Thanks for catching that,
Uri.