From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: qemu-devel@nongnu.org, "Peter Maydell" <peter.maydell@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
qemu-arm@nongnu.org, "Maxim Levitsky" <mlevitsk@redhat.com>,
libvir-list@redhat.com,
"Richard Henderson" <richard.henderson@linaro.org>,
xen-devel@lists.xenproject.org,
"Reinoud Zandijk" <reinoud@netbsd.org>,
"Wilfred Mallawa" <wilfred.mallawa@wdc.com>,
"John Paul Adrian Glaubitz" <glaubitz@physik.fu-berlin.de>
Subject: Re: [PATCH v4 2/5] docs/about/deprecated: Deprecate the qemu-system-i386 binary
Date: Mon, 6 Mar 2023 09:58:01 +0000 [thread overview]
Message-ID: <ZAW5KffNsA6/N87B@redhat.com> (raw)
In-Reply-To: <e5a86d76-03af-6da9-a8ee-da4a494e0e23@redhat.com>
On Mon, Mar 06, 2023 at 10:54:15AM +0100, Thomas Huth wrote:
> On 06/03/2023 10.27, Daniel P. Berrangé wrote:
> > On Mon, Mar 06, 2023 at 09:46:55AM +0100, Thomas Huth wrote:
> > > Aside from not supporting KVM on 32-bit hosts, the qemu-system-x86_64
> > > binary is a proper superset of the qemu-system-i386 binary. With the
> > > 32-bit host support being deprecated, it is now also possible to
> > > deprecate the qemu-system-i386 binary.
> > >
> > > With regards to 32-bit KVM support in the x86 Linux kernel,
> > > the developers confirmed that they do not need a recent
> > > qemu-system-i386 binary here:
> > >
> > > https://lore.kernel.org/kvm/Y%2ffkTs5ajFy0hP1U@google.com/
> > >
> > > Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> > > Reviewed-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
> > > Signed-off-by: Thomas Huth <thuth@redhat.com>
> > > ---
> > > docs/about/deprecated.rst | 14 ++++++++++++++
> > > 1 file changed, 14 insertions(+)
> > >
> > > diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
> > > index 1ca9dc33d6..c4fcc6b33c 100644
> > > --- a/docs/about/deprecated.rst
> > > +++ b/docs/about/deprecated.rst
> > > @@ -34,6 +34,20 @@ deprecating the build option and no longer defend it in CI. The
> > > ``--enable-gcov`` build option remains for analysis test case
> > > coverage.
> > > +``qemu-system-i386`` binary (since 8.0)
> > > +'''''''''''''''''''''''''''''''''''''''
> > > +
> > > +The ``qemu-system-i386`` binary was mainly useful for running with KVM
> > > +on 32-bit x86 hosts, but most Linux distributions already removed their
> > > +support for 32-bit x86 kernels, so hardly anybody still needs this. The
> > > +``qemu-system-x86_64`` binary is a proper superset and can be used to
> > > +run 32-bit guests by selecting a 32-bit CPU model, including KVM support
> > > +on x86_64 hosts. Thus users are recommended to reconfigure their systems
> > > +to use the ``qemu-system-x86_64`` binary instead. If a 32-bit CPU guest
> > > +environment should be enforced, you can switch off the "long mode" CPU
> > > +flag, e.g. with ``-cpu max,lm=off``.
> >
> > I had the idea to check this today and this is not quite sufficient,
> > because we have code that changes the family/model/stepping for
> > 'max' which is target dependent:
> >
> > #ifdef TARGET_X86_64
> > object_property_set_int(OBJECT(cpu), "family", 15, &error_abort);
> > object_property_set_int(OBJECT(cpu), "model", 107, &error_abort);
> > object_property_set_int(OBJECT(cpu), "stepping", 1, &error_abort);
> > #else
> > object_property_set_int(OBJECT(cpu), "family", 6, &error_abort);
> > object_property_set_int(OBJECT(cpu), "model", 6, &error_abort);
> > object_property_set_int(OBJECT(cpu), "stepping", 3, &error_abort);
> > #endif
> >
> > The former is a 64-bit AMD model and the latter is a 32-bit model.
> >
> > Seems LLVM was sensitive to this distinction to some extent:
> >
> > https://gitlab.com/qemu-project/qemu/-/issues/191
> >
> > A further difference is that qemy-system-i686 does not appear to enable
> > the 'syscall' flag, but I've not figured out where that difference is
> > coming from in the code.
>
> Ugh, ok. I gave it a quick try with a patch like this:
>
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -4344,15 +4344,15 @@ static void max_x86_cpu_initfn(Object *obj)
> */
> object_property_set_str(OBJECT(cpu), "vendor", CPUID_VENDOR_AMD,
> &error_abort);
> -#ifdef TARGET_X86_64
> - object_property_set_int(OBJECT(cpu), "family", 15, &error_abort);
> - object_property_set_int(OBJECT(cpu), "model", 107, &error_abort);
> - object_property_set_int(OBJECT(cpu), "stepping", 1, &error_abort);
> -#else
> - object_property_set_int(OBJECT(cpu), "family", 6, &error_abort);
> - object_property_set_int(OBJECT(cpu), "model", 6, &error_abort);
> - object_property_set_int(OBJECT(cpu), "stepping", 3, &error_abort);
> -#endif
> + if (object_property_get_bool(obj, "lm", &error_abort)) {
> + object_property_set_int(obj, "family", 15, &error_abort);
> + object_property_set_int(obj, "model", 107, &error_abort);
> + object_property_set_int(obj, "stepping", 1, &error_abort);
> + } else {
> + object_property_set_int(obj, "family", 6, &error_abort);
> + object_property_set_int(obj, "model", 6, &error_abort);
> + object_property_set_int(obj, "stepping", 3, &error_abort);
> + }
> object_property_set_str(OBJECT(cpu), "model-id",
> "QEMU TCG CPU version " QEMU_HW_VERSION,
> &error_abort);
>
> ... but it seems like the "lm" property is not initialized
> there yet, so this does not work... :-/
>
> Giving that we have soft-freeze tomorrow, let's ignore this patch
> for now and revisit this topic during the 8.1 cycle. But I'll
> queue the other 4 patches to get some pressure out of our CI
> during the freeze time.
Yep, makes sense.
More generally the whole impl of the 'max' CPU feels somewhat
questionable even for qemu-system-i386. It exposes all features
that TCG supports. A large set of these features never existed
on *any* 32-bit silicon. Hands up who has seen 32-bit silicon
with AVX2 support ? From a correctness POV we should have
capped CPU features in some manner. Given the lack of interest
in 32-bit though, we've ignored the problem and it likely does
not affect apps anyway as they're not likely to be looking for
newish features.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2023-03-06 9:58 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-06 8:46 [PATCH v4 0/5] Deprecate system emulation support for 32-bit x86 and arm hosts Thomas Huth
2023-03-06 8:46 ` [PATCH v4 1/5] docs/about/deprecated: Deprecate 32-bit x86 hosts for system emulation Thomas Huth
2023-03-06 8:46 ` [PATCH v4 2/5] docs/about/deprecated: Deprecate the qemu-system-i386 binary Thomas Huth
2023-03-06 9:27 ` Daniel P. Berrangé
2023-03-06 9:54 ` Thomas Huth
2023-03-06 9:58 ` Daniel P. Berrangé [this message]
2023-03-06 13:48 ` Thomas Huth
2023-03-06 14:06 ` Daniel P. Berrangé
2023-03-06 14:18 ` Thomas Huth
2023-03-06 14:25 ` Daniel P. Berrangé
2023-03-06 14:58 ` Daniel P. Berrangé
2023-03-06 14:56 ` Philippe Mathieu-Daudé
2023-03-06 8:46 ` [PATCH v4 3/5] gitlab-ci.d/crossbuilds: Drop the i386 system emulation job Thomas Huth
2023-03-06 9:19 ` Philippe Mathieu-Daudé
2023-03-06 8:46 ` [PATCH v4 4/5] docs/about/deprecated: Deprecate 32-bit arm hosts for system emulation Thomas Huth
2023-03-06 9:23 ` Philippe Mathieu-Daudé
2023-03-07 2:43 ` Richard Henderson
2023-03-06 8:46 ` [PATCH v4 5/5] gitlab-ci.d/crossbuilds: Drop the 32-bit arm system emulation jobs Thomas Huth
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=ZAW5KffNsA6/N87B@redhat.com \
--to=berrange@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=armbru@redhat.com \
--cc=glaubitz@physik.fu-berlin.de \
--cc=libvir-list@redhat.com \
--cc=mlevitsk@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=reinoud@netbsd.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
--cc=wilfred.mallawa@wdc.com \
--cc=xen-devel@lists.xenproject.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).