Re: [Qemu-devel] [PATCH] virtio-balloon: Add some trace events

2014-09-16 Thread zhanghailiang
Hi, Ping... Is this acceptable? Thanks, zhanghailiang On 2014/9/12 15:06, zhanghailiang wrote: Add some trace events for easier debugging Signed-off-by: zhanghailiang --- hw/virtio/virtio-balloon.c | 6 ++ trace-events | 4 2 files changed, 10 insertions(+) diff

Re: [Qemu-devel] [PATCH 2/2] numa/pc-dimm: Fix stat of memory size in node when hotplug memory

2014-09-17 Thread zhanghailiang
On 2014/9/16 19:20, Igor Mammedov wrote: On Tue, 16 Sep 2014 18:39:16 +0800 zhanghailiang wrote: When do memory hotplug, if there is numa node, we should add the memory size to the corresponding node memory size. For now, it mainly affects the result of hmp command "info numa".

Re: [Qemu-devel] [PATCH 1/2] pc-dimm: No numa option shouldn't break hotplug memory feature

2014-09-17 Thread zhanghailiang
On 2014/9/17 16:32, Hu Tao wrote: On Tue, Sep 16, 2014 at 06:39:15PM +0800, zhanghailiang wrote: If we do not configure numa option, memory hotplug should work as well. It should not depend on numa option. Steps to reproduce: (1) Start VM: qemu-kvm -m 1024,slots=4,maxmem=8G (2) Hotplug memory

Re: [Qemu-devel] [PATCH] virtio-balloon: Fix ballooning not working correctly when hotplug memory

2014-09-17 Thread zhanghailiang
Hi, Ping... Is anyone concerned about this patch? Is this a bug? Thanks, zhanghailiang On 2014/9/15 20:29, zhanghailiang wrote: When do memory balloon, it references the ram_size as the real ram size of VM, But here ram_size is not include the hotplugged memory, and the result will be

[Qemu-devel] [PATCH] qga: Fix possible freed memory accessing

2014-09-17 Thread zhanghailiang
If readdir_r fails, error_setg_errno will reference the freed pointer *dirpath*. Signed-off-by: zhanghailiang --- qga/commands-posix.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 7eed7f4..3082eae 100644 --- a

[Qemu-devel] [PATCH v2] pc-dimm/numa: Fix stat of memory size in node when hotplug memory

2014-09-18 Thread zhanghailiang
When do memory hotplug, if there is numa node, we should add the memory size to the corresponding node memory size. For now, it mainly affects the result of hmp command "info numa". Signed-off-by: zhanghailiang --- v2: - Don't modify the numa_info.node_mem directly when treating

Re: [Qemu-devel] [PATCH] qga: Fix possible freed memory accessing

2014-09-18 Thread zhanghailiang
On 2014/9/18 20:17, Eric Blake wrote: On 09/17/2014 09:33 PM, zhanghailiang wrote: If readdir_r fails, error_setg_errno will reference the freed pointer *dirpath*. Signed-off-by: zhanghailiang --- qga/commands-posix.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions

Re: [Qemu-devel] [PATCH v5 2/2] dump: Don't return error code when return an Error object

2014-09-18 Thread zhanghailiang
On 2014/9/17 0:24, Markus Armbruster wrote: zhanghailiang writes: Functions shouldn't return an error code and an Error object at the same time. Turn all these functions that returning Error object to void. We also judge if a function success or fail by reference to the *errp. Signed-o

[Qemu-devel] [PATCH v2] qga: Rewrite code where using readdir_r

2014-09-18 Thread zhanghailiang
If readdir_r fails, error_setg_errno will reference the freed pointer *dirpath*. Moreover, readdir_r may cause a buffer overflow, using readdir instead. Signed-off-by: zhanghailiang --- v2: - Switch readdir_r to readdir (Comment of Eric Blake) --- qga/commands-posix.c | 27

[Qemu-devel] [PATCH v1] vl: Fix possible freed memory accessing

2014-09-18 Thread zhanghailiang
The logic of pcmcia_socket_unregister is wrong, which will cause a freed memory accessing Signed-off-by: zhanghailiang --- Hi, The function pcmcia_socket_unregister seemes to be unused, Should it be removed? Thanks. --- vl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git

Re: [Qemu-devel] [PATCH v2] pc-dimm/numa: Fix stat of memory size in node when hotplug memory

2014-09-18 Thread zhanghailiang
On 2014/9/19 9:43, Chen, Fan wrote: On Thu, 2014-09-18 at 20:07 +0800, zhanghailiang wrote: When do memory hotplug, if there is numa node, we should add the memory size to the corresponding node memory size. For now, it mainly affects the result of hmp command "info numa". Sig

[Qemu-devel] [PATCH v6 1/2] dump: let dump_error return error info to caller

2014-09-18 Thread zhanghailiang
The second parameter of dump_error is unused, but one purpose of using this function is to report the error info. Use error_set to return the error info to the caller. Signed-off-by: zhanghailiang --- dump.c | 165 - 1 file

[Qemu-devel] [PATCH v6 2/2] dump: Don't return error code when return an Error object

2014-09-18 Thread zhanghailiang
Functions shouldn't return an error code and an Error object at the same time. Turn all these functions that returning Error object to void. We also judge if a function success or fail by reference to the local_err. Signed-off-by: zhanghailiang --- dump.c

[Qemu-devel] [PATCH v6 0/2] dump: let dump_error return error reason to caller

