All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/3] some fix in tests/migration
@ 2019-09-10 12:09 Mao Zhongyi
  2019-09-10 12:09 ` [Qemu-devel] [PATCH 1/3] tests/migration: mem leak fix Mao Zhongyi
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Mao Zhongyi @ 2019-09-10 12:09 UTC (permalink / raw)
  To: qemu-devel; +Cc: tony.nguyen, armbru, Mao Zhongyi, laurent

This patchset mainly fixes memory leak, typo and return
value of stress function in stress test.

Cc: armbru@redhat.com
Cc: laurent@vivier.eu
Cc: tony.nguyen@bt.com

Mao Zhongyi (3):
  tests/migration: mem leak fix
  tests/migration: fix a typo in comment
  tests/migration:fix unreachable path in stress test

 tests/migration/stress.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

-- 
2.17.1





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

* [Qemu-devel] [PATCH 1/3] tests/migration: mem leak fix
  2019-09-10 12:09 [Qemu-devel] [PATCH 0/3] some fix in tests/migration Mao Zhongyi
@ 2019-09-10 12:09 ` Mao Zhongyi
  2019-09-10 18:52   ` Alex Bennée
  2019-09-10 12:09 ` [Qemu-devel] [PATCH 2/3] tests/migration: fix a typo in comment Mao Zhongyi
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Mao Zhongyi @ 2019-09-10 12:09 UTC (permalink / raw)
  To: qemu-devel; +Cc: tony.nguyen, armbru, Mao Zhongyi, laurent

Cc: armbru@redhat.com
Cc: laurent@vivier.eu
Cc: tony.nguyen@bt.com

Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
---
 tests/migration/stress.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/migration/stress.c b/tests/migration/stress.c
