mbox series

[v3,00/28] tcg: Clean up code_gen_buffer allocation

Message ID 20210502231844.1977630-1-richard.henderson@linaro.org
Headers show
Series tcg: Clean up code_gen_buffer allocation | expand

Message

Richard Henderson May 2, 2021, 11:18 p.m. UTC
Supercedes: <20210314212724.1917075-1-richard.henderson@linaro.org>
("tcg: Workaround macOS 11.2 mprotect bug")

Since I ran out of time at softfreeze, I put in a much smaller
patch to workaround the macOS bug.  But I think the cleanup is
still a good thing.


r~


Richard Henderson (28):
  meson: Split out tcg/meson.build
  meson: Split out fpu/meson.build
  tcg: Re-order tcg_region_init vs tcg_prologue_init
  tcg: Remove error return from tcg_region_initial_alloc__locked
  tcg: Split out tcg_region_initial_alloc
  tcg: Split out tcg_region_prologue_set
  tcg: Split out region.c
  accel/tcg: Inline cpu_gen_init
  accel/tcg: Move alloc_code_gen_buffer to tcg/region.c
  accel/tcg: Rename tcg_init to tcg_init_machine
  tcg: Create tcg_init
  accel/tcg: Merge tcg_exec_init into tcg_init_machine
  accel/tcg: Pass down max_cpus to tcg_init
  tcg: Introduce tcg_max_ctxs
  tcg: Move MAX_CODE_GEN_BUFFER_SIZE to tcg-target.h
  tcg: Replace region.end with region.total_size
  tcg: Rename region.start to region.after_prologue
  tcg: Tidy tcg_n_regions
  tcg: Tidy split_cross_256mb
  tcg: Move in_code_gen_buffer and tests to region.c
  tcg: Allocate code_gen_buffer into struct tcg_region_state
  tcg: Return the map protection from alloc_code_gen_buffer
  tcg: Sink qemu_madvise call to common code
  util/osdep: Add qemu_mprotect_rw
  tcg: Round the tb_size default from qemu_get_host_physmem
  tcg: Merge buffer protection and guard page protection
  tcg: When allocating for !splitwx, begin with PROT_NONE
  tcg: Move tcg_init_ctx and tcg_ctx from accel/tcg/

 meson.build               |  12 +-
 accel/tcg/internal.h      |   2 +
 include/qemu/osdep.h      |   1 +
 include/sysemu/tcg.h      |   2 -
 include/tcg/tcg.h         |  15 +-
 tcg/aarch64/tcg-target.h  |   1 +
 tcg/arm/tcg-target.h      |   1 +
 tcg/i386/tcg-target.h     |   2 +
 tcg/internal.h            |  40 ++
 tcg/mips/tcg-target.h     |   6 +
 tcg/ppc/tcg-target.h      |   2 +
 tcg/riscv/tcg-target.h    |   1 +
 tcg/s390/tcg-target.h     |   3 +
 tcg/sparc/tcg-target.h    |   1 +
 tcg/tci/tcg-target.h      |   1 +
 accel/tcg/tcg-all.c       |  33 +-
 accel/tcg/translate-all.c | 439 +----------------
 bsd-user/main.c           |   1 -
 linux-user/main.c         |   1 -
 tcg/region.c              | 994 ++++++++++++++++++++++++++++++++++++++
 tcg/tcg.c                 | 636 ++----------------------
 util/osdep.c              |   9 +
 fpu/meson.build           |   1 +
 tcg/meson.build           |  14 +
 24 files changed, 1141 insertions(+), 1077 deletions(-)
 create mode 100644 tcg/internal.h
 create mode 100644 tcg/region.c
 create mode 100644 fpu/meson.build
 create mode 100644 tcg/meson.build

-- 
2.25.1

Comments

no-reply@patchew.org May 2, 2021, 11:45 p.m. UTC | #1
Patchew URL: https://patchew.org/QEMU/20210502231844.1977630-1-richard.henderson@linaro.org/



Hi,

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

Type: series
Message-id: 20210502231844.1977630-1-richard.henderson@linaro.org
Subject: [PATCH v3 00/28] tcg: Clean up code_gen_buffer allocation

=== 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
From https://github.com/patchew-project/qemu
 - [tag update]      patchew/20210502203121.630944-1-f4bug@amsat.org -> patchew/20210502203121.630944-1-f4bug@amsat.org
 * [new tag]         patchew/20210502231844.1977630-1-richard.henderson@linaro.org -> patchew/20210502231844.1977630-1-richard.henderson@linaro.org
