qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] c53cd0: hmp: Fix loadvm to resume the VM on s


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] c53cd0: hmp: Fix loadvm to resume the VM on success instea...
Date: Thu, 27 May 2021 07:02:49 -0700

  Branch: refs/heads/staging
  Home:   https://github.com/qemu/qemu
  Commit: c53cd04e70641fdf9410aac40c617d074047b3e1
      
https://github.com/qemu/qemu/commit/c53cd04e70641fdf9410aac40c617d074047b3e1
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2021-05-26 (Wed, 26 May 2021)

  Changed paths:
    M monitor/hmp-cmds.c

  Log Message:
  -----------
  hmp: Fix loadvm to resume the VM on success instead of failure

Commit f61fe11aa6f broke hmp_loadvm() by adding an incorrect negation
when converting from 0/-errno return values to a bool value. The result
is that loadvm resumes the VM now if it failed and keeps it stopped if
it failed. Fix it to restore the old behaviour and do it the other way
around.

Fixes: f61fe11aa6f7f8f0ffe4ddaa56a8108f3ab57854
Cc: qemu-stable@nongnu.org
Reported-by: Yanhui Ma <yama@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20210511163151.45167-1-kwolf@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>


  Commit: 04c9f7e04ae102edf384613df98268d59ff8fb9b
      
https://github.com/qemu/qemu/commit/04c9f7e04ae102edf384613df98268d59ff8fb9b
  Author: Vivek Goyal <vgoyal@redhat.com>
  Date:   2021-05-26 (Wed, 26 May 2021)

  Changed paths:
    M tools/virtiofsd/fuse_virtio.c

  Log Message:
  -----------
  virtiofsd: Check for EINTR in preadv() and retry

We don't seem to check for EINTR and retry. There are other places
in code where we check for EINTR. So lets add a check.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Connor Kuehl <ckuehl@redhat.com>
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Message-Id: <20210518213538.693422-2-vgoyal@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>


  Commit: b31ff389315f2745cecc0f42cca7f4383b1a2a0d
      
https://github.com/qemu/qemu/commit/b31ff389315f2745cecc0f42cca7f4383b1a2a0d
  Author: Vivek Goyal <vgoyal@redhat.com>
  Date:   2021-05-26 (Wed, 26 May 2021)

  Changed paths:
    M tools/virtiofsd/fuse_virtio.c

  Log Message:
  -----------
  virtiofsd: Get rid of unreachable code in read

pvreadv() can return following.

- error
- 0 in case of EOF
- short read

We seem to handle all the cases already. We are retrying read in case
of short read. So another check for short read seems like dead code.
Get rid of it.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Connor Kuehl <ckuehl@redhat.com>
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Message-Id: <20210518213538.693422-3-vgoyal@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>


  Commit: 97dbfc5ae631724a2ae7f54de28c2f8e383b5980
      
https://github.com/qemu/qemu/commit/97dbfc5ae631724a2ae7f54de28c2f8e383b5980
  Author: Vivek Goyal <vgoyal@redhat.com>
  Date:   2021-05-26 (Wed, 26 May 2021)

  Changed paths:
    M tools/virtiofsd/fuse_virtio.c

  Log Message:
  -----------
  virtiofsd: Use iov_discard_front() to skip bytes

There are places where we need to skip few bytes from front of the iovec
array. We have our own custom code for that. Looks like iov_discard_front()
can do same thing. So use that helper instead.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Connor Kuehl <ckuehl@redhat.com>
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Message-Id: <20210518213538.693422-4-vgoyal@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>


  Commit: 0106f6f234d6361bb99cabfa48a953c929a3ca90
      
https://github.com/qemu/qemu/commit/0106f6f234d6361bb99cabfa48a953c929a3ca90
  Author: Vivek Goyal <vgoyal@redhat.com>
  Date:   2021-05-26 (Wed, 26 May 2021)

  Changed paths:
    M tools/virtiofsd/fuse_virtio.c

  Log Message:
  -----------
  virtiofsd: get rid of in_sg_left variable

in_sg_left seems to be being used primarly for debugging purpose. It is
keeping track of how many bytes are left in the scatter list we are
reading into.

We already have another variable "len" which keeps track how many bytes
are left to be read. And in_sg_left is greater than or equal to len. We
have already ensured that in the beginning of function.

    if (in_len < tosend_len) {
        fuse_log(FUSE_LOG_ERR, "%s: elem %d too small for data len %zd\n",
                 __func__, elem->index, tosend_len);
        ret = E2BIG;
        goto err;
    }

