From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: David Hildenbrand <david@redhat.com>
Cc: qemu-devel@nongnu.org, Juan Quintela <quintela@redhat.com>,
Peter Xu <peterx@redhat.com>,
"Michael S . Tsirkin" <mst@redhat.com>,
Michal Privoznik <mprivozn@redhat.com>
Subject: Re: [PATCH v3 6/8] virtio-mem: Fail if a memory backend with "prealloc=on" is specified
Date: Thu, 12 Jan 2023 18:33:10 +0000 [thread overview]
Message-ID: <Y8BSZugafCL1Sryr@work-vm> (raw)
In-Reply-To: <20230112164403.105085-7-david@redhat.com>
* David Hildenbrand (david@redhat.com) wrote:
> "prealloc=on" for the memory backend does not work as expected, as
> virtio-mem will simply discard all preallocated memory immediately again.
> In the best case, it's an expensive NOP. In the worst case, it's an
> unexpected allocation error.
>
> Instead, "prealloc=on" should be specified for the virtio-mem device only,
> such that virtio-mem will try preallocating memory before plugging
> memory dynamically to the guest. Fail if such a memory backend is
> provided.
>
> Tested-by: Michal Privoznik <mprivozn@redhat.com>
> Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> hw/virtio/virtio-mem.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c
> index 1ed1f5a4af..02f7b5469a 100644
> --- a/hw/virtio/virtio-mem.c
> +++ b/hw/virtio/virtio-mem.c
> @@ -772,6 +772,12 @@ static void virtio_mem_device_realize(DeviceState *dev, Error **errp)
> error_setg(errp, "'%s' property specifies an unsupported memdev",
> VIRTIO_MEM_MEMDEV_PROP);
> return;
> + } else if (vmem->memdev->prealloc) {
> + error_setg(errp, "'%s' property specifies a memdev with preallocation"
> + " enabled: %s. Instead, specify 'prealloc=on' for the"
> + " virtio-mem device. ", VIRTIO_MEM_MEMDEV_PROP,
> + object_get_canonical_path_component(OBJECT(vmem->memdev)));
> + return;
> }
>
> if ((nb_numa_nodes && vmem->node >= nb_numa_nodes) ||
> --
> 2.39.0
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2023-01-12 18:34 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-12 16:43 [PATCH v3 0/8] virtio-mem: Handle preallocation with migration David Hildenbrand
2023-01-12 16:43 ` [PATCH v3 1/8] migration/savevm: Move more savevm handling into vmstate_save() David Hildenbrand
2023-01-12 16:58 ` Dr. David Alan Gilbert
2023-01-12 17:49 ` David Hildenbrand
2023-01-12 18:36 ` Dr. David Alan Gilbert
2023-01-13 12:59 ` David Hildenbrand
2023-01-12 16:43 ` [PATCH v3 2/8] migration/savevm: Prepare vmdesc json writer in qemu_savevm_state_setup() David Hildenbrand
2023-01-12 17:43 ` Dr. David Alan Gilbert
2023-01-12 17:47 ` David Hildenbrand
2023-01-12 18:40 ` Dr. David Alan Gilbert
2023-01-12 22:06 ` Peter Xu
2023-01-13 13:01 ` David Hildenbrand
2023-01-13 13:05 ` David Hildenbrand
2023-01-12 16:43 ` [PATCH v3 3/8] migration/savevm: Allow immutable device state to be migrated early (i.e., before RAM) David Hildenbrand
2023-01-12 17:56 ` Dr. David Alan Gilbert
2023-01-12 18:21 ` David Hildenbrand
2023-01-12 19:52 ` Dr. David Alan Gilbert
2023-01-12 22:14 ` Peter Xu
2023-01-12 22:28 ` Peter Xu
2023-01-13 13:47 ` David Hildenbrand
2023-01-13 15:20 ` Peter Xu
2023-01-13 15:27 ` Peter Xu
2023-01-16 10:35 ` David Hildenbrand
2023-01-16 14:56 ` Peter Xu
2023-01-16 14:57 ` David Hildenbrand
2023-01-13 15:28 ` David Hildenbrand
2023-01-12 16:43 ` [PATCH v3 4/8] migration/vmstate: Introduce VMSTATE_WITH_TMP_TEST() and VMSTATE_BITMAP_TEST() David Hildenbrand
2023-01-12 16:44 ` [PATCH v3 5/8] migration/ram: Factor out check for advised postcopy David Hildenbrand
2023-01-12 18:23 ` Dr. David Alan Gilbert
2023-01-12 16:44 ` [PATCH v3 6/8] virtio-mem: Fail if a memory backend with "prealloc=on" is specified David Hildenbrand
2023-01-12 18:33 ` Dr. David Alan Gilbert [this message]
2023-01-12 16:44 ` [PATCH v3 7/8] virtio-mem: Migrate immutable properties early David Hildenbrand
2023-01-12 19:44 ` Dr. David Alan Gilbert
2023-01-13 13:59 ` David Hildenbrand
2023-01-12 16:44 ` [PATCH v3 8/8] virtio-mem: Proper support for preallocation with migration David Hildenbrand
2023-01-12 19:50 ` Dr. David Alan Gilbert
2023-01-12 16:45 ` [PATCH v3 0/8] virtio-mem: Handle " David Hildenbrand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y8BSZugafCL1Sryr@work-vm \
--to=dgilbert@redhat.com \
--cc=david@redhat.com \
--cc=mprivozn@redhat.com \
--cc=mst@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).