Thread (118 messages) flat view 118 messages, 11 authors, 2011-08-30

Re: kvm PCI assignment & VFIO ramblings

From: Roedel, Joerg <hidden>
Date: 2011-08-26 09:24:54
Also in: kvm, qemu-devel

On Fri, Aug 26, 2011 at 12:24:23AM -0400, David Gibson wrote:
On Thu, Aug 25, 2011 at 08:25:45AM -0500, Alexander Graf wrote:
quoted
On 25.08.2011, at 07:31, Roedel, Joerg wrote:
quoted
quoted
For mmio we could stop the guest and replace the mmio region with a
region that is filled with 0xff, no?
Sure, but that happens in user space. The question is how does
kernel space enforce an MMIO region to not be mapped after the
hotplug event occured? Keep in mind that user space is pretty much
untrusted here - it doesn't have to be QEMU. It could just as well
be a generic user space driver. And that can just ignore hotplug
events.
We're saying you hard yank the mapping from the userspace process.
That is, you invalidate all its PTEs mapping the MMIO space, and don't
let it fault them back in.

As I see it there are two options: (a) make subsequent accesses from
userspace or the guest result in either a SIGBUS that userspace must
either deal with or die, or (b) replace the mapping with a dummy RO
mapping containing 0xff, with any trapped writes emulated as nops.
The biggest problem with this approach is that it has to happen in the
context of the given process. Linux can't really modify an mm which
which belong to another context in a safe way.

The more I think about this, I come to the conclusion that it would be
the best to just kill the process accessing the device if it is manually
de-assigned from vfio. It should be a non-standard path anyway so it
doesn't make a lot of sense to implement complicated handling semantics
for it, no?

	Joerg

-- 
AMD Operating System Research Center

Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo, Andrew Bowd
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help