So in_sg_left seems like a redundant variable. It probably was useful for
debugging when code was being developed. Get rid of it. It helps simplify
this function.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Connor Kuehl <ckuehl@redhat.com>
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Message-Id: <20210518213538.693422-5-vgoyal@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>


  Commit: bf7a3ee04430dfe426eacf6ee587e2a069ba67ce
      
https://github.com/qemu/qemu/commit/bf7a3ee04430dfe426eacf6ee587e2a069ba67ce
  Author: Vivek Goyal <vgoyal@redhat.com>
  Date:   2021-05-26 (Wed, 26 May 2021)

  Changed paths:
    M tools/virtiofsd/fuse_virtio.c

  Log Message:
  -----------
  virtiofsd: Simplify skip byte logic

We need to skip bytes in two cases.

a. Before we start reading into in_sg, we need to skip iov_len bytes
   in the beginning which typically will have fuse_out_header.

b. If preadv() does a short read, then we need to retry preadv() with
   remainig bytes and skip the bytes preadv() read in short read.

For case a, there is no reason that skipping logic be inside the while
loop. Move it outside. And only retain logic "b" inside while loop.

Also get rid of variable "skip_size". Looks like we can do without it.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Connor Kuehl <ckuehl@redhat.com>
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Message-Id: <20210518213538.693422-6-vgoyal@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>


  Commit: 1a5fff8e63a5ab55ccdec4f134b2f96453bf789f
      
https://github.com/qemu/qemu/commit/1a5fff8e63a5ab55ccdec4f134b2f96453bf789f
  Author: Vivek Goyal <vgoyal@redhat.com>
  Date:   2021-05-26 (Wed, 26 May 2021)

  Changed paths:
    M tools/virtiofsd/fuse_virtio.c

  Log Message:
  -----------
  virtiofsd: Check EOF before short read

In virtio_send_data_iov() we are checking first for short read and then
EOF condition. Change the order. Basically check for error and EOF first
and last remaining piece is short ready which will lead to retry
automatically at the end of while loop.

Just that it is little simpler to read to the code. There is no need
to call "continue" and also one less call of "len-=ret".

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Connor Kuehl <ckuehl@redhat.com>
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Message-Id: <20210518213538.693422-7-vgoyal@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>


  Commit: b5fd59cf907df7fa2272426010c4d264682347f2
      
https://github.com/qemu/qemu/commit/b5fd59cf907df7fa2272426010c4d264682347f2
  Author: Vivek Goyal <vgoyal@redhat.com>
  Date:   2021-05-26 (Wed, 26 May 2021)

  Changed paths:
    M tools/virtiofsd/fuse_virtio.c

  Log Message:
  -----------
  virtiofsd: Set req->reply_sent right after sending reply

There is no reason to set it in label "err". We should be able to set
it right after sending reply. It is easier to read.

Also got rid of label "err" because now only thing it was doing was
return a code. We can return from the error location itself and no
need to first jump to label "err".

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Connor Kuehl <ckuehl@redhat.com>
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Message-Id: <20210518213538.693422-8-vgoyal@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>


  Commit: d14d4f4f1815dcf63fa6b90e9a34854977e42f84
      
https://github.com/qemu/qemu/commit/d14d4f4f1815dcf63fa6b90e9a34854977e42f84
  Author: Mahmoud Mandour <ma.mandourr@gmail.com>
  Date:   2021-05-26 (Wed, 26 May 2021)

  Changed paths:
    M tools/virtiofsd/buffer.c

  Log Message:
  -----------
  tools/virtiofsd/buffer.c: replaced a calloc call with GLib's g_try_new0

Replaced a call to calloc() and its respective free() call
with GLib's g_try_new0() and g_free() calls.

Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>
Message-Id: <20210314032324.45142-7-ma.mandourr@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>


  Commit: bf99f30bc3420f2f4b82f7f827fb93197d33c017
      
https://github.com/qemu/qemu/commit/bf99f30bc3420f2f4b82f7f827fb93197d33c017
  Author: Mahmoud Mandour <ma.mandourr@gmail.com>
  Date:   2021-05-26 (Wed, 26 May 2021)

  Changed paths:
    M tools/virtiofsd/fuse_opt.c

  Log Message:
  -----------
  tools/virtiofsd/fuse_opt.c: Replaced a malloc with GLib's g_try_malloc

