From: Richard Henderson <richard.henderson@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Cc: anjo@rev.ng, ale@rev.ng
Subject: Re: [PATCH v2 13/24] accel/tcg: Replace CPUState.env_ptr with cpu_env()
Date: Thu, 14 Sep 2023 11:15:57 -0700 [thread overview]
Message-ID: <a4ab6acb-3db0-23db-b728-b779698f1ab0@linaro.org> (raw)
In-Reply-To: <c606e0d9-c164-11da-8ae1-9a602459961c@linaro.org>
On 9/14/23 11:12, Philippe Mathieu-Daudé wrote:
> On 14/9/23 04:44, Richard Henderson wrote:
>> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>> ---
>> include/exec/cpu-all.h | 1 -
>> include/hw/core/cpu.h | 9 ++++++---
>> target/arm/common-semi-target.h | 2 +-
>> accel/tcg/cpu-exec.c | 8 ++++----
>> accel/tcg/cputlb.c | 18 +++++++++---------
>> accel/tcg/translate-all.c | 4 ++--
>> gdbstub/gdbstub.c | 4 ++--
>> gdbstub/user-target.c | 2 +-
>> hw/i386/kvm/clock.c | 2 +-
>> hw/intc/mips_gic.c | 2 +-
>> hw/intc/riscv_aclint.c | 12 ++++++------
>> hw/intc/riscv_imsic.c | 2 +-
>> hw/ppc/e500.c | 4 ++--
>> hw/ppc/spapr.c | 2 +-
>> linux-user/elfload.c | 4 ++--
>> linux-user/i386/cpu_loop.c | 2 +-
>> linux-user/main.c | 4 ++--
>> linux-user/signal.c | 15 +++++++--------
>> monitor/hmp-cmds-target.c | 2 +-
>> semihosting/arm-compat-semi.c | 6 +++---
>> semihosting/syscalls.c | 28 ++++++++++++++--------------
>> target/alpha/translate.c | 4 ++--
>> target/arm/cpu.c | 8 ++++----
>> target/arm/helper.c | 2 +-
>> target/arm/tcg/translate-a64.c | 4 ++--
>> target/arm/tcg/translate.c | 6 +++---
>> target/avr/translate.c | 2 +-
>> target/cris/translate.c | 4 ++--
>> target/hexagon/translate.c | 4 ++--
>> target/hppa/mem_helper.c | 2 +-
>> target/hppa/translate.c | 4 ++--
>> target/i386/tcg/sysemu/excp_helper.c | 2 +-
>> target/i386/tcg/tcg-cpu.c | 2 +-
>> target/i386/tcg/translate.c | 4 ++--
>> target/loongarch/translate.c | 4 ++--
>> target/m68k/translate.c | 4 ++--
>> target/microblaze/translate.c | 2 +-
>> target/mips/tcg/sysemu/mips-semi.c | 4 ++--
>> target/mips/tcg/translate.c | 4 ++--
>> target/nios2/translate.c | 4 ++--
>> target/openrisc/translate.c | 2 +-
>> target/ppc/excp_helper.c | 10 +++++-----
>> target/ppc/translate.c | 4 ++--
>> target/riscv/translate.c | 6 +++---
>> target/rx/cpu.c | 3 ---
>> target/rx/translate.c | 2 +-
>> target/s390x/tcg/translate.c | 2 +-
>> target/sh4/op_helper.c | 2 +-
>> target/sh4/translate.c | 4 ++--
>> target/sparc/translate.c | 4 ++--
>> target/tricore/translate.c | 4 ++--
>> target/xtensa/translate.c | 4 ++--
>> target/i386/tcg/decode-new.c.inc | 2 +-
>> 53 files changed, 125 insertions(+), 127 deletions(-)
>>
>> diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
>> index ae0cb2ce50..40831122ce 100644
>> --- a/include/exec/cpu-all.h
>> +++ b/include/exec/cpu-all.h
>> @@ -433,7 +433,6 @@ void tcg_exec_unrealizefn(CPUState *cpu);
>> */
>> static inline void cpu_set_cpustate_pointers(ArchCPU *cpu)
>> {
>> - cpu->parent_obj.env_ptr = &cpu->env;
>> }
>> /* Validate correct placement of CPUArchState. */
>> diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
>> index 99066da2f3..f3fa1ffa95 100644
>> --- a/include/hw/core/cpu.h
>> +++ b/include/hw/core/cpu.h
>> @@ -440,7 +440,6 @@ struct qemu_work_item;
>> * @num_ases: number of CPUAddressSpaces in @cpu_ases
>> * @as: Pointer to the first AddressSpace, for the convenience of targets which
>> * only have a single AddressSpace
>> - * @env_ptr: Pointer to subclass-specific CPUArchState field.
>> * @gdb_regs: Additional GDB registers.
>> * @gdb_num_regs: Number of total registers accessible to GDB.
>> * @gdb_num_g_regs: Number of registers in GDB 'g' packets.
>> @@ -511,8 +510,6 @@ struct CPUState {
>> AddressSpace *as;
>> MemoryRegion *memory;
>> - CPUArchState *env_ptr;
>> -
>> CPUJumpCache *tb_jmp_cache;
>> struct GDBRegisterState *gdb_regs;
>> @@ -594,6 +591,12 @@ struct CPUState {
>> QEMU_BUILD_BUG_ON(offsetof(CPUState, neg) + sizeof(CPUNegativeOffsetState)
>> != sizeof(CPUState));
>> +static inline CPUArchState *cpu_env(CPUState *cpu)
>> +{
>> + /* We validate that CPUArchState follows CPUState in cpu-all.h. */
>> + return (CPUArchState *)(cpu + 1);
>> +}
>
> Do we also need to remove this check?
>
> -- >8 --
> diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
> index 40831122ce..3d87548f9b 100644
> --- a/include/exec/cpu-all.h
> +++ b/include/exec/cpu-all.h
> @@ -437,7 +437,6 @@ static inline void cpu_set_cpustate_pointers(ArchCPU *cpu)
>
> /* Validate correct placement of CPUArchState. */
> QEMU_BUILD_BUG_ON(offsetof(ArchCPU, parent_obj) != 0);
> -QEMU_BUILD_BUG_ON(offsetof(ArchCPU, env) != sizeof(CPUState));
>
> /**
> * env_archcpu(env)
> ---
>
> I'm getting:
>
> include/qemu/compiler.h:74:36: error: static assertion failed: "not expecting:
> offsetof(ArchCPU, env) != sizeof(CPUState)"
> 74 | #define QEMU_BUILD_BUG_MSG(x, msg) _Static_assert(!(x), msg)
> | ^~~~~~~~~~~~~~
> include/qemu/compiler.h:76:30: note: in expansion of macro ‘QEMU_BUILD_BUG_MSG’
> 76 | #define QEMU_BUILD_BUG_ON(x) QEMU_BUILD_BUG_MSG(x, "not expecting: " #x)
> | ^~~~~~~~~~~~~~~~~~
> include/exec/cpu-all.h:440:1: note: in expansion of macro ‘QEMU_BUILD_BUG_ON’
> 440 | QEMU_BUILD_BUG_ON(offsetof(ArchCPU, env) != sizeof(CPUState));
> | ^~~~~~~~~~~~~~~~~
> ninja: build stopped: subcommand failed.
>
I presume this is --disable-tcg, since I saw the same thing in CI testing.
No, we don't remove the check (that would explicit assumptions elsewhere), we adjust the
alignment of CPUNegativeOffsetState.
r~
next prev parent reply other threads:[~2023-09-14 18:17 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-14 2:44 [PATCH v2 00/24] Reduce usage of CPUArchState in cputlb.c Richard Henderson
2023-09-14 2:44 ` [PATCH v2 01/24] target/arm: Replace TARGET_PAGE_ENTRY_EXTRA Richard Henderson
2023-09-14 2:44 ` [PATCH v2 02/24] accel/tcg: Move CPUTLB definitions from cpu-defs.h Richard Henderson
2023-09-14 10:47 ` Anton Johansson via
2023-09-14 2:44 ` [PATCH v2 03/24] qom: Propagate alignment through type system Richard Henderson
2023-09-14 5:59 ` Philippe Mathieu-Daudé
2023-09-14 2:44 ` [PATCH v2 04/24] target/*: Use __alignof not __alignof__ Richard Henderson
2023-09-14 6:01 ` Philippe Mathieu-Daudé
2023-09-14 2:44 ` [PATCH v2 05/24] target/arm: Remove size and alignment for cpu subclasses Richard Henderson
2023-09-14 6:02 ` Philippe Mathieu-Daudé
2023-09-14 2:44 ` [PATCH v2 06/24] target/*: Add instance_align to all cpu base classes Richard Henderson
2023-09-14 6:04 ` Philippe Mathieu-Daudé
2023-09-14 2:44 ` [PATCH v2 07/24] accel/tcg: Validate placement of CPUNegativeOffsetState Richard Henderson
2023-09-14 10:19 ` Anton Johansson via
2023-09-14 2:44 ` [PATCH v2 08/24] accel/tcg: Move CPUNegativeOffsetState into CPUState Richard Henderson
2023-09-14 10:24 ` Anton Johansson via
2023-09-14 2:44 ` [PATCH v2 09/24] accel/tcg: Remove CPUState.icount_decr_ptr Richard Henderson
2023-09-14 10:28 ` Anton Johansson via
2023-09-14 2:44 ` [PATCH v2 10/24] accel/tcg: Move can_do_io to CPUNegativeOffsetState Richard Henderson
2023-09-14 6:08 ` Philippe Mathieu-Daudé
2023-09-14 2:44 ` [PATCH v2 11/24] accel/tcg: Remove cpu_neg() Richard Henderson
2023-09-14 6:08 ` Philippe Mathieu-Daudé
2023-09-14 2:44 ` [PATCH v2 12/24] tcg: Rename cpu_env to tcg_env Richard Henderson
2023-09-14 6:10 ` Philippe Mathieu-Daudé
2023-09-14 15:30 ` Philippe Mathieu-Daudé
2023-09-14 2:44 ` [PATCH v2 13/24] accel/tcg: Replace CPUState.env_ptr with cpu_env() Richard Henderson
2023-09-14 10:38 ` Anton Johansson via
2023-09-14 18:12 ` Philippe Mathieu-Daudé
2023-09-14 18:15 ` Richard Henderson [this message]
2023-09-14 18:38 ` Philippe Mathieu-Daudé
2023-09-14 18:53 ` Richard Henderson
2023-09-14 2:44 ` [PATCH v2 14/24] accel/tcg: Remove cpu_set_cpustate_pointers Richard Henderson
2023-09-14 6:12 ` Philippe Mathieu-Daudé
2023-09-14 2:44 ` [PATCH v2 15/24] accel/tcg: Remove env_neg() Richard Henderson
2023-09-14 10:39 ` Anton Johansson via
2023-09-14 2:44 ` [PATCH v2 16/24] tcg: Remove TCGContext.tlb_fast_offset Richard Henderson
2023-09-14 10:43 ` Anton Johansson via
2023-09-14 2:44 ` [PATCH v2 17/24] accel/tcg: Modify tlb_*() to use CPUState Richard Henderson
2023-09-14 2:44 ` [PATCH v2 18/24] accel/tcg: Modify probe_access_internal() " Richard Henderson
2023-09-14 6:15 ` Philippe Mathieu-Daudé
2023-09-14 2:44 ` [PATCH v2 19/24] accel/tcg: Modifies memory access functions " Richard Henderson
2023-09-14 6:18 ` Philippe Mathieu-Daudé
2023-09-14 2:44 ` [PATCH v2 20/24] accel/tcg: Modify atomic_mmu_lookup() " Richard Henderson
2023-09-14 6:20 ` Philippe Mathieu-Daudé
2023-09-14 2:44 ` [PATCH v2 21/24] accel/tcg: Use CPUState in atomicity helpers Richard Henderson
2023-09-14 6:22 ` Philippe Mathieu-Daudé
2023-09-14 2:44 ` [PATCH v2 22/24] accel/tcg: Remove env_tlb() Richard Henderson
2023-09-14 15:44 ` Philippe Mathieu-Daudé
2023-09-14 16:24 ` Anton Johansson via
2023-09-14 2:44 ` [PATCH v2 23/24] accel/tcg: Unify user and softmmu do_[st|ld]*_mmu() Richard Henderson
2023-09-14 2:44 ` [PATCH v2 24/24] accel/tcg: move ld/st helpers to ldst_common.c.inc Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a4ab6acb-3db0-23db-b728-b779698f1ab0@linaro.org \
--to=richard.henderson@linaro.org \
--cc=ale@rev.ng \
--cc=anjo@rev.ng \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).