[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH V3] net: Fix dealing with packets when runstate
From: |
Jason Wang |
Subject: |
Re: [Qemu-devel] [PATCH V3] net: Fix dealing with packets when runstate changes |
Date: |
Tue, 26 Aug 2014 12:39:21 +0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 |
On 08/25/2014 06:47 PM, zhanghailiang wrote:
> For all NICs(except virtio-net) emulated by qemu,
> Such as e1000, rtl8139, pcnet and ne2k_pci,
> Qemu can still receive packets when VM is not running.
> If this happened in *migration's* last PAUSE VM stage,
> The new dirty RAM related to the packets will be missed,
> And this will lead serious network fault in VM.
>
> To avoid this, we forbid receiving packets in generic net code when
> VM is not running. Also, when the runstate changes back to running,
> we definitely need to flush queues to get packets flowing again.
>
> Here we implement this in the net layer:
> (1) Judge the vm runstate in qemu_can_send_packet
> (2) Add a member 'VMChangeStateEntry *vmstate' to struct NICState,
> Which will listen for VM runstate changes.
> (3) Register a handler function for VMstate change.
> When vm changes back to running, we flush all queues in the callback function.
> (4) Remove checking vm state in virtio_net_can_receive
>
> Signed-off-by: zhanghailiang <address@hidden>
> ---
> v3:
> - change the 'vmstate' to 'vm_running'
>
> v2:
> - remove the superfluous check of nc->received_disabled
> ---
> hw/net/virtio-net.c | 4 ----
> include/net/net.h | 2 ++
> net/net.c | 31 +++++++++++++++++++++++++++++++
> 3 files changed, 33 insertions(+), 4 deletions(-)
Hi:
Have you seen Stefan's replied? We think there's no need to flush the
queued packets or is there anything new issue you found?