Replaced a malloc() call and its respective free() with
GLib's g_try_malloc() and g_free() calls.

Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>
Message-Id: <20210314032324.45142-8-ma.mandourr@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>


  Commit: efb208dc9c3f1e881aecff21fb1c7a7b6b869480
      
https://github.com/qemu/qemu/commit/efb208dc9c3f1e881aecff21fb1c7a7b6b869480
  Author: Li Zhijian <lizhijian@cn.fujitsu.com>
  Date:   2021-05-26 (Wed, 26 May 2021)

  Changed paths:
    M migration/rdma.c

  Log Message:
  -----------
  migration/rdma: Fix cm_event used before being initialized

A segmentation fault was triggered when i try to abort a postcopy + rdma
migration.

since rdma_ack_cm_event releases a uninitialized cm_event in these case.

like below:
2496     ret = rdma_get_cm_event(rdma->channel, &cm_event);
2497     if (ret) {
2498         perror("rdma_get_cm_event after rdma_connect");
2499         ERROR(errp, "connecting to destination!");
2500         rdma_ack_cm_event(cm_event); <<<< cause segmentation fault
2501         goto err_rdma_source_connect;
2502     }

Refer to the rdma_get_cm_event() code, cm_event will be
updated/changed only if rdma_get_cm_event() returns 0. So it's okey to
remove the ack in error patch.

Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>

Message-Id: <20210519064740.10828-1-lizhijian@cn.fujitsu.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>


  Commit: 4e812d2338acb354b969b59f792f413f567c0ace
      
https://github.com/qemu/qemu/commit/4e812d2338acb354b969b59f792f413f567c0ace
  Author: Li Zhijian <lizhijian@cn.fujitsu.com>
  Date:   2021-05-26 (Wed, 26 May 2021)

  Changed paths:
    M migration/rdma.c

  Log Message:
  -----------
  migration/rdma: cleanup rdma in rdma_start_incoming_migration error path

the error path after calling qemu_rdma_dest_init() should do rdma cleanup

Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Message-Id: <20210520081148.17001-1-lizhijian@cn.fujitsu.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>


  Commit: f53b450ada3bf7fa1c88fbf4f13b864af7795bd3
      
https://github.com/qemu/qemu/commit/f53b450ada3bf7fa1c88fbf4f13b864af7795bd3
  Author: Li Zhijian <lizhijian@cn.fujitsu.com>
  Date:   2021-05-26 (Wed, 26 May 2021)

  Changed paths:
    M migration/rdma.c

  Log Message:
  -----------
  migration/rdma: Fix rdma_addrinfo res leaks

rdma_freeaddrinfo() is the reverse operation of rdma_getaddrinfo()

Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20210525080552.28259-2-lizhijian@cn.fujitsu.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>


  Commit: 44bcfd45e9806c78d9d526d69b0590227d215a78
      
https://github.com/qemu/qemu/commit/44bcfd45e9806c78d9d526d69b0590227d215a78
  Author: Li Zhijian <lizhijian@cn.fujitsu.com>
  Date:   2021-05-26 (Wed, 26 May 2021)

  Changed paths:
    M migration/rdma.c

  Log Message:
  -----------
  migration/rdma: destination: create the return patch after the first accept

destination side:
$ build/qemu-system-x86_64 -enable-kvm -netdev 
tap,id=hn0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown -device 
e1000,netdev=hn0,mac=50:52:54:00:11:22 -boot c -drive 
if=none,file=./Fedora-rdma-server-migration.qcow2,id=drive-virtio-disk0 -device 
virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0 -m 
2048 -smp 2 -device piix3-usb-uhci -device usb-tablet -monitor stdio -vga qxl 
-spice streaming-video=filter,port=5902,disable-ticketing -incoming 
rdma:192.168.1.10:8888
(qemu) migrate_set_capability postcopy-ram on
(qemu)
dest_init RDMA Device opened: kernel name rocep1s0f0 uverbs device name 
uverbs0, infiniband_verbs class device path 
/sys/class/infiniband_verbs/uverbs0, infiniband class device path 
/sys/class/infiniband/rocep1s0f0, transport: (2) Ethernet
Segmentation fault (core dumped)

 (gdb) bt
 #0  qemu_rdma_accept (rdma=0x0) at ../migration/rdma.c:3272
 #1  rdma_accept_incoming_migration (opaque=0x0) at     ../migration/rdma.c:3986
 #2  0x0000563c9e51f02a in aio_dispatch_handler
     (ctx=ctx@entry=0x563ca0606010, node=0x563ca12b2150) at 
