mbox series

[RFC,0/5] KVM: drop 32-bit host support on all architectures

Message ID 20241212125516.467123-1-arnd@kernel.org (mailing list archive)
Headers show
Series KVM: drop 32-bit host support on all architectures | expand

Message

Arnd Bergmann Dec. 12, 2024, 12:55 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

I submitted a patch to remove KVM support for x86-32 hosts earlier
this month, but there were still concerns that this might be useful for
testing 32-bit host in general, as that remains supported on three other
architectures. I have gone through those three now and prepared similar
patches, as all of them seem to be equally obsolete.

Support for 32-bit KVM host on Arm hardware was dropped back in 2020
because of lack of users, despite Cortex-A7/A15/A17 based SoCs being
much more widely deployed than the other virtualization capable 32-bit
CPUs (Intel Core Duo/Silverthorne, PowerPC e300/e500/e600, MIPS P5600)
combined.

It probably makes sense to drop all of these at the same time, provided
there are no actual users remaining (not counting regression testing
that developers might be doing). Please let me know if you are still
using any of these machines, or think there needs to be deprecation
phase first.

      Arnd

Link: https://lore.kernel.org/lkml/Z1B1phcpbiYWLgCD@google.com/
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Naveen N Rao <naveen@kernel.org>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Alexander Graf <graf@amazon.com>
Cc: Crystal Wood <crwood@redhat.com>
Cc: Anup Patel <anup@brainfault.org>
Cc: Atish Patra <atishp@atishpatra.org>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Sean Christopherson <seanjc@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: x86@kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Paul Durrant <paul@xen.org>
Cc: Marc Zyngier <maz@kernel.org>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@vger.kernel.org
Cc: kvm@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: kvm-riscv@lists.infradead.org
Cc: linux-riscv@lists.infradead.org

