From: Harsh Prateek Bora <harshpb@linux.ibm.com>
To: Aditya Gupta <adityag@linux.ibm.com>,
Vishal Chourasia <vishalc@linux.ibm.com>,
Peter Maydell <peter.maydell@linaro.org>
Cc: npiggin@gmail.com, milesg@linux.ibm.com, qemu-ppc@nongnu.org,
qemu-devel@nongnu.org
Subject: Re: [PATCH] hw/ppc/pnv: Improve kernel/initrd load failure error messages
Date: Mon, 13 Oct 2025 16:24:18 +0530 [thread overview]
Message-ID: <dd607d02-fa3d-4560-86e7-6c2903799234@linux.ibm.com> (raw)
In-Reply-To: <CAFEAcA-s2ZUu2JFgyxSeYK8H3Rp7rVR4tCVDnMhdBHYn8E0OBA@mail.gmail.com>
On 10/13/25 16:07, Peter Maydell wrote:
> On Mon, 13 Oct 2025 at 11:18, Aditya Gupta <adityag@linux.ibm.com> wrote:
>>
>> On 13/10/25 14:05, Peter Maydell wrote:
>>
>>> On Mon, 13 Oct 2025 at 08:02, Vishal Chourasia <vishalc@linux.ibm.com> wrote:
>>>> On Tue, Oct 07, 2025 at 02:29:52PM +0100, Peter Maydell wrote:
>>>>> On Tue, 7 Oct 2025 at 13:59, Vishal Chourasia <vishalc@linux.ibm.com> wrote:
>>>>> <...snip...>
>>>>>
>>>>> Rather than printing a list of reasons why the load might
>>>>> have failed, I think it would be better if we enhanced
>>>>> the error handling in load_image_targphys() and friends
>>>>> (i.e. use Error), so that these functions can report back
>>>>> to the caller exactly why they failed and then the caller
>>>>> can give that error message to the user. That way we can
>>>>> improve the error reporting for every board that uses
>>>>> these load functions.
>>>> Hello Peter,
>>>>
>>>> Wouldn't it be better to print the error inside the function itself.
>>> No, because some users of this family of load functions
>>> use a sequence of calls to handle different possible
>>> formats. We don't want the function to load file format A
>>> to print any errors if we're then going to continue and
>>> successfully load the file as format B.
>>>
>>> More generally, our usual coding practice for functions
>>> is that they use Error to tell the caller what went wrong,
>>> and it's the caller that then gets to decide whether they
>>> want to print an error and exit, tell the monitor about
>>> an error, or just continue to try something else instead.
>>
>> In that case, maybe we can have 'load_image_targphys' take an 'enum
>> LoadError*' ? Caller can pass that argument if interesting in handling
>> errors.
>
> We have a standard way for functions to report errors with
> useful human readable strings attached. That's Error.
> We should just use our standard approach if we want to get
> better error messages here, rather than inventing an
> ad-hoc new thing.
Hi Aditya, Vishal,
Please see below commit for reference (there are many others doing
similar work though):
commit aa77746602cdf7e29d588d100e27f34bd6e46226
Author: Arun Menon <armenon@redhat.com>
Date: Thu Sep 18 20:53:39 2025 +0530
migration: push Error **errp into
loadvm_postcopy_handle_switchover_start()
Thanks
Harsh
>
> thanks
> -- PMM
next prev parent reply other threads:[~2025-10-13 10:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-07 9:12 [PATCH] hw/ppc/pnv: Improve kernel/initrd load failure error messages Vishal Chourasia
2025-10-07 13:29 ` Peter Maydell
2025-10-13 7:01 ` Vishal Chourasia
2025-10-13 8:35 ` Peter Maydell
2025-10-13 10:18 ` Aditya Gupta
2025-10-13 10:37 ` Peter Maydell
2025-10-13 10:54 ` Harsh Prateek Bora [this message]
2025-10-13 9:50 ` Vishal Chourasia
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=dd607d02-fa3d-4560-86e7-6c2903799234@linux.ibm.com \
--to=harshpb@linux.ibm.com \
--cc=adityag@linux.ibm.com \
--cc=milesg@linux.ibm.com \
--cc=npiggin@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=vishalc@linux.ibm.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).