2014-09-18 Thread zhanghailiang
n functions like write_elf64_note() to void (Luiz Capitulino) v3 -> v4: - Adjust the errp argument to the end - Remove trailing '.' in error messages v2 -> v3: - Drop the '\n' in the message when call dump_error(Eric Blake) v1 -> v2: - Return the error reason to t

Re: [Qemu-devel] [PATCH v2] ivshmem: use error_report

2014-09-19 Thread zhanghailiang
On 2014/9/19 7:17, Andrew Jones wrote: Replace all the fprintf(stderr, ...) calls with error_report. Also make sure exit() consistently uses the error code 1. A few calls used -1. Signed-off-by: Andrew Jones --- hw/misc/ivshmem.c | 39 +++ 1 file changed,

Re: [Qemu-devel] [PATCH v2] ivshmem: use error_report

2014-09-19 Thread zhanghailiang
On 2014/9/19 15:34, zhanghailiang wrote: On 2014/9/19 7:17, Andrew Jones wrote: Replace all the fprintf(stderr, ...) calls with error_report. Also make sure exit() consistently uses the error code 1. A few calls used -1. Signed-off-by: Andrew Jones --- hw/misc/ivshmem.c | 39

Re: [Qemu-devel] [PATCH v2] pc-dimm/numa: Fix stat of memory size in node when hotplug memory

2014-09-20 Thread zhanghailiang
On 2014/9/19 21:51, Igor Mammedov wrote: On Thu, 18 Sep 2014 20:07:08 +0800 zhanghailiang wrote: When do memory hotplug, if there is numa node, we should add the memory size to the corresponding node memory size. For now, it mainly affects the result of hmp command "info numa".

Re: [Qemu-devel] [PATCH] virtio-balloon: Fix ballooning not working correctly when hotplug memory

2014-09-21 Thread zhanghailiang
Hi Igor, Thanks for your reviewing... On Mon, 15 Sep 2014 20:29:38 +0800 zhanghailiang wrote: When do memory balloon, it references the ram_size as the real ram size of VM, But here ram_size is not include the hotplugged memory, and the result will be confused. Steps to reproduce: (1)Start

Re: [Qemu-devel] [PATCH 1/2] pc-dimm: No numa option shouldn't break hotplug memory feature

2014-09-22 Thread zhanghailiang
On 2014/9/22 17:03, Tang Chen wrote: Hi Igor, On 09/19/2014 08:26 PM, Igor Mammedov wrote: On Wed, 17 Sep 2014 16:32:20 +0800 Hu Tao wrote: On Tue, Sep 16, 2014 at 06:39:15PM +0800, zhanghailiang wrote: If we do not configure numa option, memory hotplug should work as well. It should not

[Qemu-devel] [PATCH] vl: Adjust the place of calling mlockall to speedup VM's startup

2014-09-23 Thread zhanghailiang
igned-off-by: zhanghailiang --- Hi, Actually, for mbind and mlockall, i have made a test about the time consuming for the different call sequence. The results is shown below. It is obviously that mlockall called before mbind is more time-consuming. Besides, this patch is OK with memory ho

[Qemu-devel] [PATCH v3] pc-dimm/numa: Fix stat of memory size in node when hotplug memory

2014-09-23 Thread zhanghailiang
When do memory hotplug, if there is numa node, we should add the memory size to the corresponding node memory size. For now, it mainly affects the result of hmp command "info numa". Signed-off-by: zhanghailiang --- v3: - cold-plugged memory should not be excluded when stat memory

Re: [Qemu-devel] [PATCH] vl: Adjust the place of calling mlockall to speedup VM's startup

2014-09-23 Thread zhanghailiang
On 2014/9/23 16:35, Hu Tao wrote: On Tue, Sep 23, 2014 at 11:30:26AM +0300, Michael S. Tsirkin wrote: On Tue, Sep 23, 2014 at 03:57:47PM +0800, zhanghailiang wrote: If we configure mlock=on and memory policy=bind at the same time, It will consume lots of time for system to treat with memory

Re: [Qemu-devel] [PATCH 1/2] pc-dimm: No numa option shouldn't break hotplug memory feature

2014-09-23 Thread zhanghailiang
On 2014/9/23 17:01, Igor Mammedov wrote: On Mon, 22 Sep 2014 14:17:28 +0300 "Michael S. Tsirkin" wrote: On Fri, Sep 19, 2014 at 02:37:46PM +0200, Igor Mammedov wrote: On Tue, 16 Sep 2014 18:39:15 +0800 zhanghailiang wrote: If we do not configure numa option, memory hotplug shou

Re: [Qemu-devel] [PATCH 1/2] pc-dimm: No numa option shouldn't break hotplug memory feature