Arnd Bergmann (5):
  mips: kvm: drop support for 32-bit hosts
  powerpc: kvm: drop 32-bit booke
  powerpc: kvm: drop 32-bit book3s
  riscv: kvm: drop 32-bit host support
  x86: kvm drop 32-bit host support

 MAINTAINERS                                 |   2 +-
 arch/mips/Kconfig                           |   3 -
 arch/mips/include/asm/kvm_host.h            |   4 -
 arch/mips/kvm/Kconfig                       |   1 +
 arch/mips/kvm/emulate.c                     |   8 -
 arch/mips/kvm/msa.S                         |  12 -
 arch/mips/kvm/vz.c                          |  22 -
 arch/powerpc/include/asm/kvm_book3s.h       |  19 -
 arch/powerpc/include/asm/kvm_book3s_32.h    |  36 --
 arch/powerpc/include/asm/kvm_book3s_asm.h   |  10 -
 arch/powerpc/include/asm/kvm_booke.h        |   4 -
 arch/powerpc/include/asm/kvm_booke_hv_asm.h |   2 -
 arch/powerpc/kvm/Kconfig                    |  44 +-
 arch/powerpc/kvm/Makefile                   |  30 --
 arch/powerpc/kvm/book3s.c                   |  18 -
 arch/powerpc/kvm/book3s_32_mmu_host.c       | 396 --------------
 arch/powerpc/kvm/book3s_emulate.c           |  37 --
 arch/powerpc/kvm/book3s_interrupts.S        |  11 -
 arch/powerpc/kvm/book3s_mmu_hpte.c          |  12 -
 arch/powerpc/kvm/book3s_pr.c                | 122 +----
 arch/powerpc/kvm/book3s_rmhandlers.S        | 110 ----
 arch/powerpc/kvm/book3s_segment.S           |  30 +-
 arch/powerpc/kvm/booke.c                    | 264 ----------
 arch/powerpc/kvm/booke.h                    |   8 -
 arch/powerpc/kvm/booke_emulate.c            |  44 --
 arch/powerpc/kvm/booke_interrupts.S         | 535 -------------------
 arch/powerpc/kvm/bookehv_interrupts.S       |  10 -
 arch/powerpc/kvm/e500.c                     | 553 --------------------
 arch/powerpc/kvm/e500.h                     |  40 --
 arch/powerpc/kvm/e500_emulate.c             | 100 ----
 arch/powerpc/kvm/e500_mmu_host.c            |  54 --
 arch/powerpc/kvm/e500mc.c                   |   5 +-
 arch/powerpc/kvm/emulate.c                  |   2 -
 arch/powerpc/kvm/powerpc.c                  |   2 -
 arch/powerpc/kvm/trace_booke.h              |  14 -
 arch/riscv/kvm/Kconfig                      |   2 +-
 arch/riscv/kvm/aia.c                        | 105 ----
 arch/riscv/kvm/aia_imsic.c                  |  34 --
 arch/riscv/kvm/mmu.c                        |   8 -
 arch/riscv/kvm/vcpu_exit.c                  |   4 -
 arch/riscv/kvm/vcpu_insn.c                  |  12 -
 arch/riscv/kvm/vcpu_sbi_pmu.c               |   8 -
 arch/riscv/kvm/vcpu_sbi_replace.c           |   4 -
 arch/riscv/kvm/vcpu_sbi_v01.c               |   4 -
 arch/riscv/kvm/vcpu_timer.c                 |  20 -
 arch/x86/kvm/Kconfig                        |   6 +-
 arch/x86/kvm/Makefile                       |   4 +-
 arch/x86/kvm/cpuid.c                        |   9 +-
 arch/x86/kvm/emulate.c                      |  34 +-
 arch/x86/kvm/fpu.h                          |   4 -
 arch/x86/kvm/hyperv.c                       |   5 +-
 arch/x86/kvm/i8254.c                        |   4 -
 arch/x86/kvm/kvm_cache_regs.h               |   2 -
 arch/x86/kvm/kvm_emulate.h                  |   8 -
 arch/x86/kvm/lapic.c                        |   4 -
 arch/x86/kvm/mmu.h                          |   4 -
 arch/x86/kvm/mmu/mmu.c                      | 134 -----
 arch/x86/kvm/mmu/mmu_internal.h             |   9 -
 arch/x86/kvm/mmu/paging_tmpl.h              |   9 -
 arch/x86/kvm/mmu/spte.h                     |   5 -
 arch/x86/kvm/mmu/tdp_mmu.h                  |   4 -
 arch/x86/kvm/smm.c                          |  19 -
 arch/x86/kvm/svm/sev.c                      |   2 -
 arch/x86/kvm/svm/svm.c                      |  23 +-
 arch/x86/kvm/svm/vmenter.S                  |  20 -
 arch/x86/kvm/trace.h                        |   4 -
 arch/x86/kvm/vmx/main.c                     |   2 -
 arch/x86/kvm/vmx/nested.c                   |  24 +-
 arch/x86/kvm/vmx/vmcs.h                     |   2 -
 arch/x86/kvm/vmx/vmenter.S                  |  25 +-
 arch/x86/kvm/vmx/vmx.c                      | 117 +----
 arch/x86/kvm/vmx/vmx.h                      |  23 +-
 arch/x86/kvm/vmx/vmx_ops.h                  |   7 -
 arch/x86/kvm/vmx/x86_ops.h                  |   2 -
 arch/x86/kvm/x86.c                          |  74 +--
 arch/x86/kvm/x86.h                          |   4 -
 arch/x86/kvm/xen.c                          |  61 +--
 77 files changed, 63 insertions(+), 3356 deletions(-)
 delete mode 100644 arch/powerpc/include/asm/kvm_book3s_32.h
 delete mode 100644 arch/powerpc/kvm/book3s_32_mmu_host.c
 delete mode 100644 arch/powerpc/kvm/booke_interrupts.S
 delete mode 100644 arch/powerpc/kvm/e500.c

Comments

A. Wilcox Dec. 13, 2024, 3:51 a.m. UTC | #1
On Dec 12, 2024, at 6:55 AM, Arnd Bergmann <arnd@kernel.org> wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> I submitted a patch to remove KVM support for x86-32 hosts earlier
> this month, but there were still concerns that this might be useful for
> testing 32-bit host in general, as that remains supported on three other
> architectures. I have gone through those three now and prepared similar
> patches, as all of them seem to be equally obsolete.
> 
> Support for 32-bit KVM host on Arm hardware was dropped back in 2020
> because of lack of users, despite Cortex-A7/A15/A17 based SoCs being
> much more widely deployed than the other virtualization capable 32-bit
> CPUs (Intel Core Duo/Silverthorne, PowerPC e300/e500/e600, MIPS P5600)
> combined.


I do use 32-bit KVM on a Core Duo “Yonah” and a Power Mac G4 (MDD), for
purposes of bisecting kernel issues without having to reboot the host
machine (when it can be duplicated in a KVM environment).

I suppose it would still be possible to run the hosts on 6.12 LTS for
some time with newer guests, but it would be unfortunate.

Best,
-arw


> 
> It probably makes sense to drop all of these at the same time, provided
> there are no actual users remaining (not counting regression testing
> that developers might be doing). Please let me know if you are still
> using any of these machines, or think there needs to be deprecation
> phase first.
> 
>      Arnd

