qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/5] pc, vhost: fixes for rc3
@ 2017-08-09  1:50 Michael S. Tsirkin
  2017-08-09  1:50 ` [Qemu-devel] [PULL 1/5] acpi-test: update expected DSDT files Michael S. Tsirkin
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2017-08-09  1:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell

The following changes since commit 54affb3a3623b1d36c95e34faa722a5831323a74:

  Update version for v2.10.0-rc2 release (2017-08-08 19:07:46 +0100)

are available in the git repository at:

  git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to 24dd1e17696fbd11b3df50718dddcbdfe2c45f24:

  libqtest: always set up signal handler for SIGABRT (2017-08-09 04:22:14 +0300)

----------------------------------------------------------------
pc, vhost: fixes for rc3

Fix up bugs and warnings in tests. Revert an experimental commit that I
put in by mistake: harmless but useless.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

----------------------------------------------------------------
Jens Freimann (3):
      net: fix -netdev socket,fd= for UDP sockets
      libvhost-user: quit when no more data received
      libqtest: always set up signal handler for SIGABRT

Michael S. Tsirkin (2):
      acpi-test: update expected DSDT files
      Revert "cpu: add APIs to allocate/free CPU environment"

 include/qom/cpu.h                     |  31 ----------------------------
 contrib/libvhost-user/libvhost-user.c |   4 +++-
 net/socket.c                          |  37 +++++++++++++++++-----------------
 qom/cpu.c                             |  34 -------------------------------
 tests/libqtest.c                      |   2 +-
 tests/acpi-test-data/q35/DSDT         | Bin 7782 -> 7782 bytes
 tests/acpi-test-data/q35/DSDT.bridge  | Bin 7799 -> 7799 bytes
 tests/acpi-test-data/q35/DSDT.cphp    | Bin 8245 -> 8245 bytes
 tests/acpi-test-data/q35/DSDT.ipmibt  | Bin 7857 -> 7857 bytes
 tests/acpi-test-data/q35/DSDT.memhp   | Bin 9147 -> 9147 bytes
 10 files changed, 22 insertions(+), 86 deletions(-)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PULL 1/5] acpi-test: update expected DSDT files
  2017-08-09  1:50 [Qemu-devel] [PULL 0/5] pc, vhost: fixes for rc3 Michael S. Tsirkin
@ 2017-08-09  1:50 ` Michael S. Tsirkin
  2017-08-09  1:50 ` [Qemu-devel] [PULL 2/5] Revert "cpu: add APIs to allocate/free CPU environment" Michael S. Tsirkin
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2017-08-09  1:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/acpi-test-data/q35/DSDT        | Bin 7782 -> 7782 bytes
 tests/acpi-test-data/q35/DSDT.bridge | Bin 7799 -> 7799 bytes
 tests/acpi-test-data/q35/DSDT.cphp   | Bin 8245 -> 8245 bytes
 tests/acpi-test-data/q35/DSDT.ipmibt | Bin 7857 -> 7857 bytes
 tests/acpi-test-data/q35/DSDT.memhp  | Bin 9147 -> 9147 bytes
 5 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/tests/acpi-test-data/q35/DSDT b/tests/acpi-test-data/q35/DSDT
index a6138c829142265255ac6f7bedd44757e944eb2f..a080e2ace20ce9b88d5a61078d8caa0262617eed 100644
GIT binary patch
delta 24
fcmaE6^UQ|JCD<h-O^$(qF?1r=6-N1u_uFLwW`_tH