Switched to a new branch 'test'
90c895a tcg: Move tcg_init_ctx and tcg_ctx from accel/tcg/
bd4b7e6 tcg: When allocating for !splitwx, begin with PROT_NONE
6c3fca5 tcg: Merge buffer protection and guard page protection
881f465 tcg: Round the tb_size default from qemu_get_host_physmem
c613555 util/osdep: Add qemu_mprotect_rw
7181589 tcg: Sink qemu_madvise call to common code
927d8ef tcg: Return the map protection from alloc_code_gen_buffer
fb1818a tcg: Allocate code_gen_buffer into struct tcg_region_state
65ba08d tcg: Move in_code_gen_buffer and tests to region.c
775e3d1 tcg: Tidy split_cross_256mb
9969419 tcg: Tidy tcg_n_regions
65bab84 tcg: Rename region.start to region.after_prologue
b2a89e5 tcg: Replace region.end with region.total_size
2fb4252 tcg: Move MAX_CODE_GEN_BUFFER_SIZE to tcg-target.h
8004c58 tcg: Introduce tcg_max_ctxs
15f8347 accel/tcg: Pass down max_cpus to tcg_init
1d47d06 accel/tcg: Merge tcg_exec_init into tcg_init_machine
1a2a487 tcg: Create tcg_init
6181802 accel/tcg: Rename tcg_init to tcg_init_machine
e8e04cf accel/tcg: Move alloc_code_gen_buffer to tcg/region.c
fee9dae accel/tcg: Inline cpu_gen_init
8b0b72d tcg: Split out region.c
8a7104c tcg: Split out tcg_region_prologue_set
789ec41 tcg: Split out tcg_region_initial_alloc
59a907e tcg: Remove error return from tcg_region_initial_alloc__locked
3d48515 tcg: Re-order tcg_region_init vs tcg_prologue_init
a520997 meson: Split out fpu/meson.build
6395bac meson: Split out tcg/meson.build

=== OUTPUT BEGIN ===
1/28 Checking commit 6395bacefeea (meson: Split out tcg/meson.build)
Use of uninitialized value $acpi_testexpected in string eq at ./scripts/checkpatch.pl line 1529.
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#43: 
new file mode 100644

total: 0 errors, 1 warnings, 34 lines checked

Patch 1/28 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
2/28 Checking commit a5209975fb87 (meson: Split out fpu/meson.build)
Use of uninitialized value $acpi_testexpected in string eq at ./scripts/checkpatch.pl line 1529.
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#16: 
new file mode 100644

total: 0 errors, 1 warnings, 17 lines checked

Patch 2/28 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
3/28 Checking commit 3d485153281b (tcg: Re-order tcg_region_init vs tcg_prologue_init)
4/28 Checking commit 59a907e5bd40 (tcg: Remove error return from tcg_region_initial_alloc__locked)
5/28 Checking commit 789ec419187b (tcg: Split out tcg_region_initial_alloc)
6/28 Checking commit 8a7104cabb75 (tcg: Split out tcg_region_prologue_set)
7/28 Checking commit 8b0b72d6ce90 (tcg: Split out region.c)
Use of uninitialized value $acpi_testexpected in string eq at ./scripts/checkpatch.pl line 1529.
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#17: 
new file mode 100644

total: 0 errors, 1 warnings, 1193 lines checked

Patch 7/28 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
8/28 Checking commit fee9dae6f704 (accel/tcg: Inline cpu_gen_init)
9/28 Checking commit e8e04cff5772 (accel/tcg: Move alloc_code_gen_buffer to tcg/region.c)
WARNING: Block comments use a leading /* on a separate line
#499: FILE: tcg/region.c:411:
+/* Minimum size of the code gen buffer.  This number is randomly chosen,

WARNING: Block comments use * on subsequent lines
#500: FILE: tcg/region.c:412:
+/* Minimum size of the code gen buffer.  This number is randomly chosen,
+   but not so small that we can't have a fair number of TB's live.  */

WARNING: Block comments use a trailing */ on a separate line
#500: FILE: tcg/region.c:412:
+   but not so small that we can't have a fair number of TB's live.  */

WARNING: Block comments use a leading /* on a separate line
#503: FILE: tcg/region.c:415:
+/* Maximum size of the code gen buffer we'd like to use.  Unless otherwise

WARNING: Block comments use * on subsequent lines
#504: FILE: tcg/region.c:416:
+/* Maximum size of the code gen buffer we'd like to use.  Unless otherwise
+   indicated, this is constrained by the range of direct branches on the

WARNING: Block comments use a trailing */ on a separate line
#505: FILE: tcg/region.c:417:
+   host cpu, as used by the TCG implementation of goto_tb.  */

WARNING: architecture specific defines should be avoided
#506: FILE: tcg/region.c:418:
+#if defined(__x86_64__)

WARNING: Block comments use a leading /* on a separate line
#520: FILE: tcg/region.c:432:
+  /* We have a 256MB branch region, but leave room to make sure the

WARNING: Block comments use * on subsequent lines
#521: FILE: tcg/region.c:433:
+  /* We have a 256MB branch region, but leave room to make sure the
+     main executable is also within that region.  */

