qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v5 02/18] vfio: introduce vfio_get_vaddr()


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v5 02/18] vfio: introduce vfio_get_vaddr()
Date: Wed, 25 Jan 2017 18:16:44 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1


On 25/01/2017 17:43, Alex Williamson wrote:
> On Wed, 25 Jan 2017 12:32:21 +0800
> Peter Xu <address@hidden> wrote:
>> I have similar question as well above - IIUC the RCU read lock
>> protects us from not losing the references of memory objects, however
>> in our case even after we release the lock, we are still using the
>> backend ram (vaddr) since we have set it up inside kernel to build up
>> the IO page table. After that, the kernel/device should be able to
>> write to addresses of that backend ram any time.

I don't think that's what happens.  As far as I understand, VFIO pins
the pages corresponding to vaddr, not vaddr itself.  The memory backend
is mmap-ed memory; when you hot-unplug it the munmap releases the VMA
and loses the connection between QEMU's virtual address space and the
pages.  However, the pages stay pinned and stay mapped into VFIO's own
IOMMU page tables.

So if a guest does a memory hot-unplug without IOMMU unmap, it would
keep on seeing the content of the hot-unplugged memory, and the host
could not release the pages, but the guest cannot overwrite QEMU data
structures.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]