* [Qemu-devel] [PATCH] hw/virtio-serial-bus: post_load send_event when vm is running
@ 2012-11-14 13:09 Alon Levy
2012-11-14 13:20 ` Paolo Bonzini
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Alon Levy @ 2012-11-14 13:09 UTC (permalink / raw)
To: qemu-devel; +Cc: amit.shah, pbonzini, alexl
Add a new timer based on vm_clock for 1 ns in the future from post_load
to do the event send in case host_connected differs between migration
source and target.
RHBZ: 867366
Signed-off-by: Alon Levy <alevy@redhat.com>
---
hw/virtio-serial-bus.c | 54 ++++++++++++++++++++++++++++++++++++++++----------
1 file changed, 44 insertions(+), 10 deletions(-)
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index d20bd8b..efa8a81 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -53,6 +53,15 @@ struct VirtIOSerial {
uint32_t *ports_map;
struct virtio_console_config config;
+
+ struct {
+ QEMUTimer *timer;
+ int nr_active_ports;
+ struct {
+ VirtIOSerialPort *port;
+ uint8_t host_connected;
+ } *connected;
+ } post_load;
};
static VirtIOSerialPort *find_port_by_id(VirtIOSerial *vser, uint32_t id)
@@ -626,6 +635,29 @@ static void virtio_serial_save(QEMUFile *f, void *opaque)
}
}
+static void virtio_serial_post_load_timer_cb(void *opaque)
+{
+ int i;
+ VirtIOSerial *s = opaque;
+ VirtIOSerialPort *port;
+ uint8_t host_connected;
+
+ for (i = 0 ; i < s->post_load.nr_active_ports; ++i) {
+ port = s->post_load.connected[i].port;
+ host_connected = s->post_load.connected[i].host_connected;
+ if (host_connected != port->host_connected) {
+ /*
+ * We have to let the guest know of the host connection
+ * status change
+ */
+ send_control_event(port, VIRTIO_CONSOLE_PORT_OPEN,
+ port->host_connected);
+ }
+ }
+ g_free(s->post_load.connected);
+ s->post_load.connected = NULL;
+}
+
static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
{
VirtIOSerial *s = opaque;
@@ -673,10 +705,13 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
qemu_get_be32s(f, &nr_active_ports);
+ s->post_load.nr_active_ports = nr_active_ports;
+ s->post_load.connected =
+ g_malloc0(sizeof(*s->post_load.connected) * nr_active_ports);
+
/* Items in struct VirtIOSerialPort */
for (i = 0; i < nr_active_ports; i++) {
uint32_t id;
- bool host_connected;
id = qemu_get_be32(f);
port = find_port_by_id(s, id);
@@ -685,15 +720,8 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
}
port->guest_connected = qemu_get_byte(f);
- host_connected = qemu_get_byte(f);
- if (host_connected != port->host_connected) {
- /*
- * We have to let the guest know of the host connection
- * status change
- */
- send_control_event(port, VIRTIO_CONSOLE_PORT_OPEN,
- port->host_connected);
- }
+ s->post_load.connected[i].port = port;
+ s->post_load.connected[i].host_connected = qemu_get_byte(f);
if (version_id > 2) {
uint32_t elem_popped;
@@ -718,6 +746,7 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
}
}
}
+ qemu_mod_timer(s->post_load.timer, 1);
return 0;
}
@@ -967,6 +996,9 @@ VirtIODevice *virtio_serial_init(DeviceState *dev, virtio_serial_conf *conf)
register_savevm(dev, "virtio-console", -1, 3, virtio_serial_save,
virtio_serial_load, vser);
+ vser->post_load.timer = qemu_new_timer_ns(vm_clock,
+ virtio_serial_post_load_timer_cb, vser);
+
return vdev;
}
@@ -979,6 +1011,8 @@ void virtio_serial_exit(VirtIODevice *vdev)
g_free(vser->ivqs);
g_free(vser->ovqs);
g_free(vser->ports_map);
+ g_free(vser->post_load.connected);
+ qemu_free_timer(vser->post_load.timer);
virtio_cleanup(vdev);
}
--
1.8.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/virtio-serial-bus: post_load send_event when vm is running
2012-11-14 13:09 [Qemu-devel] [PATCH] hw/virtio-serial-bus: post_load send_event when vm is running Alon Levy
@ 2012-11-14 13:20 ` Paolo Bonzini
2012-11-16 8:30 ` Amit Shah
2012-11-17 16:08 ` Blue Swirl
2 siblings, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2012-11-14 13:20 UTC (permalink / raw)
To: Alon Levy; +Cc: amit.shah, qemu-devel, alexl
Il 14/11/2012 14:09, Alon Levy ha scritto:
> Add a new timer based on vm_clock for 1 ns in the future from post_load
> to do the event send in case host_connected differs between migration
> source and target.
>
> RHBZ: 867366
>
> Signed-off-by: Alon Levy <alevy@redhat.com>
> ---
> hw/virtio-serial-bus.c | 54 ++++++++++++++++++++++++++++++++++++++++----------
> 1 file changed, 44 insertions(+), 10 deletions(-)
>
> diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
> index d20bd8b..efa8a81 100644
> --- a/hw/virtio-serial-bus.c
> +++ b/hw/virtio-serial-bus.c
> @@ -53,6 +53,15 @@ struct VirtIOSerial {
> uint32_t *ports_map;
>
> struct virtio_console_config config;
> +
> + struct {
> + QEMUTimer *timer;
> + int nr_active_ports;
> + struct {
> + VirtIOSerialPort *port;
> + uint8_t host_connected;
> + } *connected;
> + } post_load;
> };
>
> static VirtIOSerialPort *find_port_by_id(VirtIOSerial *vser, uint32_t id)
> @@ -626,6 +635,29 @@ static void virtio_serial_save(QEMUFile *f, void *opaque)
> }
> }
>
> +static void virtio_serial_post_load_timer_cb(void *opaque)
> +{
> + int i;
> + VirtIOSerial *s = opaque;
> + VirtIOSerialPort *port;
> + uint8_t host_connected;
> +
> + for (i = 0 ; i < s->post_load.nr_active_ports; ++i) {
> + port = s->post_load.connected[i].port;
> + host_connected = s->post_load.connected[i].host_connected;
> + if (host_connected != port->host_connected) {
> + /*
> + * We have to let the guest know of the host connection
> + * status change
> + */
> + send_control_event(port, VIRTIO_CONSOLE_PORT_OPEN,
> + port->host_connected);
> + }
> + }
> + g_free(s->post_load.connected);
> + s->post_load.connected = NULL;
> +}
> +
> static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
> {
> VirtIOSerial *s = opaque;
> @@ -673,10 +705,13 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
>
> qemu_get_be32s(f, &nr_active_ports);
>
> + s->post_load.nr_active_ports = nr_active_ports;
> + s->post_load.connected =
> + g_malloc0(sizeof(*s->post_load.connected) * nr_active_ports);
> +
> /* Items in struct VirtIOSerialPort */
> for (i = 0; i < nr_active_ports; i++) {
> uint32_t id;
> - bool host_connected;
>
> id = qemu_get_be32(f);
> port = find_port_by_id(s, id);
> @@ -685,15 +720,8 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
> }
>
> port->guest_connected = qemu_get_byte(f);
> - host_connected = qemu_get_byte(f);
> - if (host_connected != port->host_connected) {
> - /*
> - * We have to let the guest know of the host connection
> - * status change
> - */
> - send_control_event(port, VIRTIO_CONSOLE_PORT_OPEN,
> - port->host_connected);
> - }
> + s->post_load.connected[i].port = port;
> + s->post_load.connected[i].host_connected = qemu_get_byte(f);
>
> if (version_id > 2) {
> uint32_t elem_popped;
> @@ -718,6 +746,7 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
> }
> }
> }
> + qemu_mod_timer(s->post_load.timer, 1);
> return 0;
> }
>
> @@ -967,6 +996,9 @@ VirtIODevice *virtio_serial_init(DeviceState *dev, virtio_serial_conf *conf)
> register_savevm(dev, "virtio-console", -1, 3, virtio_serial_save,
> virtio_serial_load, vser);
>
> + vser->post_load.timer = qemu_new_timer_ns(vm_clock,
> + virtio_serial_post_load_timer_cb, vser);
> +
> return vdev;
> }
>
> @@ -979,6 +1011,8 @@ void virtio_serial_exit(VirtIODevice *vdev)
> g_free(vser->ivqs);
> g_free(vser->ovqs);
> g_free(vser->ports_map);
> + g_free(vser->post_load.connected);
> + qemu_free_timer(vser->post_load.timer);
>
> virtio_cleanup(vdev);
> }
>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/virtio-serial-bus: post_load send_event when vm is running
2012-11-14 13:09 [Qemu-devel] [PATCH] hw/virtio-serial-bus: post_load send_event when vm is running Alon Levy
2012-11-14 13:20 ` Paolo Bonzini
@ 2012-11-16 8:30 ` Amit Shah
2012-11-17 16:08 ` Blue Swirl
2 siblings, 0 replies; 7+ messages in thread
From: Amit Shah @ 2012-11-16 8:30 UTC (permalink / raw)
To: Alon Levy; +Cc: pbonzini, qemu-devel, alexl
On (Wed) 14 Nov 2012 [15:09:07], Alon Levy wrote:
> Add a new timer based on vm_clock for 1 ns in the future from post_load
> to do the event send in case host_connected differs between migration
> source and target.
>
> RHBZ: 867366
>
> Signed-off-by: Alon Levy <alevy@redhat.com>
> ---
> hw/virtio-serial-bus.c | 54 ++++++++++++++++++++++++++++++++++++++++----------
> 1 file changed, 44 insertions(+), 10 deletions(-)
Thanks, applied.
Amit
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/virtio-serial-bus: post_load send_event when vm is running
2012-11-14 13:09 [Qemu-devel] [PATCH] hw/virtio-serial-bus: post_load send_event when vm is running Alon Levy
2012-11-14 13:20 ` Paolo Bonzini
2012-11-16 8:30 ` Amit Shah
@ 2012-11-17 16:08 ` Blue Swirl
2012-11-18 16:29 ` Paolo Bonzini
2 siblings, 1 reply; 7+ messages in thread
From: Blue Swirl @ 2012-11-17 16:08 UTC (permalink / raw)
To: Alon Levy; +Cc: amit.shah, pbonzini, qemu-devel, alexl
On Wed, Nov 14, 2012 at 1:09 PM, Alon Levy <alevy@redhat.com> wrote:
> Add a new timer based on vm_clock for 1 ns in the future from post_load
> to do the event send in case host_connected differs between migration
> source and target.
>
> RHBZ: 867366
>
> Signed-off-by: Alon Levy <alevy@redhat.com>
> ---
> hw/virtio-serial-bus.c | 54 ++++++++++++++++++++++++++++++++++++++++----------
> 1 file changed, 44 insertions(+), 10 deletions(-)
>
> diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
> index d20bd8b..efa8a81 100644
> --- a/hw/virtio-serial-bus.c
> +++ b/hw/virtio-serial-bus.c
> @@ -53,6 +53,15 @@ struct VirtIOSerial {
> uint32_t *ports_map;
>
> struct virtio_console_config config;
> +
> + struct {
Please add a name, for example PostLoad.
> + QEMUTimer *timer;
> + int nr_active_ports;
> + struct {
> + VirtIOSerialPort *port;
> + uint8_t host_connected;
> + } *connected;
> + } post_load;
> };
>
> static VirtIOSerialPort *find_port_by_id(VirtIOSerial *vser, uint32_t id)
> @@ -626,6 +635,29 @@ static void virtio_serial_save(QEMUFile *f, void *opaque)
> }
> }
>
> +static void virtio_serial_post_load_timer_cb(void *opaque)
> +{
> + int i;
> + VirtIOSerial *s = opaque;
> + VirtIOSerialPort *port;
> + uint8_t host_connected;
> +
> + for (i = 0 ; i < s->post_load.nr_active_ports; ++i) {
> + port = s->post_load.connected[i].port;
> + host_connected = s->post_load.connected[i].host_connected;
> + if (host_connected != port->host_connected) {
> + /*
> + * We have to let the guest know of the host connection
> + * status change
> + */
> + send_control_event(port, VIRTIO_CONSOLE_PORT_OPEN,
> + port->host_connected);
> + }
> + }
> + g_free(s->post_load.connected);
> + s->post_load.connected = NULL;
> +}
> +
> static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
> {
> VirtIOSerial *s = opaque;
> @@ -673,10 +705,13 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
>
> qemu_get_be32s(f, &nr_active_ports);
>
> + s->post_load.nr_active_ports = nr_active_ports;
> + s->post_load.connected =
> + g_malloc0(sizeof(*s->post_load.connected) * nr_active_ports);
> +
> /* Items in struct VirtIOSerialPort */
> for (i = 0; i < nr_active_ports; i++) {
> uint32_t id;
> - bool host_connected;
>
> id = qemu_get_be32(f);
> port = find_port_by_id(s, id);
> @@ -685,15 +720,8 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
> }
>
> port->guest_connected = qemu_get_byte(f);
> - host_connected = qemu_get_byte(f);
> - if (host_connected != port->host_connected) {
> - /*
> - * We have to let the guest know of the host connection
> - * status change
> - */
> - send_control_event(port, VIRTIO_CONSOLE_PORT_OPEN,
> - port->host_connected);
> - }
> + s->post_load.connected[i].port = port;
> + s->post_load.connected[i].host_connected = qemu_get_byte(f);
>
> if (version_id > 2) {
> uint32_t elem_popped;
> @@ -718,6 +746,7 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
> }
> }
> }
> + qemu_mod_timer(s->post_load.timer, 1);
> return 0;
> }
>
> @@ -967,6 +996,9 @@ VirtIODevice *virtio_serial_init(DeviceState *dev, virtio_serial_conf *conf)
> register_savevm(dev, "virtio-console", -1, 3, virtio_serial_save,
> virtio_serial_load, vser);
>
> + vser->post_load.timer = qemu_new_timer_ns(vm_clock,
> + virtio_serial_post_load_timer_cb, vser);
> +
> return vdev;
> }
>
> @@ -979,6 +1011,8 @@ void virtio_serial_exit(VirtIODevice *vdev)
> g_free(vser->ivqs);
> g_free(vser->ovqs);
> g_free(vser->ports_map);
> + g_free(vser->post_load.connected);
> + qemu_free_timer(vser->post_load.timer);
>
> virtio_cleanup(vdev);
> }
> --
> 1.8.0
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/virtio-serial-bus: post_load send_event when vm is running
2012-11-17 16:08 ` Blue Swirl
@ 2012-11-18 16:29 ` Paolo Bonzini
2012-11-18 19:17 ` Blue Swirl
0 siblings, 1 reply; 7+ messages in thread
From: Paolo Bonzini @ 2012-11-18 16:29 UTC (permalink / raw)
To: Blue Swirl; +Cc: amit shah, Alon Levy, qemu-devel, alexl
> > struct virtio_console_config config;
> > +
> > + struct {
>
> Please add a name, for example PostLoad.
Why? This is not C++ and the namespace would be global. It's just to
have a nice grouping.
Paolo
> > + QEMUTimer *timer;
> > + int nr_active_ports;
> > + struct {
> > + VirtIOSerialPort *port;
> > + uint8_t host_connected;
> > + } *connected;
> > + } post_load;
> > };
> >
> > static VirtIOSerialPort *find_port_by_id(VirtIOSerial *vser,
> > uint32_t id)
> > @@ -626,6 +635,29 @@ static void virtio_serial_save(QEMUFile *f,
> > void *opaque)
> > }
> > }
> >
> > +static void virtio_serial_post_load_timer_cb(void *opaque)
> > +{
> > + int i;
> > + VirtIOSerial *s = opaque;
> > + VirtIOSerialPort *port;
> > + uint8_t host_connected;
> > +
> > + for (i = 0 ; i < s->post_load.nr_active_ports; ++i) {
> > + port = s->post_load.connected[i].port;
> > + host_connected = s->post_load.connected[i].host_connected;
> > + if (host_connected != port->host_connected) {
> > + /*
> > + * We have to let the guest know of the host
> > connection
> > + * status change
> > + */
> > + send_control_event(port, VIRTIO_CONSOLE_PORT_OPEN,
> > + port->host_connected);
> > + }
> > + }
> > + g_free(s->post_load.connected);
> > + s->post_load.connected = NULL;
> > +}
> > +
> > static int virtio_serial_load(QEMUFile *f, void *opaque, int
> > version_id)
> > {
> > VirtIOSerial *s = opaque;
> > @@ -673,10 +705,13 @@ static int virtio_serial_load(QEMUFile *f,
> > void *opaque, int version_id)
> >
> > qemu_get_be32s(f, &nr_active_ports);
> >
> > + s->post_load.nr_active_ports = nr_active_ports;
> > + s->post_load.connected =
> > + g_malloc0(sizeof(*s->post_load.connected) *
> > nr_active_ports);
> > +
> > /* Items in struct VirtIOSerialPort */
> > for (i = 0; i < nr_active_ports; i++) {
> > uint32_t id;
> > - bool host_connected;
> >
> > id = qemu_get_be32(f);
> > port = find_port_by_id(s, id);
> > @@ -685,15 +720,8 @@ static int virtio_serial_load(QEMUFile *f,
> > void *opaque, int version_id)
> > }
> >
> > port->guest_connected = qemu_get_byte(f);
> > - host_connected = qemu_get_byte(f);
> > - if (host_connected != port->host_connected) {
> > - /*
> > - * We have to let the guest know of the host
> > connection
> > - * status change
> > - */
> > - send_control_event(port, VIRTIO_CONSOLE_PORT_OPEN,
> > - port->host_connected);
> > - }
> > + s->post_load.connected[i].port = port;
> > + s->post_load.connected[i].host_connected =
> > qemu_get_byte(f);
> >
> > if (version_id > 2) {
> > uint32_t elem_popped;
> > @@ -718,6 +746,7 @@ static int virtio_serial_load(QEMUFile *f, void
> > *opaque, int version_id)
> > }
> > }
> > }
> > + qemu_mod_timer(s->post_load.timer, 1);
> > return 0;
> > }
> >
> > @@ -967,6 +996,9 @@ VirtIODevice *virtio_serial_init(DeviceState
> > *dev, virtio_serial_conf *conf)
> > register_savevm(dev, "virtio-console", -1, 3,
> > virtio_serial_save,
> > virtio_serial_load, vser);
> >
> > + vser->post_load.timer = qemu_new_timer_ns(vm_clock,
> > + virtio_serial_post_load_timer_cb, vser);
> > +
> > return vdev;
> > }
> >
> > @@ -979,6 +1011,8 @@ void virtio_serial_exit(VirtIODevice *vdev)
> > g_free(vser->ivqs);
> > g_free(vser->ovqs);
> > g_free(vser->ports_map);
> > + g_free(vser->post_load.connected);
> > + qemu_free_timer(vser->post_load.timer);
> >
> > virtio_cleanup(vdev);
> > }
> > --
> > 1.8.0
> >
> >
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/virtio-serial-bus: post_load send_event when vm is running
2012-11-18 16:29 ` Paolo Bonzini
@ 2012-11-18 19:17 ` Blue Swirl
2012-11-19 8:19 ` Paolo Bonzini
0 siblings, 1 reply; 7+ messages in thread
From: Blue Swirl @ 2012-11-18 19:17 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: amit shah, Alon Levy, qemu-devel, alexl
On Sun, Nov 18, 2012 at 4:29 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
>> > struct virtio_console_config config;
>> > +
>> > + struct {
>>
>> Please add a name, for example PostLoad.
>
> Why? This is not C++ and the namespace would be global. It's just to
> have a nice grouping.
Otherwise the structure will be anonymous and those were only added to
C11, not C99.
>
> Paolo
>
>> > + QEMUTimer *timer;
>> > + int nr_active_ports;
>> > + struct {
>> > + VirtIOSerialPort *port;
>> > + uint8_t host_connected;
>> > + } *connected;
>> > + } post_load;
>> > };
>> >
>> > static VirtIOSerialPort *find_port_by_id(VirtIOSerial *vser,
>> > uint32_t id)
>> > @@ -626,6 +635,29 @@ static void virtio_serial_save(QEMUFile *f,
>> > void *opaque)
>> > }
>> > }
>> >
>> > +static void virtio_serial_post_load_timer_cb(void *opaque)
>> > +{
>> > + int i;
>> > + VirtIOSerial *s = opaque;
>> > + VirtIOSerialPort *port;
>> > + uint8_t host_connected;
>> > +
>> > + for (i = 0 ; i < s->post_load.nr_active_ports; ++i) {
>> > + port = s->post_load.connected[i].port;
>> > + host_connected = s->post_load.connected[i].host_connected;
>> > + if (host_connected != port->host_connected) {
>> > + /*
>> > + * We have to let the guest know of the host
>> > connection
>> > + * status change
>> > + */
>> > + send_control_event(port, VIRTIO_CONSOLE_PORT_OPEN,
>> > + port->host_connected);
>> > + }
>> > + }
>> > + g_free(s->post_load.connected);
>> > + s->post_load.connected = NULL;
>> > +}
>> > +
>> > static int virtio_serial_load(QEMUFile *f, void *opaque, int
>> > version_id)
>> > {
>> > VirtIOSerial *s = opaque;
>> > @@ -673,10 +705,13 @@ static int virtio_serial_load(QEMUFile *f,
>> > void *opaque, int version_id)
>> >
>> > qemu_get_be32s(f, &nr_active_ports);
>> >
>> > + s->post_load.nr_active_ports = nr_active_ports;
>> > + s->post_load.connected =
>> > + g_malloc0(sizeof(*s->post_load.connected) *
>> > nr_active_ports);
>> > +
>> > /* Items in struct VirtIOSerialPort */
>> > for (i = 0; i < nr_active_ports; i++) {
>> > uint32_t id;
>> > - bool host_connected;
>> >
>> > id = qemu_get_be32(f);
>> > port = find_port_by_id(s, id);
>> > @@ -685,15 +720,8 @@ static int virtio_serial_load(QEMUFile *f,
>> > void *opaque, int version_id)
>> > }
>> >
>> > port->guest_connected = qemu_get_byte(f);
>> > - host_connected = qemu_get_byte(f);
>> > - if (host_connected != port->host_connected) {
>> > - /*
>> > - * We have to let the guest know of the host
>> > connection
>> > - * status change
>> > - */
>> > - send_control_event(port, VIRTIO_CONSOLE_PORT_OPEN,
>> > - port->host_connected);
>> > - }
>> > + s->post_load.connected[i].port = port;
>> > + s->post_load.connected[i].host_connected =
>> > qemu_get_byte(f);
>> >
>> > if (version_id > 2) {
>> > uint32_t elem_popped;
>> > @@ -718,6 +746,7 @@ static int virtio_serial_load(QEMUFile *f, void
>> > *opaque, int version_id)
>> > }
>> > }
>> > }
>> > + qemu_mod_timer(s->post_load.timer, 1);
>> > return 0;
>> > }
>> >
>> > @@ -967,6 +996,9 @@ VirtIODevice *virtio_serial_init(DeviceState
>> > *dev, virtio_serial_conf *conf)
>> > register_savevm(dev, "virtio-console", -1, 3,
>> > virtio_serial_save,
>> > virtio_serial_load, vser);
>> >
>> > + vser->post_load.timer = qemu_new_timer_ns(vm_clock,
>> > + virtio_serial_post_load_timer_cb, vser);
>> > +
>> > return vdev;
>> > }
>> >
>> > @@ -979,6 +1011,8 @@ void virtio_serial_exit(VirtIODevice *vdev)
>> > g_free(vser->ivqs);
>> > g_free(vser->ovqs);
>> > g_free(vser->ports_map);
>> > + g_free(vser->post_load.connected);
>> > + qemu_free_timer(vser->post_load.timer);
>> >
>> > virtio_cleanup(vdev);
>> > }
>> > --
>> > 1.8.0
>> >
>> >
>>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/virtio-serial-bus: post_load send_event when vm is running
2012-11-18 19:17 ` Blue Swirl
@ 2012-11-19 8:19 ` Paolo Bonzini
0 siblings, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2012-11-19 8:19 UTC (permalink / raw)
To: Blue Swirl; +Cc: amit shah, Alon Levy, qemu-devel, alexl
Il 18/11/2012 20:17, Blue Swirl ha scritto:
>>>> >> > + struct {
>>> >>
>>> >> Please add a name, for example PostLoad.
>> >
>> > Why? This is not C++ and the namespace would be global. It's just to
>> > have a nice grouping.
> Otherwise the structure will be anonymous and those were only added to
> C11, not C99.
No, the name here is "post_load". Unnamed struct *types* are present
all the way to C89 and probably even K&R.
Paolo
>> >
>> > Paolo
>> >
>>>> >> > + QEMUTimer *timer;
>>>> >> > + int nr_active_ports;
>>>> >> > + struct {
>>>> >> > + VirtIOSerialPort *port;
>>>> >> > + uint8_t host_connected;
>>>> >> > + } *connected;
>>>> >> > + } post_load;
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-11-19 8:19 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-14 13:09 [Qemu-devel] [PATCH] hw/virtio-serial-bus: post_load send_event when vm is running Alon Levy
2012-11-14 13:20 ` Paolo Bonzini
2012-11-16 8:30 ` Amit Shah
2012-11-17 16:08 ` Blue Swirl
2012-11-18 16:29 ` Paolo Bonzini
2012-11-18 19:17 ` Blue Swirl
2012-11-19 8:19 ` Paolo Bonzini
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.