[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 12/15] util: vfio-helpers: Implement ram_block_resized()
From: |
David Hildenbrand |
Subject: |
Re: [PATCH v3 12/15] util: vfio-helpers: Implement ram_block_resized() |
Date: |
Fri, 28 Feb 2020 15:19:45 -0500 (EST) |
> Am 28.02.2020 um 20:55 schrieb Peter Xu <address@hidden>:
>
> On Thu, Feb 27, 2020 at 11:12:02AM +0100, David Hildenbrand wrote:
>> +static void qemu_vfio_dma_map_resize(QEMUVFIOState *s, void *host,
>> + size_t old_size, size_t new_size)
>> +{
>> + IOVAMapping *m;
>> + int index = 0;
>> +
>> + qemu_mutex_lock(&s->lock);
>> + m = qemu_vfio_find_mapping(s, host, &index);
>> + if (!m) {
>> + return;
>> + }
>> + assert(m->size == old_size);
>> +
>> + /* Note: Not atomic - we need a new ioctl for that. */
>> + qemu_vfio_undo_mapping(s, m->iova, m->size);
>> + qemu_vfio_do_mapping(s, host, m->iova, new_size);
>
> Another way to ask my previous question 1 (in the other reply): Can we
> simply map/unmap the extra, while keep the shared untouched?
As far as I understand the kernel implementation, unfortunately no. You might
be able to grow (by mapping the delta), but shrinking is not possible AFAIR.
And I *think* with many resizes, there could be an issue if I remember
correctly.
Thanks!
>
> Thanks,
>
>> +
>> + m->size = new_size;
>> + assert(qemu_vfio_verify_mappings(s));
>> +
>> + qemu_mutex_unlock(&s->lock);
>> +}
>
> --
> Peter Xu
>
- [PATCH v3 08/15] util/mmap-alloc: Factor out reserving of a memory region to mmap_reserve(), (continued)
- [PATCH v3 08/15] util/mmap-alloc: Factor out reserving of a memory region to mmap_reserve(), David Hildenbrand, 2020/02/27
- [PATCH v3 09/15] util/mmap-alloc: Factor out populating of memory to mmap_populate(), David Hildenbrand, 2020/02/27
- [PATCH v3 10/15] util/mmap-alloc: Prepare for resizeable mmaps, David Hildenbrand, 2020/02/27
- [PATCH v3 11/15] util/mmap-alloc: Implement resizeable mmaps, David Hildenbrand, 2020/02/27
- [PATCH v3 12/15] util: vfio-helpers: Implement ram_block_resized(), David Hildenbrand, 2020/02/27
- Re: [PATCH v3 12/15] util: vfio-helpers: Implement ram_block_resized(), Peter Xu, 2020/02/28
[PATCH v3 13/15] util: oslib: Resizeable anonymous allocations under POSIX, David Hildenbrand, 2020/02/27
[PATCH v3 15/15] exec: Ram blocks with resizeable anonymous allocations under POSIX, David Hildenbrand, 2020/02/27
[PATCH v3 14/15] numa: Introduce ram_block_notifiers_support_resize(), David Hildenbrand, 2020/02/27