../util/aio-posix.c:329
 #3  0x0000563c9e51f752 in aio_dispatch_handlers (ctx=0x563ca0606010) at      
../util/aio-posix.c:372
 #4  aio_dispatch (ctx=0x563ca0606010) at ../util/aio-posix.c:382
 #5  0x0000563c9e4f4d9e in aio_ctx_dispatch (source=<optimized out>,      
callback=<optimized out>, user_data=<optimized out>)    at ../util/async.c:306
 #6  0x00007fe96ef3fa9f in g_main_context_dispatch () at      
/lib64/libglib-2.0.so.0
 #7  0x0000563c9e4ffeb8 in glib_pollfds_poll () at     ../util/main-loop.c:231
 #8  os_host_main_loop_wait (timeout=12188789) at     ../util/main-loop.c:254
 #9  main_loop_wait (nonblocking=nonblocking@entry=0) at     
../util/main-loop.c:530
 #10 0x0000563c9e3c7211 in qemu_main_loop () at     ../softmmu/runstate.c:725
 #11 0x0000563c9dfd46fe in main (argc=<optimized out>, argv=<optimized     
out>, envp=<optimized out>) at ../softmmu/main.c:50

The rdma return path will not be created when qemu incoming is starting
since migrate_copy() is false at that moment, then a  NULL return path
rdma was referenced if the user enabled postcopy later.

Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Message-Id: <20210525080552.28259-3-lizhijian@cn.fujitsu.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>


  Commit: e49e49dd73b8b17f5f341b3e11c8b6878c43d3e1
      
https://github.com/qemu/qemu/commit/e49e49dd73b8b17f5f341b3e11c8b6878c43d3e1
  Author: Li Zhijian <lizhijian@cn.fujitsu.com>
  Date:   2021-05-26 (Wed, 26 May 2021)

  Changed paths:
    M migration/rdma.c

  Log Message:
  -----------
  migration/rdma: source: poll cm_event from return path

source side always blocks if postcopy is only enabled at source side.
users are not able to cancel this migration in this case.

Let source side have chance to cancel this migration

Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Message-Id: <20210525080552.28259-4-lizhijian@cn.fujitsu.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
  Typo fix


  Commit: c5847f5e4e5e0aa6a3dd40c5d2ec9a70bdc990a5
      
https://github.com/qemu/qemu/commit/c5847f5e4e5e0aa6a3dd40c5d2ec9a70bdc990a5
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2021-05-27 (Thu, 27 May 2021)

  Changed paths:
    M migration/rdma.c
    M monitor/hmp-cmds.c
    M tools/virtiofsd/buffer.c
    M tools/virtiofsd/fuse_opt.c
    M tools/virtiofsd/fuse_virtio.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20210526a' 
into staging

Virtiofs, migration and hmp pull 2021-05-26

Fixes for a loadvm regression from Kevin,
some virtiofsd cleanups from Vivek and Mahmoud, and
some RDMA migration fixups from Li.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

# gpg: Signature made Wed 26 May 2021 18:43:30 BST
# gpg:                using RSA key 45F5C71B4A0CB7FB977A9FA90516331EBC5BFDE7
# gpg: Good signature from "Dr. David Alan Gilbert (RH2) <dgilbert@redhat.com>" 
[full]
# Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A  9FA9 0516 331E BC5B FDE7

* remotes/dgilbert/tags/pull-migration-20210526a:
  migration/rdma: source: poll cm_event from return path
  migration/rdma: destination: create the return patch after the first accept
  migration/rdma: Fix rdma_addrinfo res leaks
  migration/rdma: cleanup rdma in rdma_start_incoming_migration error path
  migration/rdma: Fix cm_event used before being initialized
  tools/virtiofsd/fuse_opt.c: Replaced a malloc with GLib's g_try_malloc
  tools/virtiofsd/buffer.c: replaced a calloc call with GLib's g_try_new0
  virtiofsd: Set req->reply_sent right after sending reply
  virtiofsd: Check EOF before short read
  virtiofsd: Simplify skip byte logic
  virtiofsd: get rid of in_sg_left variable
  virtiofsd: Use iov_discard_front() to skip bytes
  virtiofsd: Get rid of unreachable code in read
  virtiofsd: Check for EINTR in preadv() and retry
  hmp: Fix loadvm to resume the VM on success instead of failure

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/8385235ba99c...c5847f5e4e5e



reply via email to

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