Re: [PATCH v6 0/6] x86/tdx: Allow MMIO instructions from userspace
From: Dave Hansen
Date: Wed Sep 11 2024 - 11:39:15 EST
On 9/6/24 14:13, Sean Christopherson wrote:
> Ditto for what behavior is supported/allowed. The kernel could choose to disallow
> userspace MMIO entirely, limit what instructions are supported, etc, in the name
> of security, simplicity, or whatever. Doing so would likely cause friction with
> folks that want to run their workloads in an SNP/TDX VM, but that friction is very
> much with the guest kernel, not with KVM.
I think by "guest kernel" you really mean "x86 maintainers". Thanks for
throwing us under the bus, Sean. ;)
I do agree with you, though. In the process of taking the VMM out of
the TCB, confidential computing has to fill the gap with _something_ and
that something is usually arch-specific code in the guest kernel.
By dragging the KVM folks in here, I was less asking what KVM does per
se and more asking for some advice from the experienced VMM folks.
> FWIW, emulating MMIO that isn't controlled by the kernel gets to be a bit of a
> slippery slope, e.g. there are KVM patches on the list to support emulating AVX
> instructions[*]. But, a major use case of any hypervisor is to lift-and-shift
> workloads, and so KVM users, developers, and maintainers are quite motivated to
> ensure that anything that works on bare metal also works on KVM.
Do you have a link for that AVX discussion? I searched a bit but came
up empty.
The slippery slope is precisely what I'm worried about. I suspect the
AVX instructions are a combination of compilers that are increasingly
happy to spit out AVX and users who just want to use whatever the
compiler spits out on "pointers" in their apps that just happen to be
pointed at MMIO.
But before we start digging in to avoid the slippery slope, we really do
need to know more about the friction. Who are we causing it for and how
bad is it for them?