2014-09-23 Thread zhanghailiang
On 2014/9/23 16:58, Tang Chen wrote: On 09/23/2014 04:40 PM, Igor Mammedov wrote: .. It's fine to use SRAT for these purposes on baremetal NUMA systems since due to used chipset constrains it's possible statically allocate ranges for every possible DIMM socket. However SRAT(which is optiona

Re: [Qemu-devel] [PATCH] vl: Adjust the place of calling mlockall to speedup VM's startup

2014-09-23 Thread zhanghailiang
On 2014/9/23 16:30, Michael S. Tsirkin wrote: On Tue, Sep 23, 2014 at 03:57:47PM +0800, zhanghailiang wrote: If we configure mlock=on and memory policy=bind at the same time, It will consume lots of time for system to treat with memory, especially when call mbind after mlockall. Adjust the

[Qemu-devel] [PATCH v2] vl: Adjust the place of calling mlockall to speedup VM's startup

2014-09-23 Thread zhanghailiang
ed-by: Michael S. Tsirkin Signed-off-by: zhanghailiang --- v2: - Add Acked-by - change 'int' to 'bool' (Thanks Hu Tao) --- vl.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/vl.c b/vl.c index dc792fe..35e5de6 100644 --- a/vl.c +++ b/vl.c

Re: [Qemu-devel] [PATCH 1/2] pc-dimm: No numa option shouldn't break hotplug memory feature

2014-09-23 Thread zhanghailiang
On 2014/9/23 19:12, Igor Mammedov wrote: On Tue, 23 Sep 2014 18:11:35 +0800 zhanghailiang wrote: On 2014/9/23 16:58, Tang Chen wrote: On 09/23/2014 04:40 PM, Igor Mammedov wrote: .. It's fine to use SRAT for these purposes on baremetal NUMA systems since due to used chipset const

Re: [Qemu-devel] [PATCH v6 0/2] dump: let dump_error return error reason to caller

2014-09-23 Thread zhanghailiang
Hi, Ping... Thanks, zhanghailiang On 2014/9/19 14:43, zhanghailiang wrote: Hi, In original code, Function dump_error ignores its second parameter which contains error reason, it is better to return the error message to the caller. Here we use error_setg to return the error info to caller

Re: [Qemu-devel] [PATCH v2] qga: Rewrite code where using readdir_r

2014-09-26 Thread zhanghailiang
Hi, Ping...,plus;) This is a bug fix. Thanks, zhanghailiang On 2014/9/19 11:09, zhanghailiang wrote: If readdir_r fails, error_setg_errno will reference the freed pointer *dirpath*. Moreover, readdir_r may cause a buffer overflow, using readdir instead. Signed-off-by: zhanghailiang

Re: [Qemu-devel] [PATCH v2] vl: Adjust the place of calling mlockall to speedup VM's startup

2014-09-26 Thread zhanghailiang
Hi, This has been reviewed, Will anyone pick this up?;) Thanks, zhanghailiang On 2014/9/23 18:42, zhanghailiang wrote: If we configure mlock=on and memory policy=bind at the same time, It will consume lots of time for system to treat with memory, especially when call mbind behind mlockall

[Qemu-devel] [PATCH v2] pc-dimm: Don't check dimm->node when there is non-NUMA config

2014-09-26 Thread zhanghailiang
. But not support Windows guest OS to hotplug memory with no-NUMA config, actully, it's Windows limitation. Reviewed-By: Igor Mammedov Signed-off-by: zhanghailiang --- v2: - fix the title and message - add reviewed-by --- hw/mem/pc-dimm.c | 2 +- 1 file changed, 1 insertion(+), 1 del

Re: [Qemu-devel] [PATCH v6 0/2] dump: let dump_error return error reason to caller

2014-09-27 Thread zhanghailiang
Hi, Ping^2... Can anyone help reviewing this patch? Luiz? Eric? Markus? Thanks;) Best regards, zhanghailiang On 2014/9/24 8:39, zhanghailiang wrote: Hi, Ping... Thanks, zhanghailiang On 2014/9/19 14:43, zhanghailiang wrote: Hi, In original code, Function dump_error ignores its second

Re: [Qemu-devel] [PATCH v2] vl: Adjust the place of calling mlockall to speedup VM's startup

2014-09-27 Thread zhanghailiang
On 2014/9/26 23:35, Paolo Bonzini wrote: Il 26/09/2014 10:35, zhanghailiang ha scritto: Hi, This has been reviewed, Will anyone pick this up?;) I think mst will. It's Jewish new year this week, so it will have to wait for next week. OK, Thanks;) Best Regard, zhanghailiang Paolo T

Re: [Qemu-devel] [PATCH v2] qga: Rewrite code where using readdir_r

2014-09-27 Thread zhanghailiang
On 2014/9/26 23:40, Paolo Bonzini wrote: Il 19/09/2014 05:09, zhanghailiang ha scritto: If readdir_r fails, error_setg_errno will reference the freed pointer *dirpath*. Moreover, readdir_r may cause a buffer overflow, using readdir instead. Signed-off-by: zhanghailiang --- v2: - Switch

Re: [Qemu-devel] [PATCH v6 1/2] dump: let dump_error return error info to caller

2014-09-29 Thread zhanghailiang
On 2014/9/29 15:48, Markus Armbruster wrote: zhanghailiang writes: The second parameter of dump_error is unused, but one purpose of using this function is to report the error info. Use error_set to return the error info to the caller. Signed-off-by: zhanghailiang The commit message

Re: [Qemu-devel] [PATCH v3] pc-dimm/numa: Fix stat of memory size in node when hotplug memory

2014-09-29 Thread zhanghailiang
On 2014/9/26 19:53, Igor Mammedov wrote: On Tue, 23 Sep 2014 16:11:25 +0800 zhanghailiang wrote: When do memory hotplug, if there is numa node, we should add the memory size to the corresponding node memory size. For now, it mainly affects the result of hmp command "info numa".

Re: [Qemu-devel] [PATCH v6 2/2] dump: Don't return error code when return an Error object