--
Anna Wilcox (she/her)
SW Engineering: C++/Rust, DevOps, POSIX, Py/Ruby
Wilcox Technologies Inc.  |  Adélie Linux
Arnd Bergmann Dec. 13, 2024, 8:03 a.m. UTC | #2
On Fri, Dec 13, 2024, at 04:51, A. Wilcox wrote:
> On Dec 12, 2024, at 6:55 AM, Arnd Bergmann <arnd@kernel.org> wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>> 
>> I submitted a patch to remove KVM support for x86-32 hosts earlier
>> this month, but there were still concerns that this might be useful for
>> testing 32-bit host in general, as that remains supported on three other
>> architectures. I have gone through those three now and prepared similar
>> patches, as all of them seem to be equally obsolete.
>> 
>> Support for 32-bit KVM host on Arm hardware was dropped back in 2020
>> because of lack of users, despite Cortex-A7/A15/A17 based SoCs being
>> much more widely deployed than the other virtualization capable 32-bit
>> CPUs (Intel Core Duo/Silverthorne, PowerPC e300/e500/e600, MIPS P5600)
>> combined.
>
>
> I do use 32-bit KVM on a Core Duo “Yonah” and a Power Mac G4 (MDD), for
> purposes of bisecting kernel issues without having to reboot the host
> machine (when it can be duplicated in a KVM environment).
>
> I suppose it would still be possible to run the hosts on 6.12 LTS for
> some time with newer guests, but it would be unfortunate.

Would it be an option for you to just test those kernels on 64-bit
machines? I assume you prefer to do native builds on 32-bit hardware
because that fits your workflow, but once you get into debugging
in a virtual machine, the results should generally be the same when
building and running on a 64-bit host for both x86-32 and ppc32-classic,
right?

      Arnd
Paolo Bonzini Dec. 13, 2024, 8:20 a.m. UTC | #3
On 12/13/24 09:03, Arnd Bergmann wrote:
> On Fri, Dec 13, 2024, at 04:51, A. Wilcox wrote:
>> On Dec 12, 2024, at 6:55 AM, Arnd Bergmann <arnd@kernel.org> wrote:
>>> From: Arnd Bergmann <arnd@arndb.de>
>>>
>>> I submitted a patch to remove KVM support for x86-32 hosts earlier
>>> this month, but there were still concerns that this might be useful for
>>> testing 32-bit host in general, as that remains supported on three other
>>> architectures. I have gone through those three now and prepared similar
>>> patches, as all of them seem to be equally obsolete.
>>>
>>> Support for 32-bit KVM host on Arm hardware was dropped back in 2020
>>> because of lack of users, despite Cortex-A7/A15/A17 based SoCs being
>>> much more widely deployed than the other virtualization capable 32-bit
>>> CPUs (Intel Core Duo/Silverthorne, PowerPC e300/e500/e600, MIPS P5600)
>>> combined.
>>
>>
>> I do use 32-bit KVM on a Core Duo “Yonah” and a Power Mac G4 (MDD), for
>> purposes of bisecting kernel issues without having to reboot the host
>> machine (when it can be duplicated in a KVM environment).
>>
>> I suppose it would still be possible to run the hosts on 6.12 LTS for
>> some time with newer guests, but it would be unfortunate.
> 
> Would it be an option for you to just test those kernels on 64-bit
> machines? I assume you prefer to do native builds on 32-bit hardware
> because that fits your workflow, but once you get into debugging
> in a virtual machine, the results should generally be the same when
> building and running on a 64-bit host for both x86-32 and ppc32-classic,
> right?

Certainly for x86-32; ppc32 should be able to use PR-state (aka trap and 
emulate) KVM on a 64-bit host but it's a bit more picky.  Another 
possibility for ppc32 is just emulation with QEMU.

Paolo
A. Wilcox Dec. 13, 2024, 8:42 a.m. UTC | #4
On Dec 13, 2024, at 2:20 AM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> 
> On 12/13/24 09:03, Arnd Bergmann wrote:
>> On Fri, Dec 13, 2024, at 04:51, A. Wilcox wrote:
>>> On Dec 12, 2024, at 6:55 AM, Arnd Bergmann <arnd@kernel.org> wrote:
>>>> From: Arnd Bergmann <arnd@arndb.de>
>>>> 
>>>> I submitted a patch to remove KVM support for x86-32 hosts earlier
>>>> this month, but there were still concerns that this might be useful for
>>>> testing 32-bit host in general, as that remains supported on three other
>>>> architectures. I have gone through those three now and prepared similar
>>>> patches, as all of them seem to be equally obsolete.
>>>> 
>>>> Support for 32-bit KVM host on Arm hardware was dropped back in 2020
>>>> because of lack of users, despite Cortex-A7/A15/A17 based SoCs being
>>>> much more widely deployed than the other virtualization capable 32-bit
>>>> CPUs (Intel Core Duo/Silverthorne, PowerPC e300/e500/e600, MIPS P5600)
>>>> combined.
>>> 
>>> 
>>> I do use 32-bit KVM on a Core Duo “Yonah” and a Power Mac G4 (MDD), for
>>> purposes of bisecting kernel issues without having to reboot the host
>>> machine (when it can be duplicated in a KVM environment).
>>> 
>>> I suppose it would still be possible to run the hosts on 6.12 LTS for
>>> some time with newer guests, but it would be unfortunate.
>> Would it be an option for you to just test those kernels on 64-bit
>> machines? I assume you prefer to do native builds on 32-bit hardware
>> because that fits your workflow, but once you get into debugging
>> in a virtual machine, the results should generally be the same when
>> building and running on a 64-bit host for both x86-32 and ppc32-classic,
>> right?
> 
> Certainly for x86-32; ppc32 should be able to use PR-state (aka
> trap and emulate) KVM on a 64-bit host but it's a bit more picky.
> Another possibility for ppc32 is just emulation with QEMU.
> 
> Paolo


