All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Qemu-devel] [PATCH 0/1] Change default CFLAGS to -O3
@ 2017-01-10 13:49 Jin Guojie
  0 siblings, 0 replies; 4+ messages in thread
From: Jin Guojie @ 2017-01-10 13:49 UTC (permalink / raw)
  To: Peter Maydell
  Cc: qemu-devel, Paolo Bonzini, Daniel P. Berrange, Christian Borntraeger

Thanks all for your review comments.
To measure the actual performance difference between O2 and O3,
I did the following tests:

Environments:
* Hardware: AMD Athlon II X2 270 Processor, 3.4 GHz
* Host OS: Fedora25 X86_64
* qemu: 2.8.0
* gcc: 6.2.1
* Guest OS: linux-0.2.img
  (downloaded from http://wiki.qemu.org/Testing/System_Images)
* Benchmark: nbench within linux-0.2.img

Results:
  Each test has been run at least 3 times to minimize the deviation.
  Higher score is better.

|                            |   O2   |   O3   |
------------------------------------------------
| qemu-system-i386(stripped) | 8.1 MB | 8.9 MB | 
| nbench(NUMERIC SORT)       | 254.72 | 260.48 |
|                            | 259.2  | 259.52 |
|                            | 261.04,| 259.68 |

Conclusion:
  Compared with O2, O3 brings no obvious performance advantage.
  It's highly possible that the benchmark score is mainly determined
  by the quality of tcg, not the host compiler.

Related work:
(1) The same test is done on a Loongson 3A2000.
  It's a mips64el-compatible CPU, with 4 cores running at 1.5 GHz.
  The result and conclusion are almost the same with X86.
(2) Another scene of OS booting is taken into consideration.
  I compare the booting time of linux-0.2.img under O2 and O3.
  Once again, I cannot see an observable difference.

Based on these data I admit my patch has no benifit for performance.

Jin Guojie

 ------------------ Original ------------------
From:  "Peter Maydell";<peter.maydell@linaro.org>;
Send time: Monday, Jan 9, 2017 6:33 PM
To: "Jin Guojie"<jinguojie@loongson.cn>; 
Cc: "QEMU Developers"<qemu-devel@nongnu.org>; "Paolo Bonzini"<pbonzini@redhat.com>; 
Subject:  Re: [Qemu-devel] [PATCH 0/1] Change default CFLAGS to -O3



On 9 January 2017 at 10:01, Jin Guojie <jinguojie@loongson.cn> wrote:
> * in configure, the default optimization level is changed to O3.
> * Tested successfully on following machines:
>
>   | Host machine | Host OS  | qemu-system | Debian ISO  |
>   |-----------------------------------------------------|
>   |   x86 64     | Fedora25 |    i386     |    i386     |
>   | mips 64 le   | Fedora25 |    i386     |    i386     |
>
> Signed-off-by: Jin Guojie <jinguojie@loongson.cn>
>
> Jin Guojie (1):
>   Change default CFLAGS to -O3
>
>  configure | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

...so what are the measured performance improvements from
this change? As I understand it -O3 is where the "trade off
code size for speed" optimisations kick in, so we need
to benchmark to be sure that the increased icache usage
doesn't outweigh any speed gains. -O3 is not guaranteed
to be strictly better than -O2 (which is why for instance
Debian and Gentoo recommend -O2 as their default).

thanks
-- PMM

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

* Re: [Qemu-devel] [PATCH 0/1] Change default CFLAGS to -O3
  2017-01-09 10:01 Jin Guojie
  2017-01-09 10:33 ` Peter Maydell
@ 2017-01-09 11:09 ` Christian Borntraeger
  1 sibling, 0 replies; 4+ messages in thread
From: Christian Borntraeger @ 2017-01-09 11:09 UTC (permalink / raw)
  To: Jin Guojie, qemu-devel; +Cc: Paolo Bonzini

On 01/09/2017 11:01 AM, Jin Guojie wrote:
> * in configure, the default optimization level is changed to O3.
> * Tested successfully on following machines:
> 
>   | Host machine | Host OS  | qemu-system | Debian ISO  |
>   |-----------------------------------------------------|
>   |   x86 64     | Fedora25 |    i386     |    i386     |
>   | mips 64 le   | Fedora25 |    i386     |    i386     |
> 
> Signed-off-by: Jin Guojie <jinguojie@loongson.cn>
> 
> Jin Guojie (1):
>   Change default CFLAGS to -O3
> 
>  configure | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

There are some compilers that trigger some maybe Warnings with -O3
e.g.

      CC      block/vmdk.o
    /home/cborntra/REPOS/qemu/block/vmdk.c: In function ‘vmdk_open_vmdk4’:
    /home/cborntra/REPOS/qemu/block/vmdk.c:718:24: error: ‘extent’ may be
    used uninitialized in this function [-Werror=maybe-uninitialized]
         extent->has_marker = le32_to_cpu(header.flags) & VMDK4_FLAG_MARKER;
                            ^
    /home/cborntra/REPOS/qemu/block/vmdk.c: In function ‘vmdk_open_sparse’:
    /home/cborntra/REPOS/qemu/block/vmdk.c:530:9: error: ‘extent’ may be
    used uninitialized in this function [-Werror=maybe-uninitialized]
         ret = vmdk_init_tables(bs, extent, errp);
             ^
    /home/cborntra/REPOS/qemu/block/vmdk.c:509:17: note: ‘extent’ was
    declared here
         VmdkExtent *extent;
                     ^
    /home/cborntra/REPOS/qemu/block/vmdk.c: In function
    ‘vmdk_open_desc_file.isra.12’:
    /home/cborntra/REPOS/qemu/block/vmdk.c:873:39: error: ‘extent’ may be
    used uninitialized in this function [-Werror=maybe-uninitialized]
                 extent->flat_start_offset = flat_offset << 9;
                                           ^
    /home/cborntra/REPOS/qemu/block/vmdk.c:803:17: note: ‘extent’ was
    declared here
         VmdkExtent *extent;
                     ^
    cc1: all warnings being treated as errors
    /home/cborntra/REPOS/qemu/rules.mak:60: recipe for target 'block/vmdk.o'
    failed


I have started fixing those some time ago but had no time yet finishing that.
Totally messy patches (in terms of patch description) at
https://github.com/borntraeger/qemu/commits/o3

Christian

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

* Re: [Qemu-devel] [PATCH 0/1] Change default CFLAGS to -O3
  2017-01-09 10:01 Jin Guojie
@ 2017-01-09 10:33 ` Peter Maydell
  2017-01-09 11:09 ` Christian Borntraeger
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2017-01-09 10:33 UTC (permalink / raw)
  To: Jin Guojie; +Cc: QEMU Developers, Paolo Bonzini

On 9 January 2017 at 10:01, Jin Guojie <jinguojie@loongson.cn> wrote:
> * in configure, the default optimization level is changed to O3.
> * Tested successfully on following machines:
>
>   | Host machine | Host OS  | qemu-system | Debian ISO  |
>   |-----------------------------------------------------|
>   |   x86 64     | Fedora25 |    i386     |    i386     |
>   | mips 64 le   | Fedora25 |    i386     |    i386     |
>
> Signed-off-by: Jin Guojie <jinguojie@loongson.cn>
>
> Jin Guojie (1):
>   Change default CFLAGS to -O3
>
>  configure | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

...so what are the measured performance improvements from
this change? As I understand it -O3 is where the "trade off
code size for speed" optimisations kick in, so we need
to benchmark to be sure that the increased icache usage
doesn't outweigh any speed gains. -O3 is not guaranteed
to be strictly better than -O2 (which is why for instance
Debian and Gentoo recommend -O2 as their default).

thanks
-- PMM

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

* [Qemu-devel] [PATCH 0/1] Change default CFLAGS to -O3
@ 2017-01-09 10:01 Jin Guojie
  2017-01-09 10:33 ` Peter Maydell
  2017-01-09 11:09 ` Christian Borntraeger
  0 siblings, 2 replies; 4+ messages in thread
From: Jin Guojie @ 2017-01-09 10:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Jin Guojie

* in configure, the default optimization level is changed to O3.
* Tested successfully on following machines:

  | Host machine | Host OS  | qemu-system | Debian ISO  |
  |-----------------------------------------------------|
  |   x86 64     | Fedora25 |    i386     |    i386     |
  | mips 64 le   | Fedora25 |    i386     |    i386     |

Signed-off-by: Jin Guojie <jinguojie@loongson.cn>

Jin Guojie (1):
  Change default CFLAGS to -O3

 configure | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.9.3

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

end of thread, other threads:[~2017-01-10 13:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-10 13:49 [Qemu-devel] [PATCH 0/1] Change default CFLAGS to -O3 Jin Guojie
  -- strict thread matches above, loose matches on Subject: below --
2017-01-09 10:01 Jin Guojie
2017-01-09 10:33 ` Peter Maydell
2017-01-09 11:09 ` Christian Borntraeger

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.