delta 24
fcmaE6^UQ|JCD<h-O^$(qF?=G|6-L>O_uFLwW|0UR

diff --git a/tests/acpi-test-data/q35/DSDT.bridge b/tests/acpi-test-data/q35/DSDT.bridge
index 6b90f606f8b76f71ea9c569f4e606aeecd9e239d..31a76732e563dde32e6d976670baa732a6b91807 100644
GIT binary patch
delta 24
gcmexv^WBEaCD<jTT#kW(@#{pcD~$3R@6V700C4sQ{{R30

delta 24
gcmexv^WBEaCD<jTT#kW(@%u!sD~z%m@6V700C4~a{{R30

diff --git a/tests/acpi-test-data/q35/DSDT.cphp b/tests/acpi-test-data/q35/DSDT.cphp
index 976755ef2dc8ab68a82b64ab9fff793c4a113db9..3e23cb638f296644154100379584b30b644926bd 100644
GIT binary patch
delta 24
gcmdn$u+@RfCD<jzRDpqk@!UkND~$3R?}y0)0AK(I+yDRo

delta 24
gcmdn$u+@RfCD<jzRDpqk@xnx|D~z%m?}y0)0ALCS+yDRo

diff --git a/tests/acpi-test-data/q35/DSDT.ipmibt b/tests/acpi-test-data/q35/DSDT.ipmibt
index b3fa4359ff2cad5569bb625dff7be8f8b4590ba9..9c5e03fd2ffd3a99f3e5214ba187456a86410b22 100644
GIT binary patch
delta 24
gcmdmJyU~`*CD<ioqZ|VRW7R~iD~$3R?_ZJy0Ard6ZU6uP

delta 24
gcmdmJyU~`*CD<ioqZ|VRW6eaaD~z%m?_ZJy0Ar*GZU6uP

diff --git a/tests/acpi-test-data/q35/DSDT.memhp b/tests/acpi-test-data/q35/DSDT.memhp
index 7341c405bfb7dd21b4ec5df92411963cdf894c4d..1b7c484a5e31ec456685bc246197252cb48a3adf 100644
GIT binary patch
delta 24
gcmdn(zT2J4CD<iow=x3*W8_4xD~$3R@83}Z0A|SulK=n!

delta 24
gcmdn(zT2J4CD<iow=x3*WAsF>D~z%m@83}Z0A|w&lK=n!

