[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] softmmu/physmem: Improve guest memory allocation failure err
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH] softmmu/physmem: Improve guest memory allocation failure error message |
Date: |
Fri, 20 Aug 2021 18:59:00 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 |
On 8/20/21 6:40 PM, Igor Mammedov wrote:
> On Fri, 20 Aug 2021 18:00:26 +0200
> Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
>> On 8/20/21 5:53 PM, David Hildenbrand wrote:
>>> On 20.08.21 17:52, Philippe Mathieu-Daudé wrote:
>>>> When Linux refuses to overcommit a seriously wild allocation we get:
>>>>
>>>> $ qemu-system-i386 -m 40000000
>>>> qemu-system-i386: cannot set up guest memory 'pc.ram': Cannot
>>>> allocate memory
>>>>
>>>> Slighly improve the error message, displaying the memory size
>>>> requested (in case the user didn't expect unspecified memory size
>>>> unit is in MiB):
>>>>
>>>> $ qemu-system-i386 -m 40000000
>>>> qemu-system-i386: Cannot set up 38.1 TiB of guest memory 'pc.ram':
>>>> Cannot allocate memory
>>>>
>>>> Reported-by: Bin Meng <bmeng.cn@gmail.com>
>>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>>> ---
>>>> softmmu/physmem.c | 4 +++-
>>>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/softmmu/physmem.c b/softmmu/physmem.c
>>>> index 2e18947598e..2f300a9e79b 100644
>>>> --- a/softmmu/physmem.c
>>>> +++ b/softmmu/physmem.c
>>>> @@ -1982,8 +1982,10 @@ static void ram_block_add(RAMBlock *new_block,
>>>> Error **errp)
>>>>
>>>> &new_block->mr->align,
>>>> shared, noreserve);
>>>> if (!new_block->host) {
>>>> + g_autofree char *size_s =
>>>> size_to_str(new_block->max_length);
>>>> error_setg_errno(errp, errno,
>>>> - "cannot set up guest memory '%s'",
>>>> + "Cannot set up %s of guest memory
>>>> '%s'",
>>>> + size_s,
>>>> memory_region_name(new_block->mr));
>>>> qemu_mutex_unlock_ramlist();
>>>> return;
>>>>
>>>
>>> IIRC, ram blocks might not necessarily be used for guest memory ... or
>>> is my memory wrong?
>>
>> No clue, this error message was already here.
>
> it's not only guest RAM, adding size here is marginal improvement,
> (it won't help much since it's not exact match to CLI which may use suffixes
> for sizes)
The suffixed size is already converted at this point:
qemu-system-i386 -m 2T
qemu-system-i386: Cannot set up 2 TiB of guest memory 'pc.ram': Cannot
allocate memory
I agree however the size displayed might be less than the size passed
to the '-m' argument.
Anyhow I still see the size displayed in the error message as an
useful hint:
$ qemu-system-i386 -m 64000
qemu-system-i386: cannot set up guest memory 'pc.ram': Cannot allocate
memory
VS:
$ qemu-system-i386 -m 64000
qemu-system-i386: Cannot set up 62.5 GiB of guest memory 'pc.ram':
Cannot allocate memory
>
>>
>> No problem to change s/guest/block/ although.
>>
>
- [PATCH] softmmu/physmem: Improve guest memory allocation failure error message, Philippe Mathieu-Daudé, 2021/08/20
- Re: [PATCH] softmmu/physmem: Improve guest memory allocation failure error message, David Hildenbrand, 2021/08/20
- Re: [PATCH] softmmu/physmem: Improve guest memory allocation failure error message, David Hildenbrand, 2021/08/23
- Re: [PATCH] softmmu/physmem: Improve guest memory allocation failure error message, Peter Maydell, 2021/08/23
- Re: [PATCH] softmmu/physmem: Improve guest memory allocation failure error message, David Hildenbrand, 2021/08/23
- Re: [PATCH] softmmu/physmem: Improve guest memory allocation failure error message, Philippe Mathieu-Daudé, 2021/08/23
- Re: [PATCH] softmmu/physmem: Improve guest memory allocation failure error message, David Hildenbrand, 2021/08/23
- Re: [PATCH] softmmu/physmem: Improve guest memory allocation failure error message, Philippe Mathieu-Daudé, 2021/08/23
- Re: [PATCH] softmmu/physmem: Improve guest memory allocation failure error message, David Hildenbrand, 2021/08/23
- Re: [PATCH] softmmu/physmem: Improve guest memory allocation failure error message, Dr. David Alan Gilbert, 2021/08/24
- Re: [PATCH] softmmu/physmem: Improve guest memory allocation failure error message, David Hildenbrand, 2021/08/24