On Thu, Jul 05, 2018 at 09:54:30AM +0200, Greg Kurz wrote: > It is unsafe to rely on *_enabled() helpers before the accelerator has > been initialized, ie, accel_init_machine() has succeeded, because they > always return false. But it is still possible to end up calling them > indirectly by inadvertance, and cause QEMU to misbehave. > > This patch causes QEMU to abort if we try to check for any accelerator > before accel_init_machine() was called. This will help to catch bugs > earlier. > > Signed-off-by: Greg Kurz <gr...@kaod.org> > --- > > Current master (SHA1 2a018f6e9878) has such a kvm_enabled() misuse that > triggers the assert: > > https://travis-ci.org/gkurz/qemu/jobs/400059821#L8709 > > The fix for the misuse is available, waiting to be merged: > > https://patchwork.ozlabs.org/patch/938077/ > > v3: - use an inline function > - convert all accelerators > - dropped David's R-b > > v2: - dropped change in qom/cpu.c (useless header inclusion) > - only #include "sysemu/kvm.h" if we actually need it > - added David's R-b from v1 because changes in v2 are minor > --- > accel/accel.c | 4 ++++ > include/hw/xen/xen.h | 3 ++- > include/qemu-common.h | 3 ++- > include/sysemu/accel.h | 8 ++++++++ > include/sysemu/hvf.h | 3 ++- > include/sysemu/kvm.h | 3 ++- > include/sysemu/qtest.h | 3 ++- > stubs/Makefile.objs | 1 + > stubs/accel.c | 12 ++++++++++++ > target/i386/hax-all.c | 2 +- > target/i386/whpx-all.c | 2 +- > tests/ptimer-test-stubs.c | 2 ++ > 12 files changed, 39 insertions(+), 7 deletions(-) > create mode 100644 stubs/accel.c
Reviewed-by: Stefan Hajnoczi <stefa...@redhat.com>
signature.asc
Description: PGP signature