WARNING: Block comments use a trailing */ on a separate line
#521: FILE: tcg/region.c:433:
+     main executable is also within that region.  */

WARNING: architecture specific defines should be avoided
#579: FILE: tcg/region.c:491:
+#ifdef __mips__

WARNING: Block comments use a leading /* on a separate line
#580: FILE: tcg/region.c:492:
+/* In order to use J and JAL within the code_gen_buffer, we require

WARNING: Block comments use * on subsequent lines
#581: FILE: tcg/region.c:493:
+/* In order to use J and JAL within the code_gen_buffer, we require
+   that the buffer not cross a 256MB boundary.  */

WARNING: Block comments use a trailing */ on a separate line
#581: FILE: tcg/region.c:493:
+   that the buffer not cross a 256MB boundary.  */

WARNING: Block comments use a leading /* on a separate line
#587: FILE: tcg/region.c:499:
+/* We weren't able to allocate a buffer without crossing that boundary,

WARNING: Block comments use * on subsequent lines
#588: FILE: tcg/region.c:500:
+/* We weren't able to allocate a buffer without crossing that boundary,
+   so make do with the larger portion of the buffer that doesn't cross.

WARNING: Block comments use a trailing */ on a separate line
#589: FILE: tcg/region.c:501:
+   Returns the new base of the buffer, and adjusts code_gen_buffer_size.  */

WARNING: architecture specific defines should be avoided
#634: FILE: tcg/region.c:546:
+#ifdef __mips__

WARNING: architecture specific defines should be avoided
#686: FILE: tcg/region.c:598:
+#ifdef __mips__

WARNING: architecture specific defines should be avoided
#736: FILE: tcg/region.c:648:
+#ifdef __mips__

WARNING: architecture specific defines should be avoided
#753: FILE: tcg/region.c:665:
+#ifdef __mips__

ERROR: externs should be avoided in .c files
#795: FILE: tcg/region.c:707:
+extern kern_return_t mach_vm_remap(vm_map_t target_task,

total: 1 errors, 21 warnings, 894 lines checked

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

10/28 Checking commit 61818023793b (accel/tcg: Rename tcg_init to tcg_init_machine)
11/28 Checking commit 1a2a48753d74 (tcg: Create tcg_init)
12/28 Checking commit 1d47d06c6a0d (accel/tcg: Merge tcg_exec_init into tcg_init_machine)
WARNING: Block comments use a leading /* on a separate line
#56: FILE: accel/tcg/tcg-all.c:121:
+    /* There's no guest base to take into account, so go ahead and

WARNING: Block comments use * on subsequent lines
#57: FILE: accel/tcg/tcg-all.c:122:
+    /* There's no guest base to take into account, so go ahead and
+       initialize the prologue now.  */

WARNING: Block comments use a trailing */ on a separate line
#57: FILE: accel/tcg/tcg-all.c:122:
+       initialize the prologue now.  */

total: 0 errors, 3 warnings, 81 lines checked

Patch 12/28 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
13/28 Checking commit 15f8347db19c (accel/tcg: Pass down max_cpus to tcg_init)
14/28 Checking commit 8004c5888eea (tcg: Introduce tcg_max_ctxs)
15/28 Checking commit 2fb425228829 (tcg: Move MAX_CODE_GEN_BUFFER_SIZE to tcg-target.h)
16/28 Checking commit b2a89e54913c (tcg: Replace region.end with region.total_size)
17/28 Checking commit 65bab845b719 (tcg: Rename region.start to region.after_prologue)
18/28 Checking commit 996941940020 (tcg: Tidy tcg_n_regions)
19/28 Checking commit 775e3d13fe7c (tcg: Tidy split_cross_256mb)
20/28 Checking commit 65ba08d6bf29 (tcg: Move in_code_gen_buffer and tests to region.c)
21/28 Checking commit fb1818a3317d (tcg: Allocate code_gen_buffer into struct tcg_region_state)
22/28 Checking commit 927d8ef4984a (tcg: Return the map protection from alloc_code_gen_buffer)
23/28 Checking commit 7181589f87d9 (tcg: Sink qemu_madvise call to common code)
24/28 Checking commit c6135556315a (util/osdep: Add qemu_mprotect_rw)
25/28 Checking commit 881f4653f709 (tcg: Round the tb_size default from qemu_get_host_physmem)
26/28 Checking commit 6c3fca533a5b (tcg: Merge buffer protection and guard page protection)
27/28 Checking commit bd4b7e6f6ed9 (tcg: When allocating for !splitwx, begin with PROT_NONE)
28/28 Checking commit 90c895a44fa3 (tcg: Move tcg_init_ctx and tcg_ctx from accel/tcg/)
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20210502231844.1977630-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