[PATCH 0/7] exec: Improve code for TARGET_PAGE_BITS_VARY

Richard Henderson posted 7 patches 4 years, 7 months ago
Test docker-quick@centos7 passed
Test docker-clang@ubuntu passed
Test docker-mingw@fedora passed
Test asan passed
Test checkpatch failed
Test FreeBSD passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190919232952.6382-1-richard.henderson@linaro.org
Maintainers: Richard Henderson <rth@twiddle.net>, Paolo Bonzini <pbonzini@redhat.com>
There is a newer version of this series
Makefile.target        |  2 +-
include/exec/cpu-all.h | 41 +++++++++++++-------
include/qemu-common.h  |  6 +++
exec-vary.c            | 88 ++++++++++++++++++++++++++++++++++++++++++
exec.c                 | 34 ----------------
5 files changed, 123 insertions(+), 48 deletions(-)
create mode 100644 exec-vary.c
[PATCH 0/7] exec: Improve code for TARGET_PAGE_BITS_VARY
Posted by Richard Henderson 4 years, 7 months ago
There's currently a fair amount of overhead in the way we currently
treat TARGET_PAGE_{BITS,SIZE,MASK} with TARGET_PAGE_BITS_VARY.

We have assertions that TARGET_PAGE_BITS has been finalized.  Which
is fine, but the variable that controls the assertion may be assumed
to be modified by any function call, which means that we have lots
of duplicate assertions.

This re-arranges things using a const symbol, which allows the compiler
to assume that the variable is not modified across calls.  In order to
allow initialization of the variable during startup, use an alias that
is non-const and controls the allocation into a read-write section.

Remove the assertion for release builds.

Precompute TARGET_PAGE_MASK.  This removes a runtime shift and allows
the variable to be used as a direct memory operand on x86.

Size reductions vs master for qemu-system-aarch64 for various hosts:

PPC64LE:
  debug-tcg:  -32264
  release:    -44360
AARCH64:
  debug-tcg:  -33304
  relase:     -77080
X86_64:
  debug-tcg:   -6685
  relase:     -15597


r~


Richard Henderson (7):
  exec: Use TARGET_PAGE_BITS_MIN for TLB flags
  exec: Split out variable page size support to exec-vary.c
  exec: Use const alias for TARGET_PAGE_BITS_VARY
  exec: Restrict TARGET_PAGE_BITS_VARY assert to CONFIG_DEBUG_TCG
  exec: Promote TARGET_PAGE_MASK to target_long
  exec: Tidy TARGET_PAGE_ALIGN
  exec: Cache TARGET_PAGE_MASK for TARGET_PAGE_BITS_VARY

 Makefile.target        |  2 +-
 include/exec/cpu-all.h | 41 +++++++++++++-------
 include/qemu-common.h  |  6 +++
 exec-vary.c            | 88 ++++++++++++++++++++++++++++++++++++++++++
 exec.c                 | 34 ----------------
 5 files changed, 123 insertions(+), 48 deletions(-)
 create mode 100644 exec-vary.c

-- 
2.17.1


