|
From: | Philippe Mathieu-Daudé |
Subject: | Re: [PATCH] Revert "cputlb: Restrict SavedIOTLB to system emulation" |
Date: | Wed, 21 Jun 2023 12:57:54 +0200 |
User-agent: | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 |
On 21/6/23 11:39, Philippe Mathieu-Daudé wrote:
On 21/6/23 07:19, Richard Henderson wrote:On 6/20/23 19:57, Peter Maydell wrote:This reverts commit d7ee93e24359703debf4137f4cc632563aa4e8d1. That commit tries to make a field in the CPUState struct not be present when CONFIG_USER_ONLY is set. Unfortunately, you can't conditionally omit fields in structs like this based on ifdefs that are set per-target. If you try it, then code in files compiled per-target (where CONFIG_USER_ONLY is or can be set) will disagree about the struct layout with files that are compiled once-only (where this kind of ifdef is never set).Oops, sorry.This manifests specifically in 'make check-tcg' failing, because code in cpus-common.c that sets up the CPUState::cpu_index field puts it at a different offset from the code in plugins/core.c in qemu_plugin_vcpu_init_hook() which reads the cpu_index field. The latter then hits an assert because from its point of view every thread has a 0 cpu_index. There might be other weird behaviour too.Why isn't this covered by CI, and where could we add a such check?
Actually it is covered and failed on staging: https://gitlab.com/qemu-project/qemu/-/jobs/4503766933 Anyhow, sorry for the mess.
Mostly we catch this kind of bug because the CONFIG_whatever is listed in include/exec/poison.h and so the reference to it in build-once source files will then cause a compiler error. Unfortunately CONFIG_USER_ONLY is an exception to that: we have some places where we use it in "safe" ways in headers that will be seen by once-only source files (e.g. ifdeffing out function prototypes) and it would be a lot of refactoring to be able to get to a position where we could poison it. This leaves us in a "you have to be careful to walk around the bear trap" situation... Fixes: d7ee93e243597 ("cputlb: Restrict SavedIOTLB to system emulation") Signed-off-by: Peter Maydell <peter.maydell@linaro.org> --- include/hw/core/cpu.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)Ho hum, thanks. I'll apply this directly.Thanks both.
[Prev in Thread] | Current Thread | [Next in Thread] |