From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Phil Dennis-Jordan <lists@philjordan.eu>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
"Shukla, Santosh" <santosh.shukla@amd.com>,
Phil Dennis-Jordan <phil@philjordan.eu>,
qemu-devel@nongnu.org, kvm@vger.kernel.org, mtosatti@redhat.com,
suravee.suthikulpanit@amd.com
Subject: Re: [PATCH] i386/kvm: Fix kvm_enable_x2apic link error in non-KVM builds
Date: Fri, 29 Nov 2024 11:59:48 +0100 [thread overview]
Message-ID: <b89c0b9c-e12a-4915-b657-16d9ba297a86@linaro.org> (raw)
In-Reply-To: <CAGCz3vtxjKH0H8BL4ES_phNK8=Dy4Jzg3d7dLyNxuBQaSjTPQA@mail.gmail.com>
On 28/11/24 20:06, Phil Dennis-Jordan wrote:
> On Thu, 28 Nov 2024 at 17:46, Philippe Mathieu-Daudé <philmd@linaro.org
> <mailto:philmd@linaro.org>> wrote:
>
> On 28/11/24 17:38, Phil Dennis-Jordan wrote:
> > Paolo, could we please apply either Sairaj and Santosh's fix at
> > https://patchew.org/QEMU/20241114114509.15350-1-sarunkod@amd.com/
> <https://patchew.org/QEMU/20241114114509.15350-1-sarunkod@amd.com/>
> >
> <https://patchew.org/QEMU/20241114114509.15350-1-sarunkod@amd.com/
> <https://patchew.org/QEMU/20241114114509.15350-1-sarunkod@amd.com/>>
> > or mine to fix this link error? As neither patch has so far been
> merged,
> > 9.2.0-rc2 still fails to build on macOS, at least on my local
> systems.
> > I'm not sure why CI builds aren't jumping up and down about this,
> but
> > neither the Xcode 15.2 nor 16.1 toolchains are happy on macOS
> 14.7/arm64.
>
> Just curious, is your build configured with --enable-hvf --enable-tcg?
>
>
> It's my understanding that both HVF and TCG are enabled by default when
> building on macOS - they both show up as "YES" in the ./configure
> output, and the relevant -accel works; at any rate, specifying them
> explicitly made no difference with regard to this link error. Your
> question did however prompt me to dig a little deeper and check which of
> my test configurations was affected.
>
> It looks like the critical setting is --enable-debug. I think that
> changes the exact optimisation level (not -O0 but less aggressive than
> the default), so it's not unreasonable that this would change the
> compiler pass(es) for eliminating constant conditional branches.
>
> So yeah, when I build latest master/staging with --enable-debug on macOS
> and my --target-list includes x86_64, QEMU fails to link with an
> undefined symbol error for _kvm_enable_x2apic. This happens on both
> arm64 and x86-64 hosts, and with various Xcode 15.x and 16.y toolchains.
Indeed:
C compiler for the host machine: clang (clang 16.0.0 "Apple clang
version 16.0.0 (clang-1600.0.26.4)")
C linker for the host machine: clang ld64 1115.7.3
Host machine cpu family: aarch64
Host machine cpu: aarch64
Compilation
host CPU : aarch64
host endianness : little
C compiler : clang
Host C compiler : clang
C++ compiler : NO
Objective-C compiler : clang
Rust support : NO
CFLAGS : -g -O0
User defined options
optimization : 0
Undefined symbols for architecture arm64:
"_kvm_enable_x2apic", referenced from:
_amdvi_sysbus_realize in hw_i386_amd_iommu.c.o
ld: symbol(s) not found for architecture arm64
> I have to admit I'm personally not a big fan of relying on the optimiser
> for removing references to these symbols, but restructuring the
> conditional expression like in Sairaj and Santosh's patch seems to allow
> even the optimisation level used for debug builds to do it, so I guess I
> can't argue with the result. :-)
See related commit 9926cf34de5 ("target/i386: Allow elision of
kvm_enable_x2apic()").
prev parent reply other threads:[~2024-11-29 11:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-13 14:49 [PATCH] i386/kvm: Fix kvm_enable_x2apic link error in non-KVM builds Phil Dennis-Jordan
2024-11-13 18:06 ` Paolo Bonzini
2024-11-13 18:14 ` Phil Dennis-Jordan
2024-11-13 18:11 ` Paolo Bonzini
2024-11-13 18:25 ` Shukla, Santosh
2024-11-13 18:39 ` Paolo Bonzini
2024-11-13 18:40 ` Shukla, Santosh
2024-11-28 16:38 ` Phil Dennis-Jordan
2024-11-28 16:46 ` Philippe Mathieu-Daudé
2024-11-28 19:06 ` Phil Dennis-Jordan
2024-11-29 10:59 ` Philippe Mathieu-Daudé [this message]
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=b89c0b9c-e12a-4915-b657-16d9ba297a86@linaro.org \
--to=philmd@linaro.org \
--cc=kvm@vger.kernel.org \
--cc=lists@philjordan.eu \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=phil@philjordan.eu \
--cc=qemu-devel@nongnu.org \
--cc=santosh.shukla@amd.com \
--cc=suravee.suthikulpanit@amd.com \
/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).