From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Igor Mammedov <imammedo@redhat.com>, qemu-riscv <qemu-riscv@nongnu.org>
Cc: qemu-devel@nongnu.org, peter.maydell@linaro.org, mst@redhat.com,
wangyanan55@huawei.com, pbonzini@redhat.com,
richard.henderson@linaro.org, anisinha@redhat.com,
qemu-arm@nongnu.org
Subject: Re: [PATCH] smbios: make memory device size configurable per Machine
Date: Tue, 4 Feb 2025 22:46:28 +0100 [thread overview]
Message-ID: <e6d14f33-94ec-47ba-9fec-64ce94da2ad0@linaro.org> (raw)
In-Reply-To: <20240711104230.1582fba0@imammedo.users.ipa.redhat.com>
On 11/7/24 10:42, Igor Mammedov wrote:
> On Thu, 11 Jul 2024 10:19:27 +0200
> Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
>> Hi Igor,
>>
>> On 11/7/24 09:48, Igor Mammedov wrote:
>>> Currently SMBIOS maximum memory device chunk is capped at 16Gb,
>>> which is fine for the most cases (QEMU uses it to describe initial
>>> RAM (type 17 SMBIOS table entries)).
>>> However when starting guest with terabytes of RAM this leads to
>>> too many memory device structures, which eventually upsets linux
>>> kernel as it reserves only 64K for these entries and when that
>>> border is crossed out it runs out of reserved memory.
>>>
>>> Instead of partitioning initial RAM on 16Gb chunks, use maximum
>>> possible chunk size that SMBIOS spec allows[1]. Which lets
>>> encode RAM in Mb units in uint32_t-1 field (upto 2047Tb).
>>> As result initial RAM will generate only one type 17 structure
>>> until host/guest reach ability to use more RAM in the future.
>>>
>>> Compat changes:
>>> We can't unconditionally change chunk size as it will break
>>> QEMU<->guest ABI (and migration). Thus introduce a new machine class
>>> field that would let older versioned machines to use 16Gb chunks
>>> while new machine type could use maximum possible chunk size.
>>>
>>> While it might seem to be risky to rise max entry size this much
>>> (much beyond of what current physical RAM modules support),
>>> I'd not expect it causing much issues, modulo uncovering bugs
>>> in software running within guest. And those should be fixed
>>> on guest side to handle SMBIOS spec properly, especially if
>>> guest is expected to support so huge RAM configs.
>>> In worst case, QEMU can reduce chunk size later if we would
>>> care enough about introducing a workaround for some 'unfixable'
>>> guest OS, either by fixing up the next machine type or
>>> giving users a CLI option to customize it.
>>>
>>> 1) SMBIOS 3.1.0 7.18.5 Memory Device — Extended Size
>>>
>>> PS:
>>> * tested on 8Tb host with RHEL6 guest, which seems to parse
>>> type 17 SMBIOS table entries correctly (according to 'dmidecode').
>>>
>>> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
>>> ---
>>> include/hw/boards.h | 4 ++++
>>> hw/arm/virt.c | 1 +
>>> hw/core/machine.c | 1 +
>>> hw/i386/pc_piix.c | 1 +
>>> hw/i386/pc_q35.c | 1 +
>>> hw/smbios/smbios.c | 11 ++++++-----
>>> 6 files changed, 14 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/include/hw/boards.h b/include/hw/boards.h
>>> index ef6f18f2c1..48ff6d8b93 100644
>>> --- a/include/hw/boards.h
>>> +++ b/include/hw/boards.h
>>> @@ -237,6 +237,9 @@ typedef struct {
>>> * purposes only.
>>> * Applies only to default memory backend, i.e., explicit memory backend
>>> * wasn't used.
>>> + * @smbios_memory_device_size:
>>> + * Default size of memory device,
>>> + * SMBIOS 3.1.0 "7.18 Memory Device (Type 17)"
>>> */
>>> struct MachineClass {
>>> /*< private >*/
>>> @@ -304,6 +307,7 @@ struct MachineClass {
>>> const CPUArchIdList *(*possible_cpu_arch_ids)(MachineState *machine);
>>> int64_t (*get_default_cpu_node_id)(const MachineState *ms, int idx);
>>> ram_addr_t (*fixup_ram_size)(ram_addr_t size);
>>> + uint64_t smbios_memory_device_size;
>>
>> Quick notes since I'm on holidays (not meant to block this patch):
>>
>> - How will evolve this machine class property in the context of
>> a heterogeneous machine (i.e. x86_64 cores and 1 riscv32 one)?
>
> I'm not aware of a SMBIOS spec (3.x) that cares about that heterogeneous
> setup yet. Are there anything in that area exists yet?
Not yet.
>
>> - Should this become a SmbiosProviderInterface later?
> if/when SMBIOS does get there (heterogeneous machines), introducing
> an interface might make a sense.
OK.
next prev parent reply other threads:[~2025-02-04 21:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-11 7:48 [PATCH] smbios: make memory device size configurable per Machine Igor Mammedov
2024-07-11 8:19 ` Philippe Mathieu-Daudé
2024-07-11 8:42 ` Igor Mammedov
2025-02-04 21:46 ` Philippe Mathieu-Daudé [this message]
2024-07-11 8:43 ` Daniel P. Berrangé
2024-07-11 9:17 ` Igor Mammedov
2024-07-11 11:13 ` Michael S. Tsirkin
2024-07-11 13:05 ` Igor Mammedov
2024-07-20 19:36 ` Michael S. Tsirkin
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=e6d14f33-94ec-47ba-9fec-64ce94da2ad0@linaro.org \
--to=philmd@linaro.org \
--cc=anisinha@redhat.com \
--cc=imammedo@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=wangyanan55@huawei.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).