2014-09-30 Thread zhanghailiang
On 2014/9/29 16:06, Markus Armbruster wrote: zhanghailiang writes: Functions shouldn't return an error code and an Error object at the same time. Turn all these functions that returning Error object to void. We also judge if a function success or fail by reference to the local_err. S

[Qemu-devel] [PATCH v7 0/2] Return error reasons to caller when calling qmp_dump_guest_memory

2014-09-30 Thread zhanghailiang
#x27; in error messages v2 -> v3: - Drop the '\n' in the message when call dump_error (Eric Blake) v1 -> v2: - Return the error reason to the caller (Luiz Capitulino) Thanks for review!;) zhanghailiang (2): dump: Propagate errors into qmp_dump_guest_memory() dump: Turn some funct

[Qemu-devel] [PATCH v7 2/2] dump: Turn some functions to void to make code cleaner

2014-09-30 Thread zhanghailiang
Functions shouldn't return an error code and an Error object at the same time. Turn all these functions that returning Error object to void. We also judge if a function success or fail by reference to the local_err. Signed-off-by: zhanghailiang --- dump.c

[Qemu-devel] [PATCH v7 1/2] dump: Propagate errors into qmp_dump_guest_memory()

2014-09-30 Thread zhanghailiang
useful error. Reviewed-by: Markus Armbruster Signed-off-by: zhanghailiang --- dump.c | 165 - 1 file changed, 82 insertions(+), 83 deletions(-) diff --git a/dump.c b/dump.c index 71d3e94..07d2300 100644 --- a/dump.c +++ b/dump.c

Re: [Qemu-devel] [PATCH v7 2/2] dump: Turn some functions to void to make code cleaner

