[Qemu-devel] [PATCH 3/4] Add GDB qAttached support

2015-02-07 Thread Jan Kiszka
From: Jan Kiszka jan.kis...@siemens.com

With this patch QEMU handles qAttached request from gdb. When QEMU
replies 1, GDB sends a detach command at the end of a debugging
session otherwise GDB sends kill.

The default value for qAttached is 1 on system emulation and 0 on user
emulation.

Based on original version by Fabien Chouteau.

Signed-off-by: Jan Kiszka jan.kis...@siemens.com
---
 gdbstub.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/gdbstub.c b/gdbstub.c
index 91cc785..efa29b2 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -41,6 +41,12 @@
 #include qemu/sockets.h
 #include sysemu/kvm.h
 
+#ifdef CONFIG_USER_ONLY
+#define GDB_ATTACHED 0
+#else
+#define GDB_ATTACHED 1
+#endif
+
 static inline int target_memory_rw_debug(CPUState *cpu, target_ulong addr,
  uint8_t *buf, int len, bool is_write)
 {
@@ -1195,6 +1201,10 @@ static int gdb_handle_packet(GDBState *s, const char 
*line_buf)
 put_packet_binary(s, buf, len + 1);
 break;
 }
+if (is_query_packet(p, Attached, ':')) {
+put_packet(s, GDB_ATTACHED);
+break;
+}
 /* Unrecognised 'q' command.  */
 goto unknown_command;
 
-- 
2.1.4




[Qemu-devel] [PATCH 1/4] gdbstub: Fix qOffsets packet detection

2015-02-07 Thread Jan Kiszka
From: Jan Kiszka jan.kis...@siemens.com

qOffsets has no additional optional parameters. So match the complete
string to avoid stumbling over possible future commands with identical
prefix.

Signed-off-by: Jan Kiszka jan.kis...@siemens.com
---
 gdbstub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdbstub.c b/gdbstub.c
index e4a1a79..cd25d1a 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1107,7 +1107,7 @@ static int gdb_handle_packet(GDBState *s, const char 
*line_buf)
 break;
 }
 #ifdef CONFIG_USER_ONLY
