qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: zhanghailiang <zhang.zhanghailiang@huawei.com>, qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, mst@redhat.com, jan.kiszka@siemens.com,
	luonengjun@huawei.com, peter.huangpeng@huawei.com,
	hani@linux.com, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH V3] net: Fix dealing with packets when runstate changes
Date: Tue, 26 Aug 2014 12:39:21 +0800	[thread overview]
Message-ID: <53FC0F79.5080808@redhat.com> (raw)
In-Reply-To: <1408963656-12308-1-git-send-email-zhang.zhanghailiang@huawei.com>

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 <zhang.zhanghailiang@huawei.com>
> ---
>  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?

  reply	other threads:[~2014-08-26  4:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-25 10:47 [Qemu-devel] [PATCH V3] net: Fix dealing with packets when runstate changes zhanghailiang
2014-08-26  4:39 ` Jason Wang [this message]
2014-08-26  5:04   ` zhanghailiang

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=53FC0F79.5080808@redhat.com \
    --to=jasowang@redhat.com \
    --cc=hani@linux.com \
    --cc=jan.kiszka@siemens.com \
    --cc=luonengjun@huawei.com \
    --cc=mst@redhat.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=zhang.zhanghailiang@huawei.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).