qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] hax_enabled() cannot be called in vl.c
@ 2018-12-04 14:45 Peter Maydell
  2018-12-04 14:48 ` Paolo Bonzini
  2018-12-04 15:08 ` Thomas Huth
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Maydell @ 2018-12-04 14:45 UTC (permalink / raw)
  To: QEMU Developers; +Cc: Paolo Bonzini, Vincent Palatin, Daniel P. Berrange

In vl.c we do this:

    if (hax_enabled()) {
        hax_sync_vcpus();
    }

But hax_enabled() varies depending on CONFIG_HAX: if that is
not defined then it is "#define hax_enabled() (0)", otherwise
it is a function. And CONFIG_HAX is a per-target configuration
define, only set for i386-softmmu and x86_64-softmmu.

Unfortunately, Makefile.objs puts vl.o in common-obj-y, meaning it
is built once and used for each target. So we can't use anything
here that has a target-specific definition.


My guess is that this is why this travis job has failed:
 https://travis-ci.org/qemu/qemu/jobs/463302115

Undefined symbols for architecture x86_64:
  "_hax_enabled", referenced from:
      _qemu_main in vl.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [qemu-system-m68k] Error 1

(though it is a little odd that it has only just happened,
given that the code has been this way for some time AFAIK;
this may be a new config at the Travis end or a new target
we added to our Travis config.)


I'm not sure what the best fix is here -- perhaps following
how xen_enabled() works, where it is always defined as an
(inline) function which returns the xen_allowed bool.

kvm_enabled() does a similar thing to what hax_enabled() does,
but this works out OK because it takes care to avoid
providing the #define-to-0 implementation except in the
case where it is building a target-specific file for a
target where KVM is not enabled; for common files it
will provide the function prototype which will end up
linking to a stub implementation. So we could handle hax
like that too.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] hax_enabled() cannot be called in vl.c
  2018-12-04 14:45 [Qemu-devel] hax_enabled() cannot be called in vl.c Peter Maydell
@ 2018-12-04 14:48 ` Paolo Bonzini
  2018-12-04 15:08 ` Thomas Huth
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2018-12-04 14:48 UTC (permalink / raw)
  To: Peter Maydell, QEMU Developers; +Cc: Vincent Palatin, Daniel P. Berrange

On 04/12/18 15:45, Peter Maydell wrote:
> kvm_enabled() does a similar thing to what hax_enabled() does,
> but this works out OK because it takes care to avoid
> providing the #define-to-0 implementation except in the
> case where it is building a target-specific file for a
> target where KVM is not enabled; for common files it
> will provide the function prototype which will end up
> linking to a stub implementation. So we could handle hax
> like that too.

Yes, the KVM one is the correct way to do it.  The #define-to-0
implementation is used so that the compiler can optimize out more code,
the function acts as a fallback.

Paolo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] hax_enabled() cannot be called in vl.c
  2018-12-04 14:45 [Qemu-devel] hax_enabled() cannot be called in vl.c Peter Maydell
  2018-12-04 14:48 ` Paolo Bonzini
@ 2018-12-04 15:08 ` Thomas Huth
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Huth @ 2018-12-04 15:08 UTC (permalink / raw)
  To: Peter Maydell, QEMU Developers; +Cc: Paolo Bonzini, Vincent Palatin

On 2018-12-04 15:45, Peter Maydell wrote:
> In vl.c we do this:
> 
>     if (hax_enabled()) {
>         hax_sync_vcpus();
>     }
> 
> But hax_enabled() varies depending on CONFIG_HAX: if that is
> not defined then it is "#define hax_enabled() (0)", otherwise
> it is a function. And CONFIG_HAX is a per-target configuration
> define, only set for i386-softmmu and x86_64-softmmu.

I guess we should add CONFIG_HAX to include/exec/poison.h, just like
CONFIG_KVM can already be found there...?

 Thomas

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-12-04 15:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-04 14:45 [Qemu-devel] hax_enabled() cannot be called in vl.c Peter Maydell
2018-12-04 14:48 ` Paolo Bonzini
2018-12-04 15:08 ` Thomas Huth

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).