-- 
MST

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PULL 2/5] Revert "cpu: add APIs to allocate/free CPU environment"
  2017-08-09  1:50 [Qemu-devel] [PULL 0/5] pc, vhost: fixes for rc3 Michael S. Tsirkin
  2017-08-09  1:50 ` [Qemu-devel] [PULL 1/5] acpi-test: update expected DSDT files Michael S. Tsirkin
@ 2017-08-09  1:50 ` Michael S. Tsirkin
  2017-08-09  1:50 ` [Qemu-devel] [PULL 3/5] net: fix -netdev socket, fd= for UDP sockets Michael S. Tsirkin
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2017-08-09  1:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Paolo Bonzini, Alex Bennée, Richard Henderson,
	Eduardo Habkost, Emilio G. Cota, Stefan Hajnoczi,
	Lluís Vilanova

This reverts commit e2a7f28693aea7e194ec1435697ec4feb24f8a6f.

This was not supposed to go upstream yet. Reverting.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/qom/cpu.h | 31 -------------------------------
 qom/cpu.c         | 34 ----------------------------------
 2 files changed, 65 deletions(-)

diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index e9d30c5..25eefea 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -162,10 +162,6 @@ typedef struct CPUClass {
     void (*dump_statistics)(CPUState *cpu, FILE *f,
                             fprintf_function cpu_fprintf, int flags);
     int64_t (*get_arch_id)(CPUState *cpu);
-    void * (*alloc_env)(CPUState *cpu);
-    void (*get_env)(CPUState *cpu, void *env);
-    void (*set_env)(CPUState *cpu, void *env);
-    void (*free_env)(CPUState *cpu, void *env);
     bool (*get_paging_enabled)(const CPUState *cpu);
     void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list,
                                Error **errp);
@@ -444,33 +440,6 @@ extern bool mttcg_enabled;
 #define qemu_tcg_mttcg_enabled() (mttcg_enabled)
 
 /**
- * cpu_alloc_env: allocate CPU environment structure
- * @cpu: allocate environment structure for this CPU
- */
-void *cpu_alloc_env(CPUState *cpu);
-
-/**
- * cpu_get_env: retrieve CPU environment structure
- * @cpu: CPU to use
- * @env: environment structure to use
- */
-void cpu_get_env(CPUState *cpu, void *env);
-
-/**
- * cpu_set_env: switch to given CPU environment
- * @cpu: CPU to use
- * @env: environment structure to use
- */
-void cpu_set_env(CPUState *cpu, void *env);
-
-/**
- * cpu_free_env: free CPU environment structure
- * @cpu: free environment structure for this CPU
- * @env: structure to free
- */
-void cpu_free_env(CPUState *cpu, void *env);
-
-/**
  * cpu_paging_enabled:
  * @cpu: The CPU whose state is to be inspected.
  *
diff --git a/qom/cpu.c b/qom/cpu.c
index 9201fd9..4f38db0 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -89,40 +89,6 @@ out:
     return cpu;
 }
 
-void *cpu_alloc_env(CPUState *cpu)
-{
-    CPUClass *cc = CPU_GET_CLASS(cpu);
-
-    return cc->alloc_env ? cc->alloc_env(cpu) : NULL;
-}
-
-void cpu_get_env(CPUState *cpu, void *env)
-{
-    CPUClass *cc = CPU_GET_CLASS(cpu);
-
-    if (cc->get_env) {
-        cc->get_env(cpu, env);
-    }
-}
-
-void cpu_set_env(CPUState *cpu, void *env)
-{
-    CPUClass *cc = CPU_GET_CLASS(cpu);
-
-    if (cc->set_env) {
-        cc->set_env(cpu, env);
-    }
-}
-
-void cpu_free_env(CPUState *cpu, void *env)
-{
-    CPUClass *cc = CPU_GET_CLASS(cpu);
-
-    if (cc->free_env) {
-        cc->free_env(cpu, env);
-    }
-}
-
 bool cpu_paging_enabled(const CPUState *cpu)
 {
     CPUClass *cc = CPU_GET_CLASS(cpu);
-- 
MST

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PULL 3/5] net: fix -netdev socket, fd= for UDP sockets
  2017-08-09  1:50 [Qemu-devel] [PULL 0/5] pc, vhost: fixes for rc3 Michael S. Tsirkin
  2017-08-09  1:50 ` [Qemu-devel] [PULL 1/5] acpi-test: update expected DSDT files Michael S. Tsirkin
  2017-08-09  1:50 ` [Qemu-devel] [PULL 2/5] Revert "cpu: add APIs to allocate/free CPU environment" Michael S. Tsirkin
@ 2017-08-09  1:50 ` Michael S. Tsirkin
  2017-09-05  4:05   ` Mao Zhongyi
  2017-08-09  1:50 ` [Qemu-devel] [PULL 4/5] libvhost-user: quit when no more data received Michael S. Tsirkin
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 8+ messages in thread
From: Michael S. Tsirkin @ 2017-08-09  1:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Jens Freimann, Jason Wang

From: Jens Freimann <jfreimann@redhat.com>

This patch fixes -netdev socket,fd= for UDP sockets
Currently -netdev socket,fd=<...> results in

  qemu: error: specified mcastaddr "127.0.0.1" (0x7f000001) does not
    contain a multicast address
  qemu-system-x86_64: -netdev
    socket,id=n1,fd=3: Device 'socket' could not be initialized

To fix these we need to allow specifying multicast and fd arguments
for the same netdev. With this the user can specify "-netdev
fd=3,mcast=<IP:port>"

Cc: Jason Wang <jasowang@redhat.com>
Fixes: 3d830459b1eccdb61b75e2712fd364012ce5a115
Signed-off-by: Jens Freimann <jfreimann@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 net/socket.c | 37 ++++++++++++++++++-------------------
 1 file changed, 18 insertions(+), 19 deletions(-)