Most of the reason I use KVM instead of emulation is because I don’t
trust QEMU emulation at all.  There was even a kernel bug that was
introduced affecting 32-bit x86 in the 4.0 cycle that only happened
because QEMU wasn’t emulating writes to %cr4 properly[1].  And PPC32
emulation is far worse than x86_32.  However, I probably could end
up doing x86_32 testing on a combination of bare metal machines and
KVM on x86_64, sure.

As for Power: I will admit I haven’t tested lately, but well into
the 5 series (5.4, at least), you couldn’t boot a ppc32 Linux kernel
on any 64-bit capable hardware.  It would throw what I believe was an
alignment error while quiescing OpenFirmware and toss you back to an
‘ok >’ prompt.  Unfortunately I can’t find any of the bug reports
or ML threads from the time - it was a known bug in the 2.6 days - but
the answer was always “why are you booting a ppc32 kernel on that
hardware anyway?  It’s a ppc64 machine!”  Is this a case where
that would be accepted as a legitimate bug now?  It would be lovely
to use my largely-SMT 3.0 GHz Power9 box for more of my kernel testing
(where possible) instead of relying on a 933 MHz single-thread G4.

-arw

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a833581e372a;
It had some form of security impact on Pentium-class machines, too,
as RDPMC became available to non-root even when /sys/devices/cpu/rdpmc
was 0.
Arnd Bergmann Dec. 13, 2024, 9:01 a.m. UTC | #5
On Fri, Dec 13, 2024, at 09:42, A. Wilcox wrote:
>
> As for Power: I will admit I haven’t tested lately, but well into
> the 5 series (5.4, at least), you couldn’t boot a ppc32 Linux kernel
> on any 64-bit capable hardware.  It would throw what I believe was an
> alignment error while quiescing OpenFirmware and toss you back to an
> ‘ok >’ prompt.  Unfortunately I can’t find any of the bug reports
> or ML threads from the time - it was a known bug in the 2.6 days - but
> the answer was always “why are you booting a ppc32 kernel on that
> hardware anyway?  It’s a ppc64 machine!”  Is this a case where
> that would be accepted as a legitimate bug now?  It would be lovely
> to use my largely-SMT 3.0 GHz Power9 box for more of my kernel testing
> (where possible) instead of relying on a 933 MHz single-thread G4.

I'm fairly sure we don't allow booting 32-bit kernels on
the 64-bit IBM CPUs (g5, cell, POWER), but as Christophe
mentioned earlier, you can apparently run a 32-bit e500
kernel 64-bit QorIQ.

What I was thinking of is purely inside of qemu/kvm. I have
not tried this myself, but I saw that there is code to handle
this case in the kernel, at least for PR mode:

static void kvmppc_set_pvr_pr(struct kvm_vcpu *vcpu, u32 pvr)
{
        u32 host_pvr;

        vcpu->arch.hflags &= ~BOOK3S_HFLAG_SLB;
        vcpu->arch.pvr = pvr;
        if ((pvr >= 0x330000) && (pvr < 0x70330000)) {
                kvmppc_mmu_book3s_64_init(vcpu);
                if (!to_book3s(vcpu)->hior_explicit)
                        to_book3s(vcpu)->hior = 0xfff00000;
                to_book3s(vcpu)->msr_mask = 0xffffffffffffffffULL;
                vcpu->arch.cpu_type = KVM_CPU_3S_64;
        } else
        {
                kvmppc_mmu_book3s_32_init(vcpu);
                if (!to_book3s(vcpu)->hior_explicit)
                        to_book3s(vcpu)->hior = 0;
                to_book3s(vcpu)->msr_mask = 0xffffffffULL;
                vcpu->arch.cpu_type = KVM_CPU_3S_32;
        }
...

So I assumed this would work the same way as on x86 and arm,
where you can use the 32-bit machine emulation from qemu but
still enable KVM mode.

      Arnd