From: "Michal Prívozník" <mprivozn@redhat.com>
To: David Hildenbrand <david@redhat.com>, qemu-devel@nongnu.org
Cc: imammedo@redhat.com
Subject: Re: [PATCH 3/3] backends/hostmem: Round up memory size for qemu_madvise() and mbind()
Date: Wed, 29 May 2024 08:48:58 +0200 [thread overview]
Message-ID: <2b46e524-15b3-4c47-af50-1baa2b4c160d@redhat.com> (raw)
In-Reply-To: <57fabde4-3282-4d10-aaa6-e14c2169d893@redhat.com>
On 5/28/24 18:47, David Hildenbrand wrote:
> Am 28.05.24 um 18:15 schrieb Michal Privoznik:
>> ./build/qemu-system-x86_64 \ -m
>> size=8389632k,slots=16,maxmem=25600000k \ -object
>> '{"qom-type":"memory-backend-file","id":"ram-node0","mem-path":"hugepages2M","prealloc":true,"size":8590983168,"host-nodes":[0],"policy":"bind"}' \ -numa node,nodeid=0,cpus=0,memdev=ram-node0
>
> For DIMMs and friends we now (again) enforce that the size must be
> aligned to the page size:
>
> commit 540a1abbf0b243e4cfb4333c5d30a041f7080ba4
> Author: David Hildenbrand <david@redhat.com>
> Date: Wed Jan 17 14:55:54 2024 +0100
>
> memory-device: reintroduce memory region size check
>
> We used to check that the memory region size is multiples of the
> overall
> requested address alignment for the device memory address.
>
> We removed that check, because there are cases (i.e., hv-balloon) where
> devices unconditionally request an address alignment that has a very
> large
> alignment (i.e., 32 GiB), but the actual memory device size might
> not be
> multiples of that alignment.
>
> However, this change:
>
> (a) allows for some practically impossible DIMM sizes, like "1GB+1
> byte".
> (b) allows for DIMMs that partially cover hugetlb pages, previously
> reported in [1].
> ...
>
> Partial hugetlb pages do not particularly make sense; wasting memory. Do
> we expect people to actually ave working setup that we might break when
> disallowing such configurations? Or would we actually help them identify
> that something non-sensical is happening?
>
> When using memory-backend-memfd, we already do get a proper error:
>
> ./build/qemu-system-x86_64 -m 2047m -object
> memory-backend-memfd,id=ram-node0,hugetlb=on,size=2047m,reserve=off
> -numa node,nodeid=0,cpus=0,memdev=ram-node0 -S
> qemu-system-x86_64: failed to resize memfd to 2146435072: Invalid argument
>
> So this only applies to memory-backend-file, where we maybe should fail
> in a similar way?
>
Yeah, let's fail in that case. But non-aligned length is just one of
many reasons madvise()/mbind() can fail. What about the others? Should
we make them report an error or just a warning?
Michal
next prev parent reply other threads:[~2024-05-29 6:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-28 16:15 [PATCH 0/3] backends/hostmem: Round up memory size for qemu_madvise() and mbind() Michal Privoznik
2024-05-28 16:15 ` [PATCH 1/3] osdep: Make qemu_madvise() to set errno in all cases Michal Privoznik
2024-05-28 16:51 ` David Hildenbrand
2024-05-28 16:15 ` [PATCH 2/3] backends/hostmem: Warn on qemu_madvise() failures Michal Privoznik
2024-05-28 16:15 ` [PATCH 3/3] backends/hostmem: Round up memory size for qemu_madvise() and mbind() Michal Privoznik
2024-05-28 16:47 ` David Hildenbrand
2024-05-29 6:48 ` Michal Prívozník [this message]
2024-05-29 12:30 ` David Hildenbrand
2024-05-28 17:22 ` Richard Henderson
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=2b46e524-15b3-4c47-af50-1baa2b4c160d@redhat.com \
--to=mprivozn@redhat.com \
--cc=david@redhat.com \
--cc=imammedo@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).