[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v1 11/13] util: vfio-helpers: Implement ram_block_resized()
From: |
David Hildenbrand |
Subject: |
Re: [PATCH v1 11/13] util: vfio-helpers: Implement ram_block_resized() |
Date: |
Mon, 10 Feb 2020 14:41:38 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 |
On 03.02.20 19:31, David Hildenbrand wrote:
> Let's implement ram_block_resized().
>
> Note: Resizing is currently only allowed during reboot or when migration
> starts.
>
> Cc: "Dr. David Alan Gilbert" <address@hidden>
> Cc: Paolo Bonzini <address@hidden>
> Cc: Markus Armbruster <address@hidden>
> Cc: Alex Williamson <address@hidden>
> Signed-off-by: David Hildenbrand <address@hidden>
> ---
> util/vfio-helpers.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c
> index 71e02e7f35..57d77e9480 100644
> --- a/util/vfio-helpers.c
> +++ b/util/vfio-helpers.c
> @@ -395,11 +395,24 @@ static void
> qemu_vfio_ram_block_removed(RAMBlockNotifier *n,
> }
> }
>
> +static void qemu_vfio_ram_block_resized(RAMBlockNotifier *n, void *host,
> + size_t oldsize, size_t newsize)
> +{
> + QEMUVFIOState *s = container_of(n, QEMUVFIOState, ram_notifier);
> + if (host) {
> + trace_qemu_vfio_ram_block_resized(s, host, oldsize, newsize);
> + /* Note: Not atomic - we need a new ioctl for that. */
> + qemu_vfio_ram_block_removed(n, host, oldsize);
> + qemu_vfio_ram_block_added(n, host, newsize);
> + }
> +}
> +
> static void qemu_vfio_open_common(QEMUVFIOState *s)
> {
> qemu_mutex_init(&s->lock);
> s->ram_notifier.ram_block_added = qemu_vfio_ram_block_added;
> s->ram_notifier.ram_block_removed = qemu_vfio_ram_block_removed;
> + s->ram_notifier.ram_block_resized = qemu_vfio_ram_block_resized;
> s->low_water_mark = QEMU_VFIO_IOVA_MIN;
> s->high_water_mark = QEMU_VFIO_IOVA_MAX;
> ram_block_notifier_add(&s->ram_notifier);
>
I'll most probably change the handling, to reserve the IOVA for max_size
of the ram block, but only map the usable size. Addresses in the IOVA
won't be reused.
If I am not wrong, hotplugging+unplugging DIMMs a couple of times can
easily eat up the whole IOVA. Same would be true on every resize.
At this point, I really detest ram block notifiers. :)
--
Thanks,
David / dhildenb
[PATCH v1 11/13] util: vfio-helpers: Implement ram_block_resized(), David Hildenbrand, 2020/02/03
- Re: [PATCH v1 11/13] util: vfio-helpers: Implement ram_block_resized(),
David Hildenbrand <=
[PATCH v1 12/13] util: oslib: Resizable anonymous allocations under POSIX, David Hildenbrand, 2020/02/03
[PATCH v1 06/13] util/mmap-alloc: Factor out reserving of a memory region to mmap_reserve(), David Hildenbrand, 2020/02/03
[PATCH v1 13/13] exec: Ram blocks with resizable anonymous allocations under POSIX, David Hildenbrand, 2020/02/03
Re: [PATCH v1 00/13] Ram blocks with resizable anonymous allocations under POSIX, Michael S. Tsirkin, 2020/02/06
Re: [PATCH v1 00/13] Ram blocks with resizable anonymous allocations under POSIX, Dr. David Alan Gilbert, 2020/02/06