qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] e1d64c: net: Forbid dealing with packets when


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] e1d64c: net: Forbid dealing with packets when VM is not ru...
Date: Thu, 04 Sep 2014 11:00:06 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: e1d64c084b2cc7e907b4e64026d8c8dba59116f8
      
https://github.com/qemu/qemu/commit/e1d64c084b2cc7e907b4e64026d8c8dba59116f8
  Author: zhanghailiang <address@hidden>
  Date:   2014-09-04 (Thu, 04 Sep 2014)

  Changed paths:
    M net/net.c

  Log Message:
  -----------
  net: Forbid dealing with packets when VM is not running

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, but
before the end of the migration, the new receiving packets will possibly dirty
parts of RAM which has been cached in *iovec*(will be sent asynchronously) and
dirty parts of new RAM which will be missed.
This will lead serious network fault in VM.

To avoid this, we forbid receiving packets in generic net code when
VM is not running.

Bug reproduction steps:
(1) Start a VM which configured at least one NIC
(2) In VM, open several Terminal and do *Ping IP -i 0.1*
(3) Migrate the VM repeatedly between two Hosts
And the *PING* command in VM will very likely fail with message:
'Destination HOST Unreachable', the NIC in VM will stay unavailable unless you
run 'service network restart'

Signed-off-by: zhanghailiang <address@hidden>
Reviewed-by: Jason Wang <address@hidden>
Reviewed-by: Juan Quintela <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: e8bcf842001739765b8dcc1996d86a0ffd2054d5
      
https://github.com/qemu/qemu/commit/e8bcf842001739765b8dcc1996d86a0ffd2054d5
  Author: Michael S. Tsirkin <address@hidden>
  Date:   2014-09-04 (Thu, 04 Sep 2014)

  Changed paths:
    M hw/net/virtio-net.c

  Log Message:
  -----------
  virtio-net: don't run bh on vm stopped

commit 783e7706937fe15523b609b545587a028a2bdd03
    virtio-net: stop/start bh when appropriate

is incomplete: BH might execute within the same main loop iteration but
after vmstop, so in theory, we might trigger an assertion.
I was unable to reproduce this in practice,
but it seems clear enough that the potential is there, so worth fixing.

Cc: address@hidden
Reported-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: 269bd822e7f5ab80048b05fb7076236ed66ffbce
      
https://github.com/qemu/qemu/commit/269bd822e7f5ab80048b05fb7076236ed66ffbce
  Author: Michael S. Tsirkin <address@hidden>
  Date:   2014-09-04 (Thu, 04 Sep 2014)

  Changed paths:
    M hw/virtio/virtio.c

  Log Message:
  -----------
  virtio: don't call device on !vm_running

On vm stop, virtio changes vm_running state
too soon, so callbacks can get envoked with
vm_running = false;

Cc: address@hidden
Cc: Jason Wang <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: 07d8084624b3f5cbde7777849147a6a3a862e90a
      
https://github.com/qemu/qemu/commit/07d8084624b3f5cbde7777849147a6a3a862e90a
  Author: Michael S. Tsirkin <address@hidden>
  Date:   2014-09-04 (Thu, 04 Sep 2014)

  Changed paths:
    M net/queue.c

  Log Message:
  -----------
  net: invoke callback when purging queue

devices rely on packet callbacks eventually running,
but we violate this rule whenever we purge the queue.
To fix, invoke callbacks on all packets on purge.
Set length to 0, this way callers can detect that
this happened and re-queue if necessary.

Cc: address@hidden
Cc: Jason Wang <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
Acked-by: Jason Wang <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: ca77d85e1dbf929ae677a0bac96e9b3edd1704da
      
https://github.com/qemu/qemu/commit/ca77d85e1dbf929ae677a0bac96e9b3edd1704da
  Author: Michael S. Tsirkin <address@hidden>
  Date:   2014-09-04 (Thu, 04 Sep 2014)

  Changed paths:
    M net/net.c

  Log Message:
  -----------
  net: complete all queued packets on VM stop

This completes all packets, ensuring that callbacks
will not run when VM is stopped.

Cc: address@hidden
Cc: Jason Wang <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: 086abc1ccd0fa5103345adda819e6c6436949579
      
https://github.com/qemu/qemu/commit/086abc1ccd0fa5103345adda819e6c6436949579
  Author: Michael S. Tsirkin <address@hidden>
  Date:   2014-09-04 (Thu, 04 Sep 2014)

  Changed paths:
    M hw/net/virtio-net.c

  Log Message:
  -----------
  virtio-net: purge outstanding packets when starting vhost

whenever we start vhost, virtio could have outstanding packets
queued, when they complete later we'll modify the ring
while vhost is processing it.

To prevent this, purge outstanding packets on vhost start.

Cc: address@hidden
Cc: Jason Wang <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: 8cf8c92e7775b9c5e811c55c9b8814168c46c34b
      
https://github.com/qemu/qemu/commit/8cf8c92e7775b9c5e811c55c9b8814168c46c34b
  Author: Peter Maydell <address@hidden>
  Date:   2014-09-04 (Thu, 04 Sep 2014)

  Changed paths:
    M hw/net/virtio-net.c
    M hw/virtio/virtio.c
    M net/net.c
    M net/queue.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into 
staging

Net patches

# gpg: Signature made Thu 04 Sep 2014 17:32:44 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <address@hidden>"
# gpg:                 aka "Stefan Hajnoczi <address@hidden>"

* remotes/stefanha/tags/net-pull-request:
  virtio-net: purge outstanding packets when starting vhost
  net: complete all queued packets on VM stop
  net: invoke callback when purging queue
  virtio: don't call device on !vm_running
  virtio-net: don't run bh on vm stopped
  net: Forbid dealing with packets when VM is not running

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/01eb313907dd...8cf8c92e7775

reply via email to

[Prev in Thread] Current Thread [Next in Thread]