All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Laurent Vivier <laurent@vivier.eu>, Greg Kurz <groug@kaod.org>
Cc: qemu-trivial@nongnu.org, Markus Armbruster <armbru@redhat.com>,
	Igor Mammedov <imammedo@redhat.com>,
	Eduardo Habkost <ehabkost@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH] numa: Add missing \n to error message
Date: Wed, 6 Nov 2019 15:35:47 +0100	[thread overview]
Message-ID: <c3ea75b6-34c5-eca4-cc57-0a5d1b1d07c9@redhat.com> (raw)
In-Reply-To: <da6cc0c8-eb29-7b2f-e43a-631ab04f5ba9@vivier.eu>

On 11/6/19 3:20 PM, Laurent Vivier wrote:
> Le 06/11/2019 à 15:12, Greg Kurz a écrit :
>> On Wed, 6 Nov 2019 14:01:01 +0100
>> Laurent Vivier <laurent@vivier.eu> wrote:
>>
>>> Le 06/11/2019 à 13:46, Greg Kurz a écrit :
>>>> If memory allocation fails when using -mem-path, QEMU is supposed to print
>>>> out a message to indicate that fallback to anonymous RAM is deprecated. This
>>>> is done with error_printf() which does output buffering. As a consequence,
>>>> the message is only printed at the next flush, eg. when quiting QEMU, and
>>>> it also lacks a trailing newline:
>>>>
>>>> qemu-system-ppc64: unable to map backing store for guest RAM: Cannot allocate memory
>>>> qemu-system-ppc64: warning: falling back to regular RAM allocation
>>>> QEMU 4.1.50 monitor - type 'help' for more information
>>>> (qemu) q
>>>> This is deprecated. Make sure that -mem-path  specified path has sufficient resources to allocate -m specified RAM amountgreg@boss02:~/Work/qemu/qemu-spapr$
>>>>
>>>> Add the missing \n to fix both issues.
>>>>
>>>> Fixes: cb79224b7e4b "deprecate -mem-path fallback to anonymous RAM"
>>>> Signed-off-by: Greg Kurz <groug@kaod.org>
>>>> ---
>>>>   hw/core/numa.c |    2 +-
>>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/hw/core/numa.c b/hw/core/numa.c
>>>> index 038c96d4abc6..e3332a984f7c 100644
>>>> --- a/hw/core/numa.c
>>>> +++ b/hw/core/numa.c
>>>> @@ -503,7 +503,7 @@ static void allocate_system_memory_nonnuma(MemoryRegion *mr, Object *owner,
>>>>               warn_report("falling back to regular RAM allocation");
>>>>               error_printf("This is deprecated. Make sure that -mem-path "
>>>>                            " specified path has sufficient resources to allocate"
>>>> -                         " -m specified RAM amount");
>>>> +                         " -m specified RAM amount\n");
>>>>               /* Legacy behavior: if allocation failed, fall back to
>>>>                * regular RAM allocation.
>>>>                */
>>>>
>>>>
>>>
>>> Why is this an error_printf() and not an error_report()?
>>>
>>
>> Because CODING_STYLE suggests to do so I guess:
>>
>> Reporting errors to the human user
>> ----------------------------------
>>
>> Do not use printf(), fprintf() or monitor_printf().  Instead, use
>> error_report() or error_vreport() from error-report.h.  This ensures the
>> error is reported in the right place (current monitor or stderr), and in
>> a uniform format.
>>
>> Use error_printf() & friends to print additional information. <===
>>
>> error_report() prints the current location.  In certain common cases
>> like command line parsing, the current location is tracked
>> automatically.  To manipulate it manually, use the loc_``*``() from
>> error-report.h.
> 
> So I guess it's to not report the current location and the binary name .
> 
> Reviewed-by: Laurent Vivier <laurent@vivier.eu>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>



  reply	other threads:[~2019-11-06 14:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-06 12:46 [PATCH] numa: Add missing \n to error message Greg Kurz
2019-11-06 12:55 ` Greg Kurz
2019-11-06 13:01 ` Laurent Vivier
2019-11-06 14:12   ` Greg Kurz
2019-11-06 14:20     ` Laurent Vivier
2019-11-06 14:35       ` Philippe Mathieu-Daudé [this message]
2019-11-06 16:55     ` Markus Armbruster
2019-11-06 17:04       ` Laurent Vivier
2019-11-12  9:34 ` Laurent Vivier

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=c3ea75b6-34c5-eca4-cc57-0a5d1b1d07c9@redhat.com \
    --to=philmd@redhat.com \
    --cc=armbru@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=groug@kaod.org \
    --cc=imammedo@redhat.com \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.