2014-10-07 Thread zhanghailiang
Hi, Ping...:( Thanks, zhanghailiang On 2014/9/30 17:20, zhanghailiang wrote: Functions shouldn't return an error code and an Error object at the same time. Turn all these functions that returning Error object to void. We also judge if a function success or fail by reference to the loca

Re: [Qemu-devel] [PATCH v4 01/47] QEMUSizedBuffer based QEMUFile

2014-10-07 Thread zhanghailiang
On 2014/10/4 1:47, Dr. David Alan Gilbert (git) wrote: From: "Dr. David Alan Gilbert" * Please comment on separate thread for this QEMUSizedBuffer patch * This is based on Stefan and Joel's patch that creates a QEMUFile that goes to a memory buffer; from: http://lists.gnu.org/archive/html/qem

Re: [Qemu-devel] [PATCH v4 23/47] migrate_init: Call from savevm

2014-10-07 Thread zhanghailiang
On 2014/10/4 1:47, Dr. David Alan Gilbert (git) wrote: From: "Dr. David Alan Gilbert" Suspend to file is very much like a migrate, and it makes life easier if we have the Migration state available, so initialise it in the savevm.c code for suspending. Signed-off-by: Dr. David Alan Gilbert ---

Re: [Qemu-devel] [PATCH v4 36/47] Page request: Process incoming page request

2014-10-07 Thread zhanghailiang
On 2014/10/4 1:47, Dr. David Alan Gilbert (git) wrote: From: "Dr. David Alan Gilbert" On receiving MIG_RPCOMM_REQPAGES look up the address and queue the page. Signed-off-by: Dr. David Alan Gilbert --- arch_init.c | 52 +++ include/m

Re: [Qemu-devel] [PATCH v5 1/2] QEMUSizedBuffer based QEMUFile

2014-10-07 Thread zhanghailiang
On 2014/9/29 17:41, Dr. David Alan Gilbert (git) wrote: From: "Dr. David Alan Gilbert" This is based on Stefan and Joel's patch that creates a QEMUFile that goes to a memory buffer; from: http://lists.gnu.org/archive/html/qemu-devel/2013-03/msg05036.html Using the QEMUFile interface, this pat

Re: [Qemu-devel] [PATCH v3] pc-dimm/numa: Fix stat of memory size in node when hotplug memory

2014-10-08 Thread zhanghailiang
Hi Igor, On 2014/9/26 19:53, Igor Mammedov wrote: On Tue, 23 Sep 2014 16:11:25 +0800 zhanghailiang wrote: When do memory hotplug, if there is numa node, we should add the memory size to the corresponding node memory size. For now, it mainly affects the result of hmp command "info

Re: [Qemu-devel] [PATCH v4 36/47] Page request: Process incoming page request

2014-10-08 Thread zhanghailiang
On 2014/10/8 15:49, Dr. David Alan Gilbert wrote: * zhanghailiang (zhang.zhanghaili...@huawei.com) wrote: typedef struct Visitor Visitor; @@ -80,6 +81,6 @@ typedef struct FWCfgState FWCfgState; typedef struct PcGuestInfo PcGuestInfo; typedef struct PostcopyPMI PostcopyPMI; typedef

Re: [Qemu-devel] [PATCH v3] pc-dimm/numa: Fix stat of memory size in node when hotplug memory

2014-10-08 Thread zhanghailiang
On 2014/10/8 15:28, zhanghailiang wrote: Hi Igor, On 2014/9/26 19:53, Igor Mammedov wrote: On Tue, 23 Sep 2014 16:11:25 +0800 zhanghailiang wrote: When do memory hotplug, if there is numa node, we should add the memory size to the corresponding node memory size. For now, it mainly affects

Re: [Qemu-devel] [PATCH v5 1/2] QEMUSizedBuffer based QEMUFile

2014-10-08 Thread zhanghailiang
On 2014/10/8 17:08, Dr. David Alan Gilbert wrote: * zhanghailiang (zhang.zhanghaili...@huawei.com) wrote: +static ssize_t qsb_grow(QEMUSizedBuffer *qsb, size_t new_size) +{ +size_t needed_chunks, i; + +if (qsb->size < new_size) { +struct iovec *new_iov; +

Re: [Qemu-devel] [PATCH v4 06/10] slirp/misc: check return value of malloc()

2014-08-11 Thread zhanghailiang
On 2014/8/8 21:24, Alex Bennée wrote: zhanghailiang writes: On 2014/8/8 17:43, Alex Bennée wrote: zhanghailiang writes: Signed-off-by: zhanghailiang --- slirp/misc.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) Your indenting has gone a bit weird there. Hmm

[Qemu-devel] [PATCH v5 04/10] ivshmem: check the value returned by fstat()

2014-08-11 Thread zhanghailiang
The function fstat() may fail, so check its return value. Acked-by: Levente Kurusa Signed-off-by: zhanghailiang --- hw/misc/ivshmem.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 768e528..2be4b86 100644 --- a/hw/misc

[Qemu-devel] [PATCH v5 03/10] virtio-blk: fix reference a pointer which might be freed

2014-08-11 Thread zhanghailiang
In function virtio_blk_handle_request, it may freed memory pointed by req, So do not access member of req after calling this function. Reviewed-by: Stefan Hajnoczi Signed-off-by: zhanghailiang --- hw/block/virtio-blk.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw

[Qemu-devel] [PATCH v5 06/10] slirp/misc: Use g_malloc() instead of malloc()

2014-08-11 Thread zhanghailiang
Here we don't check the return value of malloc() which may fail. Use the g_malloc() instead, which will abort the program when there is not enough memory. Signed-off-by: zhanghailiang --- slirp/misc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slirp/misc.c b/

[Qemu-devel] [PATCH v5 01/10] l2cap: fix access freed memory

2014-08-11 Thread zhanghailiang
Pointer 'ch' will be used in function 'l2cap_channel_open_req_msg' after it was previously freed in 'l2cap_channel_open'. Assigned it to NULL after it is freed. Reviewed-by: Alex Bennée Signed-off-by: zhanghailiang --- hw/bt/l2cap.c | 2 +- 1 file changed, 1 ins

[Qemu-devel] [PATCH v5 00/10] fix three bugs about use-after-free and several api abuse

2014-08-11 Thread zhanghailiang
em: * Modified the log message according to reviewing suggestion of Michael Li Liu (3): tcg: check return value of fopen() block/vvfat: fix setbuf stream parameter may be NULL qtest: check the value returned by fopen() zhanghailiang (7): l2cap: fix access freed memory monitor: fix acces

[Qemu-devel] [PATCH v5 05/10] util/path: Use the GLib memory allocation routines

2014-08-11 Thread zhanghailiang
d-off-by: zhanghailiang --- util/path.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util/path.c b/util/path.c index 5c59d9f..e152f2a 100644 --- a/util/path.c +++ b/util/path.c @@ -45,8 +45,8 @@ static struct pathelem *new_entry(const char

[Qemu-devel] [PATCH v5 08/10] tests/bios-tables-test: check the value returned by fopen()

2014-08-11 Thread zhanghailiang
The function fopen() may fail, so check its return value. Signed-off-by: zhanghailiang Signed-off-by: Li Liu --- tests/bios-tables-test.c | 5 + 1 file changed, 5 insertions(+) diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c index 045eb27..28ec28d 100644 --- a/tests/bios

[Qemu-devel] [PATCH v5 02/10] monitor: fix access freed memory

2014-08-11 Thread zhanghailiang
The function monitor_fdset_dup_fd_find_remove() references member of 'mon_fdset' which may be freed in function monitor_fdset_cleanup() Reviewed-by: Gonglei Signed-off-by: zhanghailiang --- monitor.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/monitor.c b

[Qemu-devel] [PATCH v5 09/10] tcg: check return value of fopen()

2014-08-11 Thread zhanghailiang
From: Li Liu Give a warning message if fopen() failed to open the log file. Signed-off-by: zhanghailiang Signed-off-by: Li Liu --- tcg/tcg.c | 4 1 file changed, 4 insertions(+) diff --git a/tcg/tcg.c b/tcg/tcg.c index c068990..8f50d2a 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -2406,6

[Qemu-devel] [PATCH v5 10/10] block/vvfat: fix setbuf stream parameter may be NULL

2014-08-11 Thread zhanghailiang
From: Li Liu fopen() may return NULL which will cause setbuf() segmentfault Signed-off-by: zhanghailiang Signed-off-by: Li Liu --- block/vvfat.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/block/vvfat.c b/block/vvfat.c index 70176b1..6889ea9 100644 --- a/block

[Qemu-devel] [PATCH v5 07/10] linux-user: check return value of malloc()

2014-08-11 Thread zhanghailiang
Signed-off-by: zhanghailiang --- linux-user/syscall.c | 4 1 file changed, 4 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index a50229d..8e5ccf1 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -2870,6 +2870,10 @@ static inline abi_long do_msgsnd

Re: [Qemu-devel] [PATCH v2 00/43] Postcopy implementation

2014-08-11 Thread zhanghailiang
copy-ram.c Hi Dave, I want to test your patches, but i failed to 'git am' them to the new qemu-2.1 source. I want to know if you has a git-branch which i can git clone directly? Thanks. Best regards, zhanghailiang

Re: [Qemu-devel] [PATCH v2 19/43] postcopy: OS support test

2014-08-11 Thread zhanghailiang
rn, should we munmap testarea? BTW, i think it is better to use goto statement, which we can handle the error cases together! Best regards, zhanghailiang +return -1; +} +g_assert(((size_t)testarea2& (pagesize-1)) == 0); +*(char *)testarea = 0; /* Force the map of the new p

[Qemu-devel] [PATCH] mlock: fix bug when mlockall called before mbind

2014-08-13 Thread zhanghailiang
ove it to function pc_memory_init. Signed-off-by: xiexiangyou Signed-off-by: zhanghailiang --- hw/i386/pc.c| 8 include/sysemu/sysemu.h | 1 + vl.c| 10 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/

[Qemu-devel] [PATCH 0/3] forbid dealing with net packets when VM is not running

2014-08-13 Thread zhanghailiang
s net bug first. Thanks, zhanghailiang zhanghailiang (3): net: forbid dealing with packets when VM is not running net: Flush queues when runstate changes back to running virtio-net: Remove checking vm state in virtio_net_can_receive hw/net/virtio-net.c | 4 include/net/net.h | 2 ++

[Qemu-devel] [PATCH 2/3] net: Flush queues when runstate changes back to running

2014-08-13 Thread zhanghailiang
nction for VMstate change. When vm changes back to running, we flush all queues in the callback function. Signed-off-by: zhanghailiang --- include/net/net.h | 1 + net/net.c | 26 ++ 2 files changed, 27 insertions(+) diff --git a/include/net/net.h b/include/net/n

[Qemu-devel] [PATCH 1/3] net: Forbid dealing with packets when VM is not running

2014-08-13 Thread zhanghailiang
twork fault in VM. To avoid this, do things like virtio-net, and forbid receiving packets in generic net code when VM is not running. Signed-off-by: zhanghailiang --- include/net/net.h | 1 + net/net.c | 6 ++ 2 files changed, 7 insertions(+) diff --git a/include/net/net.h b/includ

[Qemu-devel] [PATCH 3/3] virtio-net: Remove checking vm state in virtio_net_can_receive

2014-08-13 Thread zhanghailiang
, When the vdev->vm_running is still false. Actually it depends on the register sequence of callback functions. Here nic_vmstate_change_handler will called before virtio_vmstate_change. So remove the unnecessarily checking. Signed-off-by: zhanghailiang --- hw/net/virtio-net.c | 4 1 file chan

Re: [Qemu-devel] [PATCH] mlock: fix bug when mlockall called before mbind

2014-08-13 Thread zhanghailiang
On 2014/8/13 19:50, Michael S. Tsirkin wrote: On Wed, Aug 13, 2014 at 07:21:57PM +0800, zhanghailiang wrote: If we configure qemu with realtime-mlock-on and memory-node-bind at the same time, Qemu will fail to start, and mbind() fails with message "Input/output error". > From

[Qemu-devel] [PATCH v6 04/10] ivshmem: check the value returned by fstat()

2014-08-14 Thread zhanghailiang
The function fstat() may fail, so check its return value. Acked-by: Levente Kurusa Signed-off-by: zhanghailiang --- hw/misc/ivshmem.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 768e528..2be4b86 100644 --- a/hw/misc

[Qemu-devel] [PATCH v6 06/10] slirp/misc: Use g_malloc() instead of malloc()

2014-08-14 Thread zhanghailiang
Here we don't check the return value of malloc() which may fail. Use the g_malloc() instead, which will abort the program when there is not enough memory. Signed-off-by: zhanghailiang Reviewed-by: Alex Bennée --- slirp/misc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)

[Qemu-devel] [PATCH v6 05/10] util/path: Use the GLib memory allocation routines

2014-08-14 Thread zhanghailiang
igned-off-by: zhanghailiang Reviewed-by: Alex Bennée --- util/path.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util/path.c b/util/path.c index 5c59d9f..e152f2a 100644 --- a/util/path.c +++ b/util/path.c @@ -45,8 +45,8 @@ static struct pathelem *new_entry(const char

[Qemu-devel] [PATCH v6 07/10] linux-user: check return value of malloc()

2014-08-14 Thread zhanghailiang
Signed-off-by: zhanghailiang Acked-by: Riku Voipio --- linux-user/syscall.c | 4 1 file changed, 4 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index a50229d..8e5ccf1 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -2870,6 +2870,10 @@ static

[Qemu-devel] [PATCH v6 02/10] monitor: fix access freed memory

2014-08-14 Thread zhanghailiang
The function monitor_fdset_dup_fd_find_remove() references member of 'mon_fdset' which may be freed in function monitor_fdset_cleanup() Reviewed-by: Gonglei Signed-off-by: zhanghailiang --- monitor.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/monitor.c b

[Qemu-devel] [PATCH v6 03/10] virtio-blk: fix reference a pointer which might be freed

2014-08-14 Thread zhanghailiang
In function virtio_blk_handle_request, it may freed memory pointed by req, So do not access member of req after calling this function. Reviewed-by: Stefan Hajnoczi Signed-off-by: zhanghailiang --- hw/block/virtio-blk.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw

[Qemu-devel] [PATCH v6 08/10] tests/bios-tables-test: check the value returned by fopen()

2014-08-14 Thread zhanghailiang
The function fopen() may fail, so check its return value. Signed-off-by: zhanghailiang Signed-off-by: Li Liu Reviewed-by: Alex Bennée --- tests/bios-tables-test.c | 5 + 1 file changed, 5 insertions(+) diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c index 045eb27

[Qemu-devel] [PATCH v6 09/10] tcg: check return value of fopen()

2014-08-14 Thread zhanghailiang
From: Li Liu Give a warning message if fopen() failed to open the log file. Reviewed-by: Alex Bennée Signed-off-by: zhanghailiang Signed-off-by: Li Liu --- tcg/tcg.c | 4 1 file changed, 4 insertions(+) diff --git a/tcg/tcg.c b/tcg/tcg.c index c068990..8f50d2a 100644 --- a/tcg/tcg.c

[Qemu-devel] [PATCH v6 10/10] block/vvfat: fix setbuf stream parameter may be NULL

2014-08-14 Thread zhanghailiang
From: Li Liu fopen() may return NULL which will cause setbuf() segmentfault Signed-off-by: zhanghailiang Signed-off-by: Li Liu --- block/vvfat.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/block/vvfat.c b/block/vvfat.c index 70176b1..6889ea9 100644 --- a/block

[Qemu-devel] [PATCH v6 01/10] l2cap: fix access freed memory

2014-08-14 Thread zhanghailiang
Pointer 'ch' will be used in function 'l2cap_channel_open_req_msg' after it was previously freed in 'l2cap_channel_open'. Assigned it to NULL after it is freed. Reviewed-by: Alex Bennée Signed-off-by: zhanghailiang --- hw/bt/l2cap.c | 2 +- 1 file changed, 1 ins

[Qemu-devel] [PATCH v6 00/10] fix three bugs about use-after-free and several api abuse

2014-08-14 Thread zhanghailiang
qemu trivial branch? Any help will be greatly appreciated. Thanks, zhanghailiang This patch set fix three bugs about accessing freed memory and several api abuse. In qemu, there are serveral places that do not check the return value of fstat()/fopen()/malloc(),etc. Though it is a small

Re: [Qemu-devel] [PATCH 2/3] net: Flush queues when runstate changes back to running

2014-08-14 Thread zhanghailiang
s ok! (2) Register a handler function for VMstate change. When vm changes back to running, we flush all queues in the callback function. Signed-off-by: zhanghailiang --- include/net/net.h | 1 + net/net.c | 26 ++ 2 files changed, 27 insertions(+) diff --git

Re: [Qemu-devel] [PATCH] mlock: fix bug when mlockall called before mbind

2014-08-14 Thread zhanghailiang
On 2014/8/14 15:15, Hu Tao wrote: On Thu, Aug 14, 2014 at 02:31:41PM +0800, zhanghailiang wrote: On 2014/8/13 19:50, Michael S. Tsirkin wrote: On Wed, Aug 13, 2014 at 07:21:57PM +0800, zhanghailiang wrote: If we configure qemu with realtime-mlock-on and memory-node-bind at the same time

Re: [Qemu-devel] [PATCH v6 06/10] slirp/misc: Use g_malloc() instead of malloc()

2014-08-17 Thread zhanghailiang
On 2014/8/14 18:31, Michael S. Tsirkin wrote: On Thu, Aug 14, 2014 at 03:29:17PM +0800, zhanghailiang wrote: Here we don't check the return value of malloc() which may fail. Use the g_malloc() instead, which will abort the program when there is not enough memory. Signed-off-by: zhanghai

Re: [Qemu-devel] [PATCH v6 08/10] tests/bios-tables-test: check the value returned by fopen()

2014-08-17 Thread zhanghailiang
On 2014/8/14 18:32, Michael S. Tsirkin wrote: On Thu, Aug 14, 2014 at 03:29:19PM +0800, zhanghailiang wrote: The function fopen() may fail, so check its return value. Signed-off-by: zhanghailiang Signed-off-by: Li Liu Reviewed-by: Alex Bennée --- tests/bios-tables-test.c | 5 + 1 file

Re: [Qemu-devel] [PATCH] mlock: fix bug when mlockall called before mbind

2014-08-17 Thread zhanghailiang
On 2014/8/14 17:56, Michael S. Tsirkin wrote: On Thu, Aug 14, 2014 at 05:09:00PM +0800, zhanghailiang wrote: On 2014/8/14 15:15, Hu Tao wrote: On Thu, Aug 14, 2014 at 02:31:41PM +0800, zhanghailiang wrote: On 2014/8/13 19:50, Michael S. Tsirkin wrote: On Wed, Aug 13, 2014 at 07:21:57PM +0800

Re: [Qemu-devel] [PATCH 2/3] net: Flush queues when runstate changes back to running

2014-08-17 Thread zhanghailiang
On 2014/8/14 18:05, Michael S. Tsirkin wrote: On Thu, Aug 14, 2014 at 02:13:57PM +0800, zhanghailiang wrote: 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) add a member 'VMChangeState

Re: [Qemu-devel] [PATCH 2/3] net: Flush queues when runstate changes back to running

2014-08-17 Thread zhanghailiang
On 2014/8/14 18:09, Michael S. Tsirkin wrote: On Thu, Aug 14, 2014 at 02:13:57PM +0800, zhanghailiang wrote: 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) add a member 'VMChangeState

Re: [Qemu-devel] [PATCH v6 10/10] block/vvfat: fix setbuf stream parameter may be NULL

2014-08-17 Thread zhanghailiang
On 2014/8/14 18:36, Michael S. Tsirkin wrote: On Thu, Aug 14, 2014 at 03:29:21PM +0800, zhanghailiang wrote: From: Li Liu fopen() may return NULL which will cause setbuf() segmentfault Signed-off-by: zhanghailiang Signed-off-by: Li Liu --- block/vvfat.c | 5 - 1 file changed, 4

[Qemu-devel] [PATCH] net: Forbid dealing with packets when VM is not running

2014-08-17 Thread zhanghailiang
net_can_receive Signed-off-by: zhanghailiang --- hw/net/virtio-net.c | 4 include/net/net.h | 2 ++ net/net.c | 32 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 268eff9..287d762

Re: [Qemu-devel] [PATCH v6 06/10] slirp/misc: Use g_malloc() instead of malloc()

2014-08-17 Thread zhanghailiang
On 2014/8/14 18:31, Michael S. Tsirkin wrote: On Thu, Aug 14, 2014 at 03:29:17PM +0800, zhanghailiang wrote: Here we don't check the return value of malloc() which may fail. Use the g_malloc() instead, which will abort the program when there is not enough memory. Signed-off-by: zhanghai

Re: [Qemu-devel] [PATCH v6 05/10] util/path: Use the GLib memory allocation routines

2014-08-17 Thread zhanghailiang
On 2014/8/14 18:15, Michael S. Tsirkin wrote: On Thu, Aug 14, 2014 at 03:29:16PM +0800, zhanghailiang wrote: In this file, we don't check the return value of malloc/strdup/realloc which may fail. Instead of using these routines, we use the GLib memory APIs g_malloc/g_strdup/g_realloc.

Re: [Qemu-devel] [Qemu-trivial] [PATCH v6 09/10] tcg: check return value of fopen()

2014-08-17 Thread zhanghailiang
On 2014/8/16 0:53, Richard Henderson wrote: On 08/15/2014 05:03 AM, Michael Tokarev wrote: f = fopen("/tmp/op.log", "w"); Gosh. So why are we still use fixed filenames in /tmp? Every such use is a potential security holw... :( Ughm. Can't we get rid of this somehow, by requiring a

[Qemu-devel] [PATCH v7] virtio-blk: fix reference a pointer which might be freed

2014-08-18 Thread zhanghailiang
In function virtio_blk_handle_request, it may freed memory pointed by req, So do not access member of req after calling this function. Reviewed-by: Michael S. Tsirkin Reviewed-by: Stefan Hajnoczi Signed-off-by: zhanghailiang --- hw/block/virtio-blk.c | 3 ++- 1 file changed, 2 insertions

[Qemu-devel] [PATCH v7] util/path: Use the GLib memory allocation routines

2014-08-18 Thread zhanghailiang
igned-off-by: zhanghailiang Reviewed-by: Alex Bennée --- util/path.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/util/path.c b/util/path.c index 5c59d9f..4e4877e 100644 --- a/util/path.c +++ b/util/path.c @@ -45,8 +45,8 @@ static struct pathelem *new_entry(const

[Qemu-devel] [PATCH v7] slirp/misc: Use g_malloc() instead of malloc()

2014-08-18 Thread zhanghailiang
Here we don't check the return value of malloc() which may fail. Use the g_malloc() instead, which will abort the program when there is not enough memory. Signed-off-by: zhanghailiang Reviewed-by: Alex Bennée --- slirp/misc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)

[Qemu-devel] [PATCH v7] tests/bios-tables-test: check the value returned by fopen()

2014-08-18 Thread zhanghailiang
The function fopen() may fail, so check its return value. Signed-off-by: zhanghailiang Signed-off-by: Li Liu Reviewed-by: Alex Bennée --- tests/bios-tables-test.c | 5 + 1 file changed, 5 insertions(+) diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c index 045eb27

[Qemu-devel] [PATCH v7] tcg: dump op count into qemu log

2014-08-18 Thread zhanghailiang
fopen() may fail and it does not check its return vaule here, it is better to dump op count to the normal log file. Signed-off-by: Li Liu Signed-off-by: zhanghailiang --- tcg/tcg.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index c068990

[Qemu-devel] [PATCH v7] block/vvfat: assert return value of fopen which may fail

2014-08-18 Thread zhanghailiang
From: Li Liu fopen() may return NULL which will cause setbuf() segmentfault Signed-off-by: zhanghailiang Signed-off-by: Li Liu --- block/vvfat.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/vvfat.c b/block/vvfat.c index 70176b1..62023e1 100644 --- a/block/vvfat.c +++ b/block

Re: [Qemu-devel] [PATCH] net: Forbid dealing with packets when VM is not running

2014-08-18 Thread zhanghailiang
On 2014/8/18 14:55, Jason Wang wrote: On 08/18/2014 12:46 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, Th

Re: [Qemu-devel] [Qemu-trivial] [PATCH v7] block/vvfat: assert return value of fopen which may fail

2014-08-18 Thread zhanghailiang
On 2014/8/18 19:42, Michael Tokarev wrote: 18.08.2014 12:06, Peter Maydell wrote: On 18 August 2014 09:00, zhanghailiang wrote: From: Li Liu fopen() may return NULL which will cause setbuf() segmentfault Signed-off-by: zhanghailiang Signed-off-by: Li Liu --- block/vvfat.c | 1 + 1 file

  1   2   3   4   5   6   7   8   9   10   >