diff --git a/net/socket.c b/net/socket.c
index f85ef7d..18af2ab 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -320,11 +320,11 @@ static NetClientInfo net_dgram_socket_info = {
 static NetSocketState *net_socket_fd_init_dgram(NetClientState *peer,
                                                 const char *model,
                                                 const char *name,
-                                                int fd, int is_connected)
+                                                int fd, int is_connected,
+                                                const char *mcast)
 {
     struct sockaddr_in saddr;
     int newfd;
-    socklen_t saddr_len = sizeof(saddr);
     NetClientState *nc;
     NetSocketState *s;
 
@@ -333,8 +333,13 @@ static NetSocketState *net_socket_fd_init_dgram(NetClientState *peer,
      * by ONLY ONE process: we must "clone" this dgram socket --jjo
      */
 
-    if (is_connected) {
-        if (getsockname(fd, (struct sockaddr *) &saddr, &saddr_len) == 0) {
+    if (is_connected && mcast != NULL) {
+            if (parse_host_port(&saddr, mcast) < 0) {
+                fprintf(stderr,
+                        "qemu: error: init_dgram: fd=%d failed parse_host_port()\n",
+                        fd);
+                goto err;
+            }
             /* must be bound */
             if (saddr.sin_addr.s_addr == 0) {
                 fprintf(stderr, "qemu: error: init_dgram: fd=%d unbound, "
@@ -351,12 +356,6 @@ static NetSocketState *net_socket_fd_init_dgram(NetClientState *peer,
             dup2(newfd, fd);
             close(newfd);
 
-        } else {
-            fprintf(stderr,
-                    "qemu: error: init_dgram: fd=%d failed getsockname(): %s\n",
-                    fd, strerror(errno));
-            goto err;
-        }
     }
 
     nc = qemu_new_net_client(&net_dgram_socket_info, peer, model, name);
@@ -432,7 +431,7 @@ static NetSocketState *net_socket_fd_init_stream(NetClientState *peer,
 
 static NetSocketState *net_socket_fd_init(NetClientState *peer,
                                           const char *model, const char *name,
-                                          int fd, int is_connected)
+                                          int fd, int is_connected, const char *mc)
 {
     int so_type = -1, optlen=sizeof(so_type);
 
@@ -445,7 +444,7 @@ static NetSocketState *net_socket_fd_init(NetClientState *peer,
     }
     switch(so_type) {
     case SOCK_DGRAM:
-        return net_socket_fd_init_dgram(peer, model, name, fd, is_connected);
+        return net_socket_fd_init_dgram(peer, model, name, fd, is_connected, mc);
     case SOCK_STREAM:
         return net_socket_fd_init_stream(peer, model, name, fd, is_connected);
     default:
@@ -567,7 +566,7 @@ static int net_socket_connect_init(NetClientState *peer,
             break;
         }
     }
-    s = net_socket_fd_init(peer, model, name, fd, connected);
+    s = net_socket_fd_init(peer, model, name, fd, connected, NULL);
     if (!s)
         return -1;
     snprintf(s->nc.info_str, sizeof(s->nc.info_str),
@@ -602,7 +601,7 @@ static int net_socket_mcast_init(NetClientState *peer,
     if (fd < 0)
         return -1;
 
-    s = net_socket_fd_init(peer, model, name, fd, 0);
+    s = net_socket_fd_init(peer, model, name, fd, 0, NULL);
     if (!s)
         return -1;
 
@@ -652,7 +651,7 @@ static int net_socket_udp_init(NetClientState *peer,
     }
     qemu_set_nonblock(fd);
 
-    s = net_socket_fd_init(peer, model, name, fd, 0);
+    s = net_socket_fd_init(peer, model, name, fd, 0, NULL);
     if (!s) {
         return -1;
     }
@@ -675,9 +674,9 @@ int net_init_socket(const Netdev *netdev, const char *name,
     assert(netdev->type == NET_CLIENT_DRIVER_SOCKET);
     sock = &netdev->u.socket;
 
-    if (sock->has_fd + sock->has_listen + sock->has_connect + sock->has_mcast +
-        sock->has_udp != 1) {
-        error_report("exactly one of fd=, listen=, connect=, mcast= or udp="
+    if (sock->has_listen + sock->has_connect + sock->has_mcast +
+        sock->has_udp > 1) {
+        error_report("exactly one of listen=, connect=, mcast= or udp="
                      " is required");
         return -1;
     }
@@ -696,7 +695,7 @@ int net_init_socket(const Netdev *netdev, const char *name,
             return -1;
         }
         qemu_set_nonblock(fd);
-        if (!net_socket_fd_init(peer, "socket", name, fd, 1)) {
+        if (!net_socket_fd_init(peer, "socket", name, fd, 1, sock->mcast)) {
             return -1;
         }
         return 0;
-- 
MST

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PULL 4/5] libvhost-user: quit when no more data received
  2017-08-09  1:50 [Qemu-devel] [PULL 0/5] pc, vhost: fixes for rc3 Michael S. Tsirkin
                   ` (2 preceding siblings ...)
  2017-08-09  1:50 ` [Qemu-devel] [PULL 3/5] net: fix -netdev socket, fd= for UDP sockets Michael S. Tsirkin
@ 2017-08-09  1:50 ` Michael S. Tsirkin
  2017-08-09  1:50 ` [Qemu-devel] [PULL 5/5] libqtest: always set up signal handler for SIGABRT Michael S. Tsirkin
  2017-08-10 10:12 ` [Qemu-devel] [PULL 0/5] pc, vhost: fixes for rc3 Peter Maydell
  5 siblings, 0 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2017-08-09  1:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Jens Freimann, Felipe Franciosi,
	Marc-André Lureau, Philippe Mathieu-Daudé

From: Jens Freimann <jfreiman@redhat.com>

End processing of messages when VHOST_USER_NONE
is received.

Without this we run into a vubr_panic() call and get
"PANIC: Unhandled request: 0"

Signed-off-by: Jens Freimann <jfreiman@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 contrib/libvhost-user/libvhost-user.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c
index 9efb9da..35fa0c5 100644
--- a/contrib/libvhost-user/libvhost-user.c
+++ b/contrib/libvhost-user/libvhost-user.c
@@ -161,7 +161,7 @@ vu_message_read(VuDev *dev, int conn_fd, VhostUserMsg *vmsg)
         rc = recvmsg(conn_fd, &msg, 0);
     } while (rc < 0 && (errno == EINTR || errno == EAGAIN));
 
-    if (rc <= 0) {
+    if (rc < 0) {
         vu_panic(dev, "Error while recvmsg: %s", strerror(errno));
         return false;
     }
@@ -806,6 +806,8 @@ vu_process_message(VuDev *dev, VhostUserMsg *vmsg)
         return vu_get_queue_num_exec(dev, vmsg);
     case VHOST_USER_SET_VRING_ENABLE:
         return vu_set_vring_enable_exec(dev, vmsg);
+    case VHOST_USER_NONE:
+        break;
     default:
         vmsg_close_fds(vmsg);
         vu_panic(dev, "Unhandled request: %d", vmsg->request);
-- 
MST

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PULL 5/5] libqtest: always set up signal handler for SIGABRT
  2017-08-09  1:50 [Qemu-devel] [PULL 0/5] pc, vhost: fixes for rc3 Michael S. Tsirkin
                   ` (3 preceding siblings ...)
  2017-08-09  1:50 ` [Qemu-devel] [PULL 4/5] libvhost-user: quit when no more data received Michael S. Tsirkin
@ 2017-08-09  1:50 ` Michael S. Tsirkin
  2017-08-10 10:12 ` [Qemu-devel] [PULL 0/5] pc, vhost: fixes for rc3 Peter Maydell
  5 siblings, 0 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2017-08-09  1:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Jens Freimann, Markus Armbruster, Eric Blake,
	John Snow, Kevin Wolf, Thomas Huth

From: Jens Freimann <jfreimann@redhat.com>

Currently abort handlers only work for the first test function
in a testcase, because the list of abort handlers is not properly
cleared when qtest_quit() is called.

qtest_quit() only deletes the kill_qemu_hook but doesn't completely
clear the abrt_hooks list.  The effect is that abrt_hooks.is_setup is
never set to false and in a following test the abrt_hooks list is not
initialized and setup_sigabrt_handler() is not called.

One way to solve this is to clear the list in qtest_quit(), but
that means only asserts between qtest_start and qtest_quit will
be catched by the abort handler.

We can make abort handlers work in all cases if we always setup the
signal handler for SIGABRT in qtest_init.

Signed-off-by: Jens Freimann <jfreimann@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/libqtest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/libqtest.c b/tests/libqtest.c
index 4a5492a..b9a1f18 100644
--- a/tests/libqtest.c
+++ b/tests/libqtest.c
@@ -140,8 +140,8 @@ void qtest_add_abrt_handler(GHookFunc fn, const void *data)
     /* Only install SIGABRT handler once */
     if (!abrt_hooks.is_setup) {
         g_hook_list_init(&abrt_hooks, sizeof(GHook));
-        setup_sigabrt_handler();
     }
+    setup_sigabrt_handler();
 
     hook = g_hook_alloc(&abrt_hooks);
     hook->func = fn;
-- 
MST

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PULL 0/5] pc, vhost: fixes for rc3
  2017-08-09  1:50 [Qemu-devel] [PULL 0/5] pc, vhost: fixes for rc3 Michael S. Tsirkin
                   ` (4 preceding siblings ...)
  2017-08-09  1:50 ` [Qemu-devel] [PULL 5/5] libqtest: always set up signal handler for SIGABRT Michael S. Tsirkin
@ 2017-08-10 10:12 ` Peter Maydell
  5 siblings, 0 replies; 8+ messages in thread
From: Peter Maydell @ 2017-08-10 10:12 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: QEMU Developers

On 9 August 2017 at 02:50, Michael S. Tsirkin <mst@redhat.com> wrote:
> The following changes since commit 54affb3a3623b1d36c95e34faa722a5831323a74:
>
>   Update version for v2.10.0-rc2 release (2017-08-08 19:07:46 +0100)
>
> are available in the git repository at:
>
>   git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
>
> for you to fetch changes up to 24dd1e17696fbd11b3df50718dddcbdfe2c45f24:
>
>   libqtest: always set up signal handler for SIGABRT (2017-08-09 04:22:14 +0300)
>
> ----------------------------------------------------------------
> pc, vhost: fixes for rc3
>
> Fix up bugs and warnings in tests. Revert an experimental commit that I
> put in by mistake: harmless but useless.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>
> ----------------------------------------------------------------
> Jens Freimann (3):
>       net: fix -netdev socket,fd= for UDP sockets
>       libvhost-user: quit when no more data received
>       libqtest: always set up signal handler for SIGABRT
>
> Michael S. Tsirkin (2):
>       acpi-test: update expected DSDT files
>       Revert "cpu: add APIs to allocate/free CPU environment"
>

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PULL 3/5] net: fix -netdev socket, fd= for UDP sockets
  2017-08-09  1:50 ` [Qemu-devel] [PULL 3/5] net: fix -netdev socket, fd= for UDP sockets Michael S. Tsirkin
@ 2017-09-05  4:05   ` Mao Zhongyi
  0 siblings, 0 replies; 8+ messages in thread
From: Mao Zhongyi @ 2017-09-05  4:05 UTC (permalink / raw)
  To: Michael S. Tsirkin, qemu-devel; +Cc: Peter Maydell, Jason Wang, Jens Freimann



On 08/09/2017 09:50 AM, Michael S. Tsirkin wrote:
> From: Jens Freimann <jfreimann@redhat.com>
>
> This patch fixes -netdev socket,fd= for UDP sockets
> Currently -netdev socket,fd=<...> results in
>
>   qemu: error: specified mcastaddr "127.0.0.1" (0x7f000001) does not
>     contain a multicast address
>   qemu-system-x86_64: -netdev
>     socket,id=n1,fd=3: Device 'socket' could not be initialized
>
> To fix these we need to allow specifying multicast and fd arguments
> for the same netdev. With this the user can specify "-netdev
> fd=3,mcast=<IP:port>"
>
> Cc: Jason Wang <jasowang@redhat.com>
> Fixes: 3d830459b1eccdb61b75e2712fd364012ce5a115
> Signed-off-by: Jens Freimann <jfreimann@redhat.com>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  net/socket.c | 37 ++++++++++++++++++-------------------
>  1 file changed, 18 insertions(+), 19 deletions(-)
>
> diff --git a/net/socket.c b/net/socket.c
> index f85ef7d..18af2ab 100644
> --- a/net/socket.c
> +++ b/net/socket.c
> @@ -320,11 +320,11 @@ static NetClientInfo net_dgram_socket_info = {
>  static NetSocketState *net_socket_fd_init_dgram(NetClientState *peer,
>                                                  const char *model,
>                                                  const char *name,
> -                                                int fd, int is_connected)
> +                                                int fd, int is_connected,
> +                                                const char *mcast)
>  {
>      struct sockaddr_in saddr;
>      int newfd;
> -    socklen_t saddr_len = sizeof(saddr);
>      NetClientState *nc;
>      NetSocketState *s;
>
> @@ -333,8 +333,13 @@ static NetSocketState *net_socket_fd_init_dgram(NetClientState *peer,
>       * by ONLY ONE process: we must "clone" this dgram socket --jjo
>       */
>
> -    if (is_connected) {
> -        if (getsockname(fd, (struct sockaddr *) &saddr, &saddr_len) == 0) {
> +    if (is_connected && mcast != NULL) {
> +            if (parse_host_port(&saddr, mcast) < 0) {
> +                fprintf(stderr,
> +                        "qemu: error: init_dgram: fd=%d failed parse_host_port()\n",
> +                        fd);
> +                goto err;
> +            }
>              /* must be bound */
>              if (saddr.sin_addr.s_addr == 0) {
>                  fprintf(stderr, "qemu: error: init_dgram: fd=%d unbound, "
> @@ -351,12 +356,6 @@ static NetSocketState *net_socket_fd_init_dgram(NetClientState *peer,
>              dup2(newfd, fd);
>              close(newfd);
>
> -        } else {
> -            fprintf(stderr,
> -                    "qemu: error: init_dgram: fd=%d failed getsockname(): %s\n",
> -                    fd, strerror(errno));
> -            goto err;
> -        }
>      }
>
>      nc = qemu_new_net_client(&net_dgram_socket_info, peer, model, name);
> @@ -432,7 +431,7 @@ static NetSocketState *net_socket_fd_init_stream(NetClientState *peer,
>
>  static NetSocketState *net_socket_fd_init(NetClientState *peer,
>                                            const char *model, const char *name,
> -                                          int fd, int is_connected)
> +                                          int fd, int is_connected, const char *mc)
>  {
>      int so_type = -1, optlen=sizeof(so_type);
>
> @@ -445,7 +444,7 @@ static NetSocketState *net_socket_fd_init(NetClientState *peer,
>      }
>      switch(so_type) {
>      case SOCK_DGRAM:
> -        return net_socket_fd_init_dgram(peer, model, name, fd, is_connected);
> +        return net_socket_fd_init_dgram(peer, model, name, fd, is_connected, mc);
>      case SOCK_STREAM:
>          return net_socket_fd_init_stream(peer, model, name, fd, is_connected);
>      default:
> @@ -567,7 +566,7 @@ static int net_socket_connect_init(NetClientState *peer,
>              break;
>          }
>      }
> -    s = net_socket_fd_init(peer, model, name, fd, connected);
> +    s = net_socket_fd_init(peer, model, name, fd, connected, NULL);
>      if (!s)
>          return -1;
>      snprintf(s->nc.info_str, sizeof(s->nc.info_str),
> @@ -602,7 +601,7 @@ static int net_socket_mcast_init(NetClientState *peer,
>      if (fd < 0)
>          return -1;
>
> -    s = net_socket_fd_init(peer, model, name, fd, 0);
> +    s = net_socket_fd_init(peer, model, name, fd, 0, NULL);
>      if (!s)
>          return -1;
>
> @@ -652,7 +651,7 @@ static int net_socket_udp_init(NetClientState *peer,
>      }
>      qemu_set_nonblock(fd);
>
> -    s = net_socket_fd_init(peer, model, name, fd, 0);
> +    s = net_socket_fd_init(peer, model, name, fd, 0, NULL);
>      if (!s) {
>          return -1;
>      }
> @@ -675,9 +674,9 @@ int net_init_socket(const Netdev *netdev, const char *name,
>      assert(netdev->type == NET_CLIENT_DRIVER_SOCKET);
>      sock = &netdev->u.socket;
>
> -    if (sock->has_fd + sock->has_listen + sock->has_connect + sock->has_mcast +
> -        sock->has_udp != 1) {
> -        error_report("exactly one of fd=, listen=, connect=, mcast= or udp="
> +    if (sock->has_listen + sock->has_connect + sock->has_mcast +
> +        sock->has_udp > 1) {
> +        error_report("exactly one of listen=, connect=, mcast= or udp="
>                       " is required");
>          return -1;
>      }

Hi, all

I think there is a bug in here:

$ ./x86_64-softmmu/qemu-system-x86_64 -net socket
qemu-system-x86_64: net/socket.c:729: net_init_socket: Assertion `sock->has_udp' failed.
Aborted (core dumped)

Exactly one of listen=, connect=, mcast= or udp= is required. It
means less or more than one is wrong. But here ignores the situation
that one has not been specified to occur the above error.

If I am wrong, please correct me, else I will send a patch to fix it. :)

Thanks,
Mao


> @@ -696,7 +695,7 @@ int net_init_socket(const Netdev *netdev, const char *name,
>              return -1;
>          }
>          qemu_set_nonblock(fd);
> -        if (!net_socket_fd_init(peer, "socket", name, fd, 1)) {
> +        if (!net_socket_fd_init(peer, "socket", name, fd, 1, sock->mcast)) {
>              return -1;
>          }
>          return 0;
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-09-05  4:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-09  1:50 [Qemu-devel] [PULL 0/5] pc, vhost: fixes for rc3 Michael S. Tsirkin
2017-08-09  1:50 ` [Qemu-devel] [PULL 1/5] acpi-test: update expected DSDT files Michael S. Tsirkin
2017-08-09  1:50 ` [Qemu-devel] [PULL 2/5] Revert "cpu: add APIs to allocate/free CPU environment" Michael S. Tsirkin
2017-08-09  1:50 ` [Qemu-devel] [PULL 3/5] net: fix -netdev socket, fd= for UDP sockets Michael S. Tsirkin
2017-09-05  4:05   ` Mao Zhongyi
2017-08-09  1:50 ` [Qemu-devel] [PULL 4/5] libvhost-user: quit when no more data received Michael S. Tsirkin
2017-08-09  1:50 ` [Qemu-devel] [PULL 5/5] libqtest: always set up signal handler for SIGABRT Michael S. Tsirkin
2017-08-10 10:12 ` [Qemu-devel] [PULL 0/5] pc, vhost: fixes for rc3 Peter Maydell

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).