-else if (strncmp(p, Offsets, 7) == 0) {
+else if (strcmp(p, Offsets) == 0) {
 TaskState *ts = s-c_cpu-opaque;
 
 snprintf(buf, sizeof(buf),
-- 
2.1.4




[Qemu-devel] [PATCH 4/4] Revert gdbstub: Do not kill target in system emulation mode

2015-02-07 Thread Jan Kiszka
From: Fabien Chouteau chout...@adacore.com

The requirements described in this patch are implemented by Add GDB
qAttached support.

This reverts commit 00e94dbc7fd0110b0555d59592b004333adfb4b8.

Signed-off-by: Fabien Chouteau chout...@adacore.com
---
 gdbstub.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/gdbstub.c b/gdbstub.c
index efa29b2..0f2d371 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -888,11 +888,9 @@ static int gdb_handle_packet(GDBState *s, const char 
*line_buf)
 goto unknown_command;
 }
 case 'k':
-#ifdef CONFIG_USER_ONLY
 /* Kill the target */
 fprintf(stderr, \nQEMU: Terminated via GDBstub\n);
 exit(0);
-#endif
 case 'D':
 /* Detach packet */
 gdb_breakpoint_remove_all();
-- 
2.1.4




[Qemu-devel] [PATCH 0/4] gdbstub: improve query packet parsing, add qAttached support

2015-02-07 Thread Jan Kiszka
This addresses the review comments on the previews two patches to add
qAttached support. No longer trivial, so maybe you can pick it up,
Peter.

Jan


CC: Fabien Chouteau chout...@adacore.com
CC: Jan Kiszka jan.kis...@siemens.com

Fabien Chouteau (1):
  Revert gdbstub: Do not kill target in system emulation mode

Jan Kiszka (3):
  gdbstub: Fix qOffsets packet detection
  gdbstub: Introduce and is is_query_packet helper
  Add GDB qAttached support

 gdbstub.c | 26 +-
 1 file changed, 21 insertions(+), 5 deletions(-)

-- 
2.1.4




Re: [Qemu-devel] [PATCH/RFC] vl.c: fix memory leak spotted by valgrind

2015-02-07 Thread Michael Tokarev
28.01.2015 18:18, Paolo Bonzini wrote:
 Reviewed-by: Paolo Bonzini pbonz...@redhat.com

Applied to -trivial, thank you!

/mjt

 On 28/01/2015 16:07, Christian Borntraeger wrote:
 valgrind complains about:
 ==42062== 16 bytes in 1 blocks are definitely lost in loss record 387 of 
 1,048
 ==42062==at 0x402DCB2: malloc (vg_replace_malloc.c:299)
 ==42062==by 0x40C1BE3: g_malloc (in /usr/lib64/libglib-2.0.so.0.3800.2)
 ==42062==by 0x40DA133: g_slice_alloc (in 
 /usr/lib64/libglib-2.0.so.0.3800.2)
 ==42062==by 0x40DB2E5: g_slist_prepend (in 
 /usr/lib64/libglib-2.0.so.0.3800.2)
 ==42062==by 0x801637FF: object_class_get_list_tramp (object.c:690)
 ==42062==by 0x40A96C9: g_hash_table_foreach (in 
 /usr/lib64/libglib-2.0.so.0.3800.2)
 ==42062==by 0x80164885: object_class_foreach (object.c:665)
 ==42062==by 0x80164975: object_class_get_list (object.c:698)
 ==42062==by 0x800100A5: machine_parse (vl.c:2447)
 ==42062==by 0x800100A5: main (vl.c:3756)

 Lets free machines in case of mc.

 Signed-off-by: Christian Borntraeger borntrae...@de.ibm.com
 ---
  vl.c | 1 +
  1 file changed, 1 insertion(+)

 diff --git a/vl.c b/vl.c
 index 983259b..9d008ac 100644
 --- a/vl.c
 +++ b/vl.c
 @@ -2450,6 +2450,7 @@ static gint machine_class_cmp(gconstpointer a, 
 gconstpointer b)
  mc = find_machine(name);
  }
  if (mc) {
 +g_slist_free(machines);
  return mc;
  }
  if (name  !is_help_option(name)) {

 




Re: [Qemu-devel] [PATCH v2] Fix ABI incompatibility between Qemu-aarch64 and Linux Kernel in signal handling.

2015-02-07 Thread Michael Tokarev
02.02.2015 17:18, Maxim Ostapenko wrote:
 From 5b035df58f9f17e64b35311b6b5f55097c7f8ce1 Mon Sep 17 00:00:00 2001
 From: Max Ostapenko m.ostape...@partner.samsung.com
 Date: Mon, 2 Feb 2015 12:03:20 +0400
 Subject: [PATCH] linux-user: wrong TARGET_SI_PAD_SIZE value for some targets.
 
 Fix TARGET_SI_PAD_SIZE calculation to match the way the kernel does it.
 Use different TARGET_SI_PREAMBLE_SIZE for 32-bit and 64-bit targets.

I've applied your patch to -trivial.  However, the patch has been whitespace-
damaged so I had to apply it manually - your mailer added several leading
spaces, changed tabs into spaces, and word-wrapped several lines.  Please,
for the next time, send a patch over email to youself and verify if it
still applies to a clean branch -- before sending it to the list.

Note also that I used the original subject line of your patch, not the
subject line of this emai.  Again, please ensure there's just one message
with one subject and date, not two ;)

Thanks,

/mjt

 Signed-off-by: Maxim Ostapenko m.ostape...@partner.samsung.com
 ---
  linux-user/syscall_defs.h | 9 -
  1 file changed, 8 insertions(+), 1 deletion(-)
 
 diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
 index ebb3be1..9ed6de8 100644
 --- a/linux-user/syscall_defs.h
 +++ b/linux-user/syscall_defs.h
 @@ -655,7 +655,14 @@ typedef struct {
  #endif
 
  #define TARGET_SI_MAX_SIZE128
 -#define TARGET_SI_PAD_SIZE((TARGET_SI_MAX_SIZE/sizeof(int)) - 3)
 +
 +#if TARGET_ABI_BITS == 32
 +#define TARGET_SI_PREAMBLE_SIZE (3 * sizeof(int))
 +#else
 +#define TARGET_SI_PREAMBLE_SIZE (4 * sizeof(int))
 +#endif
 +
 +#define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE - TARGET_SI_PREAMBLE_SIZE) / 
 sizeof(int))
 
  typedef struct target_siginfo {
  #ifdef TARGET_MIPS




[Qemu-devel] [PATCH] qemu-coroutine-lock: fix co_queue multi-adding bug

2015-02-07 Thread w00214312
From: Bin Wu wu.wu...@huawei.com

When a coroutine holds a lock, other coroutines who want to get
the lock must wait on a co_queue by adding themselves to the
CoQueue. However, if a waiting coroutine is woken up with the
lock still be holding by other coroutine, this waiting coroutine
will add itself to the co_queue again. Latter, when the lock
is released, a coroutine re-enter will occur.

We need to determine whether a coroutine is alread in the co_queue
before adding it to the waiting queue.

Signed-off-by: Bin Wu wu.wu...@huawei.com
---
 include/block/coroutine_int.h | 1 +
 qemu-coroutine-lock.c | 6 +-
 qemu-coroutine.c  | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/block/coroutine_int.h b/include/block/coroutine_int.h
index f133d65..c524990 100644
--- a/include/block/coroutine_int.h
+++ b/include/block/coroutine_int.h
@@ -42,6 +42,7 @@ struct Coroutine {
 /* Coroutines that should be woken up when we yield or terminate */
 QTAILQ_HEAD(, Coroutine) co_queue_wakeup;
 QTAILQ_ENTRY(Coroutine) co_queue_next;
+bool in_co_queue;
 };
 
 Coroutine *qemu_coroutine_new(void);
diff --git a/qemu-coroutine-lock.c b/qemu-coroutine-lock.c
index e4860ae..d256f53 100644
--- a/qemu-coroutine-lock.c
+++ b/qemu-coroutine-lock.c
@@ -36,7 +36,10 @@ void qemu_co_queue_init(CoQueue *queue)
 void coroutine_fn qemu_co_queue_wait(CoQueue *queue)
 {
 Coroutine *self = qemu_coroutine_self();
-QTAILQ_INSERT_TAIL(queue-entries, self, co_queue_next);
+if (!self-in_co_queue) {
+QTAILQ_INSERT_TAIL(queue-entries, self, co_queue_next);
+self-in_co_queue = true;
+}
 qemu_coroutine_yield();
 assert(qemu_in_coroutine());
 }
@@ -71,6 +74,7 @@ static bool qemu_co_queue_do_restart(CoQueue *queue, bool 
single)
 
 while ((next = QTAILQ_FIRST(queue-entries)) != NULL) {
 QTAILQ_REMOVE(queue-entries, next, co_queue_next);
+next-in_co_queue = false;
 QTAILQ_INSERT_TAIL(self-co_queue_wakeup, next, co_queue_next);
 trace_qemu_co_queue_next(next);
 if (single) {
diff --git a/qemu-coroutine.c b/qemu-coroutine.c
index 525247b..a103721 100644
--- a/qemu-coroutine.c
+++ b/qemu-coroutine.c
@@ -75,6 +75,7 @@ Coroutine *qemu_coroutine_create(CoroutineEntry *entry)
 }
 
 co-entry = entry;
+co-in_co_queue = false;
 QTAILQ_INIT(co-co_queue_wakeup);
 return co;
 }
-- 
1.7.12.4





Re: [Qemu-devel] [Qemu-trivial] [PATCH 0/7] Six coverity fixes and a cleanup

2015-02-07 Thread Michael Tokarev
26.01.2015 14:12, Paolo Bonzini wrote:
 Patch 2 is the cleanup.  The other six patches make the tcg, utils and
 migration components clean.

Applied to -trivial patches 1,2,3,4 and 6, not applied 5 (due to
questionable errno checking addition) and 7, due to a discussion.

Thanks,

/mjt

 
 Paolo Bonzini (7):
   cpu-exec: drop dead assignment
   cpu-exec: simplify icount code
   uri: avoid NULL arguments to strcmp
   qemu-sockets: improve error reporting in unix_listen_opts
   cutils: refine strtol error handling in parse_debug_env
   aes: remove a dead return statement
   migration: do floating-point division
 
  cpu-exec.c| 12 +++-
  migration/migration.c |  2 +-
  util/aes.c|  2 +-
  util/cutils.c |  4 ++--
  util/qemu-sockets.c   | 24 ++--
  util/uri.c|  4 +++-
  6 files changed, 28 insertions(+), 20 deletions(-)
 




Re: [Qemu-devel] [Qemu-trivial] [PATCH] qemu-sockets: Fix buffer overflow in inet_parse()

2015-02-07 Thread Michael Tokarev
30.01.2015 22:37, Kevin Wolf wrote:
 The size of the stack allocated host[] array didn't account for the
 terminating '\0' byte that sscanf() writes. Fix the array size.

Applied to -trivial, thank you!

/mjt



[Qemu-devel] [PATCH 2/4] gdbstub: Introduce and is is_query_packet helper

2015-02-07 Thread Jan Kiszka
From: Jan Kiszka jan.kis...@siemens.com

This helper supports parsing of query packets with optional extensions.
The separator can be specified so that we can use it already for both
qqemu.sstep[=] and qSupported[:feature].

Signed-off-by: Jan Kiszka jan.kis...@siemens.com
---
 gdbstub.c | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/gdbstub.c b/gdbstub.c
index cd25d1a..91cc785 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -769,6 +769,14 @@ static CPUState *find_cpu(uint32_t thread_id)
 return NULL;
 }
 
+static int is_query_packet(const char *p, const char *query, char separator)
+{
+unsigned int query_len = strlen(query);
+
+return strncmp(p, query, query_len) == 0 
+(p[query_len] == '\0' || p[query_len] == separator);
+}
+
 static int gdb_handle_packet(GDBState *s, const char *line_buf)
 {
 CPUState *cpu;
@@ -1062,7 +1070,7 @@ static int gdb_handle_packet(GDBState *s, const char 
*line_buf)
  SSTEP_NOTIMER);
 put_packet(s, buf);
 break;
-} else if (strncmp(p,qemu.sstep,10) == 0) {
+} else if (is_query_packet(p, qemu.sstep, '=')) {
 /* Display or change the sstep_flags */
 p += 10;
 if (*p != '=') {
@@ -1135,7 +1143,7 @@ static int gdb_handle_packet(GDBState *s, const char 
*line_buf)
 break;
 }
 #endif /* !CONFIG_USER_ONLY */
-if (strncmp(p, Supported, 9) == 0) {
+if (is_query_packet(p, Supported, ':')) {
 snprintf(buf, sizeof(buf), PacketSize=%x, MAX_PACKET_LENGTH);
 cc = CPU_GET_CLASS(first_cpu);
 if (cc-gdb_core_xml_file != NULL) {
-- 
2.1.4




Re: [Qemu-devel] [Qemu-trivial] [PATCH 5/7] cutils: refine strtol error handling in parse_debug_env

2015-02-07 Thread Michael Tokarev
26.01.2015 14:12, Paolo Bonzini wrote:
 Avoid truncation of a 64-bit long to a 32-bit int, and check for errno
 (especially ERANGE).
 
 Signed-off-by: Paolo Bonzini pbonz...@redhat.com
 ---
  util/cutils.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/util/cutils.c b/util/cutils.c
 index dbe7412..f227064 100644
 --- a/util/cutils.c
 +++ b/util/cutils.c
 @@ -523,7 +523,7 @@ int parse_debug_env(const char *name, int max, int 
 initial)
  {
  char *debug_env = getenv(name);
  char *inv = NULL;
 -int debug;
 +long debug;
  
  if (!debug_env) {
  return initial;
 @@ -532,7 +532,7 @@ int parse_debug_env(const char *name, int max, int 
 initial)
  if (inv == debug_env) {
  return initial;
  }
 -if (debug  0 || debug  max) {
 +if (debug  0 || debug  max || errno != 0) {

It is not really right to check errno without (re)setting it
before call to strtol().

Thanks,

/mjt



[Qemu-devel] [PATCH] fix the co_queue multi-adding bug

2015-02-07 Thread w00214312
From: Bin Wu wu.wu...@huawei.com

When we test the drive_mirror between different hosts by ndb devices, 
we find that, during the cancel phase the qemu process crashes sometimes.
By checking the crash core file, we find the stack as follows, which means
a coroutine re-enter error occurs:

(gdb) bt
#0  0x7fdfc744d885 in raise () from /lib64/libc.so.6
#1  0x7fdfc744ee61 in abort () from /lib64/libc.so.6
#2  0x7fdfca467cc5 in qemu_coroutine_enter (co=0x7fdfcaedb400, opaque=0x0)
at qemu-coroutine.c:118
#3  0x7fdfca467f6c in qemu_co_queue_run_restart (co=0x7fdfcaedb400) at
qemu-coroutine-lock.c:59
#4  0x7fdfca467be5 in coroutine_swap (from=0x7fdfcaf3c4e8,
to=0x7fdfcaedb400) at qemu-coroutine.c:96
#5  0x7fdfca467cea in qemu_coroutine_enter (co=0x7fdfcaedb400, opaque=0x0)
at qemu-coroutine.c:123
#6  0x7fdfca467f6c in qemu_co_queue_run_restart (co=0x7fdfcaedbdc0) at
qemu-coroutine-lock.c:59
#7  0x7fdfca467be5 in coroutine_swap (from=0x7fdfcaf3c4e8,
to=0x7fdfcaedbdc0) at qemu-coroutine.c:96
#8  0x7fdfca467cea in qemu_coroutine_enter (co=0x7fdfcaedbdc0, opaque=0x0)
at qemu-coroutine.c:123
#9  0x7fdfca4a1fa4 in nbd_recv_coroutines_enter_all (s=0x7fdfcaef7dd0) at
block/nbd-client.c:41
#10 0x7fdfca4a1ff9 in nbd_teardown_connection (client=0x7fdfcaef7dd0) at
block/nbd-client.c:50
#11 0x7fdfca4a20f0 in nbd_reply_ready (opaque=0x7fdfcaef7dd0) at
block/nbd-client.c:92
#12 0x7fdfca45ed80 in aio_dispatch (ctx=0x7fdfcae15e90) at aio-posix.c:144
#13 0x7fdfca45ef1b in aio_poll (ctx=0x7fdfcae15e90, blocking=false) at
aio-posix.c:222
#14 0x7fdfca448c34 in aio_ctx_dispatch (source=0x7fdfcae15e90, callback=0x0,
user_data=0x0) at async.c:212
#15 0x7fdfc8f2f69a in g_main_context_dispatch () from
/usr/lib64/libglib-2.0.so.0
#16 0x7fdfca45c391 in glib_pollfds_poll () at main-loop.c:190
#17 0x7fdfca45c489 in os_host_main_loop_wait (timeout=1483677098) at
main-loop.c:235
#18 0x7fdfca45c57b in main_loop_wait (nonblocking=0) at main-loop.c:484
#19 0x7fdfca25f403 in main_loop () at vl.c:2249
#20 0x7fdfca266fc2 in main (argc=42, argv=0x7517d638,
envp=0x7517d790) at vl.c:4814

We find the nbd_recv_coroutines_enter_all function will enter a coroutine which
is waiting for the sending lock. If the lock is still held by another coroutine,
the entering coroutine will be added into the co_queue again. Latter, when the
lock is released, a coroutine re-enter error will occur. 

Bin Wu (1):
  qemu-coroutine-lock: fix co_queue multi-adding bug

 include/block/coroutine_int.h | 1 +
 qemu-coroutine-lock.c | 6 +-
 qemu-coroutine.c  | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)

-- 
1.7.12.4





[Qemu-devel] [PATCH 02/10] disas/sh4: Fix warning caused by missing 'static' attribute

2015-02-07 Thread Stefan Weil
Warning from the Sparse static analysis tool:

disas/sh4.c:335:22: warning:
 symbol 'sh_table' was not declared. Should it be static?

Signed-off-by: Stefan Weil s...@weilnetz.de
---
 disas/sh4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/disas/sh4.c b/disas/sh4.c
index f6cadd5..020f5eb 100644
--- a/disas/sh4.c
+++ b/disas/sh4.c
@@ -332,7 +332,7 @@ typedef struct
 
 #ifdef DEFINE_TABLE
 
-const sh_opcode_info sh_table[] =
+static const sh_opcode_info sh_table[] =
   {
 /* 0111i8*1 add #imm,REG_N  
*/{add,{A_IMM,A_REG_N},{HEX_7,REG_N,IMM0_8}, arch_sh1_up},
 
-- 
2.1.4




[Qemu-devel] [PATCH 07/10] spice: Add missing 'static' attribute

2015-02-07 Thread Stefan Weil
Signed-off-by: Stefan Weil s...@weilnetz.de
---
 spice-qemu-char.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/spice-qemu-char.c b/spice-qemu-char.c
index 7e0d300..a4f4e57 100644
--- a/spice-qemu-char.c
+++ b/spice-qemu-char.c
@@ -158,7 +158,7 @@ static gboolean spice_char_source_dispatch(GSource *source,
 return func(NULL, G_IO_OUT, user_data);
 }
 
-GSourceFuncs SpiceCharSourceFuncs = {
+static GSourceFuncs SpiceCharSourceFuncs = {
 .prepare  = spice_char_source_prepare,
 .check= spice_char_source_check,
 .dispatch = spice_char_source_dispatch,
-- 
2.1.4




[Qemu-devel] [PATCH 05/10] moxie: Fix warning caused by missing include statement

2015-02-07 Thread Stefan Weil
Warning from the Sparse static analysis tool:

target-moxie/machine.c:4:26:
 warning: symbol 'vmstate_moxie_cpu' was not declared. Should it be static?

machine.h includes the missing declaration.

Cc: Anthony Green gr...@moxielogic.com
Signed-off-by: Stefan Weil s...@weilnetz.de
---
 target-moxie/machine.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target-moxie/machine.c b/target-moxie/machine.c
index da1a857..b9316f0 100644
--- a/target-moxie/machine.c
+++ b/target-moxie/machine.c
@@ -1,5 +1,6 @@
 #include hw/hw.h
 #include hw/boards.h
+#include machine.h
 
 const VMStateDescription vmstate_moxie_cpu = {
 .name = cpu,
-- 
2.1.4




[Qemu-devel] [PATCH 09/10] vga: Fix warning caused by missing 'static' attribute

2015-02-07 Thread Stefan Weil
Warning from the Sparse static analysis tool:

hw/display/vga.c:2012:26: warning:
 symbol 'vmstate_vga_endian' was not declared. Should it be static?

Signed-off-by: Stefan Weil s...@weilnetz.de
---
 hw/display/vga.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/display/vga.c b/hw/display/vga.c
index ffcfce3..9c62fbf 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -2032,7 +2032,7 @@ static bool vga_endian_state_needed(void *opaque)
 return s-default_endian_fb != s-big_endian_fb;
 }
 
-const VMStateDescription vmstate_vga_endian = {
+static const VMStateDescription vmstate_vga_endian = {
 .name = vga.endian,
 .version_id = 1,
 .minimum_version_id = 1,
-- 
2.1.4




[Qemu-devel] [PATCH 00/10] Fix warnings (undeclared global symbols)

2015-02-07 Thread Stefan Weil
All warnings were reported by the Sparse static analysis tool.

[PATCH 01/10] disas/cris: Fix warning caused by missing 'static'
[PATCH 02/10] disas/sh4: Fix warning caused by missing 'static'
[PATCH 03/10] migration: Fix warning caused by missing declaration of
[PATCH 04/10] migration: Fix warnings caused by missing 'static'
[PATCH 05/10] moxie: Fix warning caused by missing include statement
[PATCH 06/10] serial: Fix warnings caused by missing 'static'
[PATCH 07/10] spice: Add missing 'static' attribute
[PATCH 08/10] stubs: Fix warning caused by missing include statement
[PATCH 09/10] vga: Fix warning caused by missing 'static' attribute
[PATCH 10/10] virtio: Fix warning caused by missing 'static'



[Qemu-devel] [PATCH 10/10] virtio: Fix warning caused by missing 'static' attribute

2015-02-07 Thread Stefan Weil
Warning from the Sparse static analysis tool:

hw/char/virtio-serial-bus.c:31:3:
 warning: symbol 'vserdevices' was not declared. Should it be static?

Cc: Amit Shah amit.s...@redhat.com
Cc: Anthony Liguori aligu...@amazon.com
Cc: Michael S. Tsirkin m...@redhat.com
Signed-off-by: Stefan Weil s...@weilnetz.de
---
 hw/char/virtio-serial-bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
index 37a6f44..47fbb34 100644
--- a/hw/char/virtio-serial-bus.c
+++ b/hw/char/virtio-serial-bus.c
@@ -26,7 +26,7 @@
 #include hw/virtio/virtio-serial.h
 #include hw/virtio/virtio-access.h
 
-struct VirtIOSerialDevices {
+static struct VirtIOSerialDevices {
 QLIST_HEAD(, VirtIOSerial) devices;
 } vserdevices;
 
-- 
2.1.4




Re: [Qemu-devel] [question] the patch which affect performance of virtio-scsi

2015-02-07 Thread Wangting (Kathy)
OK, Thank you very much for your detailed explanation.

But I have another question about the big change from qemu-1.5.3 to 
qemu-1.6.0-rc0.

When I use ramdisk for IO performance testing, the result is as follows.

[fio-test]  rw bs iodepthjobs   bw iops

qemu-1.5.3  read   4k 32  1 285MB/s73208
qemu-1.6.0-rc0  read   4k 32  1 253MB/s64967

And virtio-blk is the same.

I know there are so many differences between qemu-1.5 and qemu-1.6, but I am 
confused about
what new features impact the performance so much. Do you know it?


On 2015-2-3 16:49, Paolo Bonzini wrote:
 On 03/02/2015 03:56, Wangting (Kathy) wrote:
 Sorry, I find that the patch of virtio-scsi: Optimize virtio_scsi_init_req 
 can slove this problem.
 
 Great that you could confirm that. :)
 
 By the way, can you tell me the reason of the change about cdb and sense?
 
 cdb and sense are variable-size items.  ANY_LAYOUT support changed
 VirtIOSCSIReq: instead of having a pointer to the request, it copies the
 request from guest memory into VirtIOSCSIReq.  This is required because
 the request might not be contiguous in guest memory.  And because the
 request and response headers (e.g. VirtIOSCSICmdReq and
 VirtIOSCSICmdResp) are included by value in VirtIOSCSIReq, the
 variable-sized fields have to be treated specially.
 
 Only one of them can remain in VirtIOSCSIReq, because you cannot have a
 flexible array member (e.g. uint_8 sense[];) in the middle of a struct.
 
 cdb is always used, so it is chosen for the variable-sized part of
 VirtIOSCSIReq: cdb was simply moved from VirtIOSCSICmdReq to VirtIOSCSIReq.
 
 Instead, requests that complete with sense data are not a fast path.
 Hence sense is retrieved from the SCSIRequest, and
 virtio_scsi_command_complete copies it into the guest buffer via
 scsi_req_get_sense + qemu_iovec_from_buf.
 
 Paolo
 
 




[Qemu-devel] [PATCH] Fix name error in migration stream analyzation script

2015-02-07 Thread Greg Kurz
It fixes the following error:

Traceback (most recent call last):
  File ./scripts/analyze-migration.py, line 584, in module
dump.read(dump_memory = args.memory)
  File ./scripts/analyze-migration.py, line 528, in read
self.sections[section_id].read()
  File ./scripts/analyze-migration.py, line 250, in read
self.file.readvar(n_valid * HASH_PTE_SIZE_64)
NameError: global name 'HASH_PTE_SIZE_64' is not defined

Signed-off-by: Greg Kurz gk...@linux.vnet.ibm.com
---
 scripts/analyze-migration.py |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/analyze-migration.py b/scripts/analyze-migration.py
index b8b9968..0c8b22f 100755
--- a/scripts/analyze-migration.py
+++ b/scripts/analyze-migration.py
@@ -247,7 +247,7 @@ class HTABSection(object):
 if index == 0 and n_valid == 0 and n_invalid == 0:
 break
 
-self.file.readvar(n_valid * HASH_PTE_SIZE_64)
+self.file.readvar(n_valid * self.HASH_PTE_SIZE_64)
 
 def getDict(self):
 return 




[Qemu-devel] [PATCH 08/10] stubs: Fix warning caused by missing include statement

2015-02-07 Thread Stefan Weil
Warning from the Sparse static analysis tool:

stubs/qtest.c:14:6:
 warning: symbol 'qtest_allowed' was not declared. Should it be static?

Add the missing include statement which declares qtest_allowed.

Signed-off-by: Stefan Weil s...@weilnetz.de
---
 stubs/qtest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stubs/qtest.c b/stubs/qtest.c
index e671ed8..dc17594 100644
--- a/stubs/qtest.c
+++ b/stubs/qtest.c
@@ -8,7 +8,7 @@
  * See the COPYING file in the top-level directory.
  */
 
-#include qemu-common.h
+#include sysemu/qtest.h
 
 /* Needed for qtest_allowed() */
 bool qtest_allowed;
-- 
2.1.4




[Qemu-devel] [PATCH 04/10] migration: Fix warnings caused by missing 'static' attribute

2015-02-07 Thread Stefan Weil
Warnings from the Sparse static analysis tool:

migration-rdma.c:151:12: warning:
 symbol 'wrid_desc' was not declared. Should it be static?
migration-rdma.c:190:12: warning:
 symbol 'control_desc' was not declared. Should it be static?
migration-rdma.c:3301:19: warning:
 symbol 'rdma_read_ops' was not declared. Should it be static?
migration-rdma.c:3308:19: warning:
 symbol 'rdma_write_ops' was not declared. Should it be static?

Cc: Juan Quintela quint...@redhat.com
Cc: Amit Shah amit.s...@redhat.com
Signed-off-by: Stefan Weil s...@weilnetz.de
---
 migration/rdma.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/migration/rdma.c b/migration/rdma.c
index fc351ea..589931a 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -121,7 +121,7 @@ enum {
 RDMA_WRID_RECV_CONTROL = 4000,
 };
 
-const char *wrid_desc[] = {
+static const char *wrid_desc[] = {
 [RDMA_WRID_NONE] = NONE,
 [RDMA_WRID_RDMA_WRITE] = WRITE RDMA,
 [RDMA_WRID_SEND_CONTROL] = CONTROL SEND,
@@ -160,7 +160,7 @@ enum {
 RDMA_CONTROL_UNREGISTER_FINISHED, /* unpinning finished */
 };
 
-const char *control_desc[] = {
+static const char *control_desc[] = {
 [RDMA_CONTROL_NONE] = NONE,
 [RDMA_CONTROL_ERROR] = ERROR,
 [RDMA_CONTROL_READY] = READY,
@@ -3253,14 +3253,14 @@ static int qemu_rdma_get_fd(void *opaque)
 return rdma-comp_channel-fd;
 }
 
-const QEMUFileOps rdma_read_ops = {
+static const QEMUFileOps rdma_read_ops = {
 .get_buffer= qemu_rdma_get_buffer,
 .get_fd= qemu_rdma_get_fd,
 .close = qemu_rdma_close,
 .hook_ram_load = qemu_rdma_registration_handle,
 };
 
-const QEMUFileOps rdma_write_ops = {
+static const QEMUFileOps rdma_write_ops = {
 .put_buffer = qemu_rdma_put_buffer,
 .close  = qemu_rdma_close,
 .before_ram_iterate = qemu_rdma_registration_start,
-- 
2.1.4




[Qemu-devel] [PATCH 03/10] migration: Fix warning caused by missing declaration of vmstate_dummy

2015-02-07 Thread Stefan Weil
Warning from the Sparse static analysis tool:

stubs/vmstate.c:4:26: warning:
 symbol 'vmstate_dummy' was not declared. Should it be static?

Cc: Juan Quintela quint...@redhat.com
Cc: Amit Shah amit.s...@redhat.com
Signed-off-by: Stefan Weil s...@weilnetz.de
---
 include/migration/vmstate.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 0b26bc6..c20f2d1 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -139,9 +139,7 @@ struct VMStateDescription {
 const VMStateSubsection *subsections;
 };
 
-#ifdef CONFIG_USER_ONLY
 extern const VMStateDescription vmstate_dummy;
-#endif
 
 extern const VMStateInfo vmstate_info_bool;
 
-- 
2.1.4




[Qemu-devel] [PATCH 06/10] serial: Fix warnings caused by missing 'static' attribute

2015-02-07 Thread Stefan Weil
Warnings from the Sparse static analysis tool:

hw/char/serial.c:630:26: warning: symbol
 'vmstate_serial_thr_ipending' was not declared. Should it be static?
hw/char/serial.c:646:26: warning: symbol
 'vmstate_serial_tsr' was not declared. Should it be static?
hw/char/serial.c:665:26: warning: symbol
 'vmstate_serial_recv_fifo' was not declared. Should it be static?
hw/char/serial.c:681:26: warning: symbol
 'vmstate_serial_xmit_fifo' was not declared. Should it be static?
hw/char/serial.c:697:26: warning: symbol
 'vmstate_serial_fifo_timeout_timer' was not declared. Should it be static?
hw/char/serial.c:713:26: warning: symbol
 'vmstate_serial_timeout_ipending' was not declared. Should it be static?
hw/char/serial.c:729:26: warning: symbol
 'vmstate_serial_poll' was not declared. Should it be static?

Signed-off-by: Stefan Weil s...@weilnetz.de
---
 hw/char/serial.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/hw/char/serial.c b/hw/char/serial.c
index bd25c03..0491897 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -658,7 +658,7 @@ static bool serial_thr_ipending_needed(void *opaque)
 }
 }
 
-const VMStateDescription vmstate_serial_thr_ipending = {
+static const VMStateDescription vmstate_serial_thr_ipending = {
 .name = serial/thr_ipending,
 .version_id = 1,
 .minimum_version_id = 1,
@@ -674,7 +674,7 @@ static bool serial_tsr_needed(void *opaque)
 return s-tsr_retry != 0;
 }
 
-const VMStateDescription vmstate_serial_tsr = {
+static const VMStateDescription vmstate_serial_tsr = {
 .name = serial/tsr,
 .version_id = 1,
 .minimum_version_id = 1,
@@ -693,7 +693,7 @@ static bool serial_recv_fifo_needed(void *opaque)
 
 }
 
-const VMStateDescription vmstate_serial_recv_fifo = {
+static const VMStateDescription vmstate_serial_recv_fifo = {
 .name = serial/recv_fifo,
 .version_id = 1,
 .minimum_version_id = 1,
@@ -709,7 +709,7 @@ static bool serial_xmit_fifo_needed(void *opaque)
 return !fifo8_is_empty(s-xmit_fifo);
 }
 
-const VMStateDescription vmstate_serial_xmit_fifo = {
+static const VMStateDescription vmstate_serial_xmit_fifo = {
 .name = serial/xmit_fifo,
 .version_id = 1,
 .minimum_version_id = 1,
@@ -725,7 +725,7 @@ static bool serial_fifo_timeout_timer_needed(void *opaque)
 return timer_pending(s-fifo_timeout_timer);
 }
 
-const VMStateDescription vmstate_serial_fifo_timeout_timer = {
+static const VMStateDescription vmstate_serial_fifo_timeout_timer = {
 .name = serial/fifo_timeout_timer,
 .version_id = 1,
 .minimum_version_id = 1,
@@ -741,7 +741,7 @@ static bool serial_timeout_ipending_needed(void *opaque)
 return s-timeout_ipending != 0;
 }
 
-const VMStateDescription vmstate_serial_timeout_ipending = {
+static const VMStateDescription vmstate_serial_timeout_ipending = {
 .name = serial/timeout_ipending,
 .version_id = 1,
 .minimum_version_id = 1,
@@ -757,7 +757,7 @@ static bool serial_poll_needed(void *opaque)
 return s-poll_msl = 0;
 }
 
-const VMStateDescription vmstate_serial_poll = {
+static const VMStateDescription vmstate_serial_poll = {
 .name = serial/poll,
 .version_id = 1,
 .minimum_version_id = 1,
-- 
2.1.4




[Qemu-devel] [PATCH] QJSON: fix typo in author's email address

2015-02-07 Thread Greg Kurz
Signed-off-by: Greg Kurz gk...@linux.vnet.ibm.com
---
 qjson.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qjson.c b/qjson.c
index b24..0cda269 100644
--- a/qjson.c
+++ b/qjson.c
@@ -4,7 +4,7 @@
  * Copyright Alexander Graf
  *
  * Authors:
- *  Alexander Graf ag...@suse.de
+ *  Alexander Graf ag...@suse.de
  *
  * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
  * See the COPYING.LIB file in the top-level directory.




[Qemu-devel] [PATCH 01/10] disas/cris: Fix warning caused by missing 'static' attribute

2015-02-07 Thread Stefan Weil
Warning from the Sparse static analysis tool:

disas/cris.c:1218:26: warning:
 symbol 'cris_cond15s' was not declared. Should it be static?

Signed-off-by: Stefan Weil s...@weilnetz.de
---
 disas/cris.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/disas/cris.c b/disas/cris.c
index 9dfb4e3..a034dba 100644
--- a/disas/cris.c
+++ b/disas/cris.c
@@ -1215,7 +1215,7 @@ cris_cc_strings[] =
 };
 
 /* Different names and semantics for condition  (0xf).  */
-const struct cris_cond15 cris_cond15s[] =
+static const struct cris_cond15 cris_cond15s[] =
 {
   /* FIXME: In what version did condition ext disappear?  */
   {ext, cris_ver_v0_3},
-- 
2.1.4




Re: [Qemu-devel] [PATCH] libcacard: stop linking against every single 3rd party library

2015-02-07 Thread Michael Tokarev
03.02.2015 14:31, Daniel P. Berrange wrote:
 Building QEMU results in a libcacard.so that links against
 practically the entire world
[..]

Applied to -trivial, thank you!

/mjt



Re: [Qemu-devel] [PATCH 0/4] Pair g_malloc() with g_free(), not free()

2015-02-07 Thread Michael Tokarev
28.01.2015 17:54, Markus Armbruster wrote:

 Markus Armbruster (4):
   qemu-option: Replace pointless use of g_malloc0() by g_malloc()
   qemu-option: Pair g_malloc() with g_free(), not free()
   spapr_vio: Pair g_malloc() with g_free(), not free()
   usb: Pair g_malloc() with g_free(), not free()

Applied to -trivial, thank you!

/mjt



Re: [Qemu-devel] [PATCH v3 0/3] vfio: free data and unmap BARs in instance_finalize

2015-02-07 Thread Paolo Bonzini


On 07/02/2015 02:39, Alex Williamson wrote:
 I'm not sure where it's coming from yet, but I did extensive testing for
 my last pull request based on ec6f25e because if I updated to d5fbb4c
 vfio hotplug broke immediately.  I'll keep looking, but I thought I'd
 share in case you have some ideas.  Thanks,

I'm not sure I understand: d5fbb4c9ed52d97aebe5994d8a857c74c0d95a92 (RCU
merge) is an ancestor of ec6f25e788ef57ce1e9f734984ef8885172fd9e2 (s390
merge) and the only patches in the middle are for s390.

Paolo



Re: [Qemu-devel] [Qemu-trivial] [PATCH 0/7] Six coverity fixes and a cleanup

2015-02-07 Thread Paolo Bonzini


On 07/02/2015 10:00, Michael Tokarev wrote:
  Patch 2 is the cleanup.  The other six patches make the tcg, utils and
  migration components clean.
 Applied to -trivial patches 1,2,3,4 and 6, not applied 5 (due to
 questionable errno checking addition) and 7, due to a discussion.

Thanks, will resubmit 5.

Juan/Amit, can you pick up 7 which Juan has already reviewed?

Paolo



[Qemu-devel] [PATCH] memsave: Add a space after address in error message

2015-02-07 Thread Borislav Petkov
From: Borislav Petkov b...@suse.de

Add the missing space to separate address from specified.

Cc: Anthony Liguori aligu...@amazon.com
Cc: Paolo Bonzini pbonz...@redhat.com
Signed-off-by: Borislav Petkov b...@suse.de
---
 cpus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cpus.c b/cpus.c
index 0cdd1d71560b..4fa196d48207 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1489,7 +1489,7 @@ void qmp_memsave(int64_t addr, int64_t size, const char 
*filename,
 if (l  size)
 l = size;
 if (cpu_memory_rw_debug(cpu, addr, buf, l, 0) != 0) {
-error_setg(errp, Invalid addr 0x%016 PRIx64 specified, addr);
+error_setg(errp, Invalid addr 0x%016 PRIx64  specified, addr);
 goto exit;
 }
 if (fwrite(buf, 1, l, f) != l) {
-- 
2.2.0.33.gc18b867




Re: [Qemu-devel] [Qemu-trivial] [PATCH 0/7] Six coverity fixes and a cleanup

2015-02-07 Thread Michael Tokarev
07.02.2015 23:01, Paolo Bonzini wrote:
 On 07/02/2015 10:00, Michael Tokarev wrote:
 Patch 2 is the cleanup.  The other six patches make the tcg, utils and
 migration components clean.
 Applied to -trivial patches 1,2,3,4 and 6, not applied 5 (due to
 questionable errno checking addition) and 7, due to a discussion.
 
 Thanks, will resubmit 5.
 
 Juan/Amit, can you pick up 7 which Juan has already reviewed?

I've no prob with 7, but please let's agree which way we're taking
there -- whenever subsequent fixes are needed, should be made on
the top of this change, or whole thing should be done differently.

Thanks.

/mjt



Re: [Qemu-devel] [Qemu-trivial] [PATCH 0/3] util/uri: Cleanups and a bug fix

2015-02-07 Thread Michael Tokarev
27.01.2015 19:13, Markus Armbruster wrote:
 Note: checkpatch is unhappy with the first patch, because I refrained
 from cleaning up the ugly return(NULL).  They're all over the place.
 
 Markus Armbruster (3):
   util/uri: uri_new() can't fail, drop dead error handling
   util/uri: realloc2n() can't fail, drop dead error handling
   util/uri: URI member path can be null, compare more carfully

Applied all to -trivial, with patch 3 replacing similar patch by Paolo.

Thanks,

/mjt



Re: [Qemu-devel] [PATCH] Fix name error in migration stream analyzation script

2015-02-07 Thread Michael Tokarev
Applied to -trivial, thank you!

/mjt



Re: [Qemu-devel] [PATCH] QJSON: fix typo in author's email address

2015-02-07 Thread Michael Tokarev
Applied to -trivial, thank you!

/mjt



[Qemu-devel] [Bug 1404278] Re: tap connections not working on windows host

2015-02-07 Thread James J Myers
I'm having the same problem here on Windows 7 x64 host trying to run
Raspbian.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1404278

Title:
  tap connections not working on windows host

Status in QEMU:
  New

Bug description:
  using latest qemu 2.2.0 64bit for windows host (installed from
  qemu-w64-setup-20141210.exe obtained from http://qemu.weilnetz.de/w64/
  ),OpenVPN 2.6.3-I601 64bit tap adapter named tap01 and calling qemu
  using the following.

  qemu-system-x86_64.exe -m 512 -net nic -net tap,ifname=tap01 -hda
  c:\\data\\images\\test.img

  where the image contains a slackware 14.0 64bit install.
  The tap is bridged with the real network adapter and the bridge is given an 
ip of 10.1.1.41 (which works as the ip for the windows host). The tap adapter 
(in network connections) shows connected when the qemu vm is running. inside 
the vm, the network is given an ip of 10.1.1.143 (the netmask and default 
gateway are the same for the virtual and real pc).
  fault.
  The vm cannot see the rest of the local network or visa-versa. This used to 
work in early (0.9 32bit) versions of qemu.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1404278/+subscriptions