index d9aa4afe92..e6c9a6b243 100644
--- a/tests/migration/stress.c
+++ b/tests/migration/stress.c
@@ -181,6 +181,8 @@ static int stressone(unsigned long long ramsizeMB)
     if (!ram) {
         fprintf(stderr, "%s (%05d): ERROR: cannot allocate %llu MB of RAM: %s\n",
                 argv0, gettid(), ramsizeMB, strerror(errno));
+        if (data)
+            free(data);
         return -1;
     }
     if (!data) {
-- 
2.17.1





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

* [Qemu-devel] [PATCH 2/3] tests/migration: fix a typo in comment
  2019-09-10 12:09 [Qemu-devel] [PATCH 0/3] some fix in tests/migration Mao Zhongyi
  2019-09-10 12:09 ` [Qemu-devel] [PATCH 1/3] tests/migration: mem leak fix Mao Zhongyi
@ 2019-09-10 12:09 ` Mao Zhongyi
  2019-09-10 18:49   ` Alex Bennée
  2019-09-10 12:09 ` [Qemu-devel] [PATCH 3/3] tests/migration:fix unreachable path in stress test Mao Zhongyi
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Mao Zhongyi @ 2019-09-10 12:09 UTC (permalink / raw)
  To: qemu-devel; +Cc: tony.nguyen, armbru, Mao Zhongyi, laurent

Cc: armbru@redhat.com
Cc: laurent@vivier.eu
Cc: tony.nguyen@bt.com

Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
---
 tests/migration/stress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/migration/stress.c b/tests/migration/stress.c
index e6c9a6b243..4bc3a249e6 100644
--- a/tests/migration/stress.c
+++ b/tests/migration/stress.c
@@ -194,7 +194,7 @@ static int stressone(unsigned long long ramsizeMB)
 
     /* We don't care about initial state, but we do want
      * to fault it all into RAM, otherwise the first iter
-     * of the loop below will be quite slow. We cna't use
+     * of the loop below will be quite slow. We can't use
      * 0x0 as the byte as gcc optimizes that away into a
      * calloc instead :-) */
     memset(ram, 0xfe, ramsizeMB * 1024 * 1024);
-- 
2.17.1





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

* [Qemu-devel] [PATCH 3/3] tests/migration:fix unreachable path in stress test
  2019-09-10 12:09 [Qemu-devel] [PATCH 0/3] some fix in tests/migration Mao Zhongyi
  2019-09-10 12:09 ` [Qemu-devel] [PATCH 1/3] tests/migration: mem leak fix Mao Zhongyi
  2019-09-10 12:09 ` [Qemu-devel] [PATCH 2/3] tests/migration: fix a typo in comment Mao Zhongyi
@ 2019-09-10 12:09 ` Mao Zhongyi
  2019-09-10 16:11 ` [Qemu-devel] [PATCH 0/3] some fix in tests/migration no-reply
  2019-09-10 23:07 ` no-reply
  4 siblings, 0 replies; 9+ messages in thread
From: Mao Zhongyi @ 2019-09-10 12:09 UTC (permalink / raw)
  To: qemu-devel; +Cc: tony.nguyen, armbru, Mao Zhongyi, laurent

if stress function always return 0, the path
'if (stress(ramsizeGB, ncpus) < 0)' is nerver unreachable,
so fix it to allow the test failed.

Cc: armbru@redhat.com
Cc: laurent@vivier.eu
Cc: tony.nguyen@bt.com

Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
---
 tests/migration/stress.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/migration/stress.c b/tests/migration/stress.c
index 4bc3a249e6..36f7d71d37 100644
--- a/tests/migration/stress.c
+++ b/tests/migration/stress.c
@@ -232,6 +232,8 @@ static int stressone(unsigned long long ramsizeMB)
 
     free(data);
     free(ram);
+
+    return 0;
 }
 
 
@@ -256,9 +258,7 @@ static int stress(unsigned long long ramsizeGB, int ncpus)
                        stressthread,   &ramsizeMB);
     }
 
-    stressone(ramsizeMB);
-
-    return 0;
+    return stressone(ramsizeMB);
 }
 
 
-- 
2.17.1





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

* Re: [Qemu-devel] [PATCH 0/3] some fix in tests/migration
  2019-09-10 12:09 [Qemu-devel] [PATCH 0/3] some fix in tests/migration Mao Zhongyi
                   ` (2 preceding siblings ...)
  2019-09-10 12:09 ` [Qemu-devel] [PATCH 3/3] tests/migration:fix unreachable path in stress test Mao Zhongyi
@ 2019-09-10 16:11 ` no-reply
  2019-09-10 23:07 ` no-reply
  4 siblings, 0 replies; 9+ messages in thread
From: no-reply @ 2019-09-10 16:11 UTC (permalink / raw)
  To: maozhongyi; +Cc: tony.nguyen, laurent, qemu-devel, maozhongyi, armbru

Patchew URL: https://patchew.org/QEMU/20190910120927.1669283-1-maozhongyi@cmss.chinamobile.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Subject: [Qemu-devel] [PATCH 0/3] some fix in tests/migration
Message-id: 20190910120927.1669283-1-maozhongyi@cmss.chinamobile.com
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
e4c5de2 tests/migration:fix unreachable path in stress test
9a3b77f tests/migration: fix a typo in comment
b277d56 tests/migration: mem leak fix

=== OUTPUT BEGIN ===
1/3 Checking commit b277d56926b6 (tests/migration: mem leak fix)
ERROR: braces {} are necessary for all arms of this statement
#22: FILE: tests/migration/stress.c:184:
+        if (data)
[...]

total: 1 errors, 0 warnings, 8 lines checked

Patch 1/3 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

2/3 Checking commit 9a3b77f10015 (tests/migration: fix a typo in comment)
3/3 Checking commit e4c5de2759b8 (tests/migration:fix unreachable path in stress test)
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20190910120927.1669283-1-maozhongyi@cmss.chinamobile.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

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

* Re: [Qemu-devel] [PATCH 2/3] tests/migration: fix a typo in comment
  2019-09-10 12:09 ` [Qemu-devel] [PATCH 2/3] tests/migration: fix a typo in comment Mao Zhongyi
@ 2019-09-10 18:49   ` Alex Bennée
  0 siblings, 0 replies; 9+ messages in thread
From: Alex Bennée @ 2019-09-10 18:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: tony.nguyen, armbru, Mao Zhongyi, laurent


Mao Zhongyi <maozhongyi@cmss.chinamobile.com> writes:

> Cc: armbru@redhat.com
> Cc: laurent@vivier.eu
> Cc: tony.nguyen@bt.com
>
> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

> ---
>  tests/migration/stress.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/migration/stress.c b/tests/migration/stress.c
> index e6c9a6b243..4bc3a249e6 100644
> --- a/tests/migration/stress.c
> +++ b/tests/migration/stress.c
> @@ -194,7 +194,7 @@ static int stressone(unsigned long long ramsizeMB)
>
>      /* We don't care about initial state, but we do want
>       * to fault it all into RAM, otherwise the first iter
> -     * of the loop below will be quite slow. We cna't use
> +     * of the loop below will be quite slow. We can't use
>       * 0x0 as the byte as gcc optimizes that away into a
>       * calloc instead :-) */
>      memset(ram, 0xfe, ramsizeMB * 1024 * 1024);


--
Alex Bennée


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

* Re: [Qemu-devel] [PATCH 1/3] tests/migration: mem leak fix
  2019-09-10 12:09 ` [Qemu-devel] [PATCH 1/3] tests/migration: mem leak fix Mao Zhongyi
@ 2019-09-10 18:52   ` Alex Bennée
  2019-09-11  1:35     ` maozy
  0 siblings, 1 reply; 9+ messages in thread
From: Alex Bennée @ 2019-09-10 18:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: tony.nguyen, armbru, Mao Zhongyi, laurent


Mao Zhongyi <maozhongyi@cmss.chinamobile.com> writes:

> Cc: armbru@redhat.com
> Cc: laurent@vivier.eu
> Cc: tony.nguyen@bt.com
>
> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
> ---
>  tests/migration/stress.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/tests/migration/stress.c b/tests/migration/stress.c
> index d9aa4afe92..e6c9a6b243 100644
> --- a/tests/migration/stress.c
> +++ b/tests/migration/stress.c
> @@ -181,6 +181,8 @@ static int stressone(unsigned long long ramsizeMB)
>      if (!ram) {
>          fprintf(stderr, "%s (%05d): ERROR: cannot allocate %llu MB of RAM: %s\n",
>                  argv0, gettid(), ramsizeMB, strerror(errno));
> +        if (data)
> +            free(data);

I wonder if it's worth using the glib macros here so:

  g_autofree char *data = g_malloc(PAGE_SIZE);

and the same for ram. You can then drop the frees.

>          return -1;
>      }
>      if (!data) {


--
Alex Bennée


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

* Re: [Qemu-devel] [PATCH 0/3] some fix in tests/migration
  2019-09-10 12:09 [Qemu-devel] [PATCH 0/3] some fix in tests/migration Mao Zhongyi
                   ` (3 preceding siblings ...)
  2019-09-10 16:11 ` [Qemu-devel] [PATCH 0/3] some fix in tests/migration no-reply
@ 2019-09-10 23:07 ` no-reply
  4 siblings, 0 replies; 9+ messages in thread
From: no-reply @ 2019-09-10 23:07 UTC (permalink / raw)
  To: maozhongyi; +Cc: tony.nguyen, laurent, qemu-devel, maozhongyi, armbru

Patchew URL: https://patchew.org/QEMU/20190910120927.1669283-1-maozhongyi@cmss.chinamobile.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Subject: [Qemu-devel] [PATCH 0/3] some fix in tests/migration
Message-id: 20190910120927.1669283-1-maozhongyi@cmss.chinamobile.com
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
1a1d7b1 tests/migration:fix unreachable path in stress test
5a19b9e tests/migration: fix a typo in comment
3b1a8b7 tests/migration: mem leak fix

=== OUTPUT BEGIN ===
1/3 Checking commit 3b1a8b7a617e (tests/migration: mem leak fix)
ERROR: braces {} are necessary for all arms of this statement
#22: FILE: tests/migration/stress.c:184:
+        if (data)
[...]

total: 1 errors, 0 warnings, 8 lines checked

Patch 1/3 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

2/3 Checking commit 5a19b9eb57d9 (tests/migration: fix a typo in comment)
3/3 Checking commit 1a1d7b1097b4 (tests/migration:fix unreachable path in stress test)
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20190910120927.1669283-1-maozhongyi@cmss.chinamobile.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

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

* Re: [Qemu-devel] [PATCH 1/3] tests/migration: mem leak fix
  2019-09-10 18:52   ` Alex Bennée
@ 2019-09-11  1:35     ` maozy
  0 siblings, 0 replies; 9+ messages in thread
From: maozy @ 2019-09-11  1:35 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel; +Cc: tony.nguyen, armbru, laurent


On 9/11/19 2:52 AM, Alex Bennée wrote:
> Mao Zhongyi <maozhongyi@cmss.chinamobile.com> writes:
>
>> Cc: armbru@redhat.com
>> Cc: laurent@vivier.eu
>> Cc: tony.nguyen@bt.com
>>
>> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
>> ---
>>   tests/migration/stress.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/tests/migration/stress.c b/tests/migration/stress.c
>> index d9aa4afe92..e6c9a6b243 100644
>> --- a/tests/migration/stress.c
>> +++ b/tests/migration/stress.c
>> @@ -181,6 +181,8 @@ static int stressone(unsigned long long ramsizeMB)
>>       if (!ram) {
>>           fprintf(stderr, "%s (%05d): ERROR: cannot allocate %llu MB of RAM: %s\n",
>>                   argv0, gettid(), ramsizeMB, strerror(errno));
>> +        if (data)
>> +            free(data);
> I wonder if it's worth using the glib macros here so:
>
>    g_autofree char *data = g_malloc(PAGE_SIZE);
>
> and the same for ram. You can then drop the frees.
>
I thins it's ok, which is also recommended in CODING_STYLE.rst.

Thx
     Mao
>>           return -1;
>>       }
>>       if (!data) {
>
> --
> Alex Bennée
>




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

end of thread, other threads:[~2019-09-11  1:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-10 12:09 [Qemu-devel] [PATCH 0/3] some fix in tests/migration Mao Zhongyi
2019-09-10 12:09 ` [Qemu-devel] [PATCH 1/3] tests/migration: mem leak fix Mao Zhongyi
2019-09-10 18:52   ` Alex Bennée
2019-09-11  1:35     ` maozy
2019-09-10 12:09 ` [Qemu-devel] [PATCH 2/3] tests/migration: fix a typo in comment Mao Zhongyi
2019-09-10 18:49   ` Alex Bennée
2019-09-10 12:09 ` [Qemu-devel] [PATCH 3/3] tests/migration:fix unreachable path in stress test Mao Zhongyi
2019-09-10 16:11 ` [Qemu-devel] [PATCH 0/3] some fix in tests/migration no-reply
2019-09-10 23:07 ` no-reply

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.