Re: [PATCH 0/7] exec: Improve code for TARGET_PAGE_BITS_VARY
Posted by Paolo Bonzini 4 years, 7 months ago
On 20/09/19 01:29, Richard Henderson wrote:
> There's currently a fair amount of overhead in the way we currently
> treat TARGET_PAGE_{BITS,SIZE,MASK} with TARGET_PAGE_BITS_VARY.
> 
> We have assertions that TARGET_PAGE_BITS has been finalized.  Which
> is fine, but the variable that controls the assertion may be assumed
> to be modified by any function call, which means that we have lots
> of duplicate assertions.
> 
> This re-arranges things using a const symbol, which allows the compiler
> to assume that the variable is not modified across calls.  In order to
> allow initialization of the variable during startup, use an alias that
> is non-const and controls the allocation into a read-write section.
> 
> Remove the assertion for release builds.
> 
> Precompute TARGET_PAGE_MASK.  This removes a runtime shift and allows
> the variable to be used as a direct memory operand on x86.
> 
> Size reductions vs master for qemu-system-aarch64 for various hosts:
> 
> PPC64LE:
>   debug-tcg:  -32264
>   release:    -44360
> AARCH64:
>   debug-tcg:  -33304
>   relase:     -77080
> X86_64:
>   debug-tcg:   -6685
>   relase:     -15597
> 
> 
> r~
> 
> 
> Richard Henderson (7):
>   exec: Use TARGET_PAGE_BITS_MIN for TLB flags
>   exec: Split out variable page size support to exec-vary.c
>   exec: Use const alias for TARGET_PAGE_BITS_VARY
>   exec: Restrict TARGET_PAGE_BITS_VARY assert to CONFIG_DEBUG_TCG
>   exec: Promote TARGET_PAGE_MASK to target_long
>   exec: Tidy TARGET_PAGE_ALIGN
>   exec: Cache TARGET_PAGE_MASK for TARGET_PAGE_BITS_VARY
> 
>  Makefile.target        |  2 +-
>  include/exec/cpu-all.h | 41 +++++++++++++-------
>  include/qemu-common.h  |  6 +++
>  exec-vary.c            | 88 ++++++++++++++++++++++++++++++++++++++++++
>  exec.c                 | 34 ----------------
>  5 files changed, 123 insertions(+), 48 deletions(-)
>  create mode 100644 exec-vary.c
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>


Re: [PATCH 0/7] exec: Improve code for TARGET_PAGE_BITS_VARY
Posted by no-reply@patchew.org 4 years, 7 months ago
Patchew URL: https://patchew.org/QEMU/20190919232952.6382-1-richard.henderson@linaro.org/



Hi,

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

Message-id: 20190919232952.6382-1-richard.henderson@linaro.org
Subject: [PATCH 0/7] exec: Improve code for TARGET_PAGE_BITS_VARY
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 ===

From https://github.com/patchew-project/qemu
 * [new tag]         patchew/20190919232952.6382-1-richard.henderson@linaro.org -> patchew/20190919232952.6382-1-richard.henderson@linaro.org
Switched to a new branch 'test'
02b5da1 exec: Cache TARGET_PAGE_MASK for TARGET_PAGE_BITS_VARY
a7aca78 exec: Tidy TARGET_PAGE_ALIGN
daeccb0 exec: Promote TARGET_PAGE_MASK to target_long
265eec7 exec: Restrict TARGET_PAGE_BITS_VARY assert to CONFIG_DEBUG_TCG
583a7ed exec: Use const alias for TARGET_PAGE_BITS_VARY
a2dd788 exec: Split out variable page size support to exec-vary.c
cc49c84 exec: Use TARGET_PAGE_BITS_MIN for TLB flags

=== OUTPUT BEGIN ===
1/7 Checking commit cc49c847ff45 (exec: Use TARGET_PAGE_BITS_MIN for TLB flags)
2/7 Checking commit a2dd788d074f (exec: Split out variable page size support to exec-vary.c)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#32: 
new file mode 100644

total: 0 errors, 1 warnings, 125 lines checked

Patch 2/7 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
3/7 Checking commit 583a7eda4f9e (exec: Use const alias for TARGET_PAGE_BITS_VARY)
ERROR: externs should be avoided in .c files
#58: FILE: exec-vary.c:53:
+extern const TargetPageBits target_page

total: 1 errors, 0 warnings, 82 lines checked

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

4/7 Checking commit 265eec7a4f93 (exec: Restrict TARGET_PAGE_BITS_VARY assert to CONFIG_DEBUG_TCG)
5/7 Checking commit daeccb050033 (exec: Promote TARGET_PAGE_MASK to target_long)
6/7 Checking commit a7aca78b21b7 (exec: Tidy TARGET_PAGE_ALIGN)
7/7 Checking commit 02b5da125937 (exec: Cache TARGET_PAGE_MASK for TARGET_PAGE_BITS_VARY)
=== OUTPUT END ===

Test command exited with code: 1


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