qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: aliguori@us.ibm.com, mst@redhat.com, jan.kiszka@siemens.com,
	rusty@rustcorp.com.au, qemu-devel@nongnu.org,
	blauwirbel@gmail.com, stefanha@gmail.com
Cc: netdev@vger.kernel.org, kvm@vger.kernel.org
Subject: [Qemu-devel] [RFC v3 PATCH 1/4] announce self after vm start
Date: Thu, 27 Oct 2011 16:48:36 +0800	[thread overview]
Message-ID: <20111027084836.15020.11695.stgit@dhcp-8-146.nay.redhat.com> (raw)
In-Reply-To: <20111027084700.15020.24087.stgit@dhcp-8-146.nay.redhat.com>

This patch moves qemu_announce_self() to vm_start() and add a new
parameters to control whether sending gratuitous packet is needed.

This is bacause the following reasons:

- Gratuitous packet is also needed when we resume a stopped vm or
  successfuly load a state.
- The ability of sending gratuitous packet by guest may change the
  state of device, so we need to do it after vm is started.

Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 gdbstub.c   |    2 +-
 migration.c |    4 ++--
 monitor.c   |    4 ++--
 savevm.c    |    2 +-
 sysemu.h    |    2 +-
 vl.c        |    7 +++++--
 6 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/gdbstub.c b/gdbstub.c
index 4009058..5f6238e 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -371,7 +371,7 @@ static inline void gdb_continue(GDBState *s)
 #ifdef CONFIG_USER_ONLY
     s->running_state = 1;
 #else
-    vm_start();
+    vm_start(false);
 #endif
 }
 
diff --git a/migration.c b/migration.c
index bdca72e..8580fa7 100644
--- a/migration.c
+++ b/migration.c
@@ -90,7 +90,7 @@ void process_incoming_migration(QEMUFile *f)
     DPRINTF("successfully loaded vm state\n");
 
     if (autostart) {
-        vm_start();
+        vm_start(true);
     } else {
         runstate_set(RUN_STATE_PRELAUNCH);
     }
@@ -308,7 +308,7 @@ static void migrate_fd_put_ready(void *opaque)
         }
         if (s->state != MIG_STATE_COMPLETED) {
             if (old_vm_running) {
-                vm_start();
+                vm_start(false);
             }
         }
     }
diff --git a/monitor.c b/monitor.c
index ffda0fe..633e2de 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1252,7 +1252,7 @@ static int do_cont(Monitor *mon, const QDict *qdict, QObject **ret_data)
     bdrv_iterate(encrypted_bdrv_it, &context);
     /* only resume the vm if all keys are set and valid */
     if (!context.err) {
-        vm_start();
+        vm_start(true);
         return 0;
     } else {
         return -1;
@@ -2710,7 +2710,7 @@ static void do_loadvm(Monitor *mon, const QDict *qdict)
     vm_stop(RUN_STATE_RESTORE_VM);
 
     if (load_vmstate(name) == 0 && saved_vm_running) {
-        vm_start();
+        vm_start(true);
     }
 }
 
diff --git a/savevm.c b/savevm.c
index f01838f..73ee6e2 100644
--- a/savevm.c
+++ b/savevm.c
@@ -2077,7 +2077,7 @@ void do_savevm(Monitor *mon, const QDict *qdict)
 
  the_end:
     if (saved_vm_running)
-        vm_start();
+        vm_start(false);
 }
 
 int load_vmstate(const char *name)
diff --git a/sysemu.h b/sysemu.h
index 22cd720..686f1ec 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -34,7 +34,7 @@ void vm_state_notify(int running, RunState state);
 #define VMRESET_SILENT   false
 #define VMRESET_REPORT   true
 
-void vm_start(void);
+void vm_start(bool announce);
 void vm_stop(RunState state);
 void vm_stop_force_state(RunState state);
 
diff --git a/vl.c b/vl.c
index 1ddb17b..e216966 100644
--- a/vl.c
+++ b/vl.c
@@ -1253,7 +1253,7 @@ void vm_state_notify(int running, RunState state)
     }
 }
 
-void vm_start(void)
+void vm_start(bool announce)
 {
     if (!runstate_is_running()) {
         cpu_enable_ticks();
@@ -1261,6 +1261,9 @@ void vm_start(void)
         vm_state_notify(1, RUN_STATE_RUNNING);
         resume_all_vcpus();
         monitor_protocol_event(QEVENT_RESUME, NULL);
+        if (announce) {
+            qemu_announce_self();
+        }
     }
 }
 
@@ -3440,7 +3443,7 @@ int main(int argc, char **argv, char **envp)
             exit(ret);
         }
     } else if (autostart) {
-        vm_start();
+        vm_start(false);
     }
 
     os_setup_post();

  reply	other threads:[~2011-10-27  8:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-27  8:48 [Qemu-devel] [RFC v3 PATCH 0/4] Send gratuitous packets by guest Jason Wang
2011-10-27  8:48 ` Jason Wang [this message]
2011-10-27  8:48 ` [Qemu-devel] [RFC v3 PATCH 2/4] net: model specific announcing support Jason Wang
2011-10-27  8:48 ` [Qemu-devel] [RFC v3 PATCH 3/4] virtio-net: notify guest to annouce itself Jason Wang
2011-10-27  8:49 ` [Qemu-devel] [RFC v3 PATCH 4/4] virtio-net: compat guest announce support Jason Wang

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=20111027084836.15020.11695.stgit@dhcp-8-146.nay.redhat.com \
    --to=jasowang@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=blauwirbel@gmail.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rusty@rustcorp.com.au \
    --cc=stefanha@gmail.com \
    /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).