linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] kexec: Use %pe format specifier for error pointer printing
@ 2025-10-16 20:03 Zhu Yanjun
  2025-10-21  9:41 ` Simon Horman
  2025-11-01 13:49 ` Pasha Tatashin
  0 siblings, 2 replies; 8+ messages in thread
From: Zhu Yanjun @ 2025-10-16 20:03 UTC (permalink / raw)
  To: kexec, linux-mm; +Cc: Zhu Yanjun, graf, rppt, changyuanl, akpm, bhe

Make pr_xxx() call to use the %pe format specifier instead of %d.
The %pe specifier prints a symbolic error string (e.g., -ENOMEM,
-EINVAL) when given an error pointer created with ERR_PTR(err).

This change enhances the clarity and diagnostic value of the error
message by showing a descriptive error name rather than a numeric
error code.

Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
CC: graf@amazon.com
CC: rppt@kernel.org
CC: changyuanl@google.com
CC: akpm@linux-foundation.org
CC: bhe@redhat.com

---
 kernel/kexec_handover.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/kernel/kexec_handover.c b/kernel/kexec_handover.c
index 76f0940fb485..77af377022b0 100644
--- a/kernel/kexec_handover.c
+++ b/kernel/kexec_handover.c
@@ -1095,7 +1095,7 @@ static int kho_abort(void)
 	err = notifier_to_errno(err);
 
 	if (err)
-		pr_err("Failed to abort KHO finalization: %d\n", err);
+		pr_err("Failed to abort KHO finalization: %pe\n", ERR_PTR(err));
 
 	return err;
 }
@@ -1142,7 +1142,7 @@ static int kho_finalize(void)
 
 abort:
 	if (err) {
-		pr_err("Failed to convert KHO state tree: %d\n", err);
+		pr_err("Failed to convert KHO state tree: %pe\n", ERR_PTR(err));
 		kho_abort();
 	}
 
@@ -1355,8 +1355,8 @@ static __init int kho_in_debugfs_init(const void *fdt)
 		err = kho_debugfs_fdt_add(&kho_in.fdt_list, sub_fdt_dir, name,
 					  phys_to_virt(*fdt_phys));
 		if (err) {
-			pr_warn("failed to add fdt `%s` to debugfs: %d\n", name,
-				err);
+			pr_warn("failed to add fdt `%s` to debugfs: %pe\n", name,
+				ERR_PTR(err));
 			continue;
 		}
 	}
@@ -1400,8 +1400,8 @@ static __init int kho_init(void)
 		 * kexec.
 		 */
 		if (err)
-			pr_err("failed exposing handover FDT in debugfs: %d\n",
-			       err);
+			pr_err("failed exposing handover FDT in debugfs: %pe\n",
+			       ERR_PTR(err));
 
 		return 0;
 	}
@@ -1524,8 +1524,8 @@ void __init kho_populate(phys_addr_t fdt_phys, u64 fdt_len,
 		memblock_add(area->addr, size);
 		err = memblock_mark_kho_scratch(area->addr, size);
 		if (WARN_ON(err)) {
-			pr_warn("failed to mark the scratch region 0x%pa+0x%pa: %d",
-				&area->addr, &size, err);
+			pr_warn("failed to mark the scratch region 0x%pa+0x%pa: %pe",
+				&area->addr, &size, ERR_PTR(err));
 			goto out;
 		}
 		pr_debug("Marked 0x%pa+0x%pa as scratch", &area->addr, &size);
@@ -1553,7 +1553,7 @@ void __init kho_populate(phys_addr_t fdt_phys, u64 fdt_len,
 	if (scratch)
 		early_memunmap(scratch, scratch_len);
 	if (err)
-		pr_warn("disabling KHO revival: %d\n", err);
+		pr_warn("disabling KHO revival: %pe\n", ERR_PTR(err));
 }
 
 /* Helper functions for kexec_file_load */
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] kexec: Use %pe format specifier for error pointer printing
  2025-10-16 20:03 [PATCH 1/1] kexec: Use %pe format specifier for error pointer printing Zhu Yanjun
@ 2025-10-21  9:41 ` Simon Horman
  2025-10-21 13:56   ` Zhu Yanjun
                     ` (2 more replies)
  2025-11-01 13:49 ` Pasha Tatashin
  1 sibling, 3 replies; 8+ messages in thread
From: Simon Horman @ 2025-10-21  9:41 UTC (permalink / raw)
  To: Zhu Yanjun; +Cc: kexec, linux-mm, graf, rppt, changyuanl, akpm, bhe

On Thu, Oct 16, 2025 at 08:03:20PM +0000, Zhu Yanjun wrote:
> Make pr_xxx() call to use the %pe format specifier instead of %d.
> The %pe specifier prints a symbolic error string (e.g., -ENOMEM,
> -EINVAL) when given an error pointer created with ERR_PTR(err).
> 
> This change enhances the clarity and diagnostic value of the error
> message by showing a descriptive error name rather than a numeric
> error code.
> 
> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>

Thanks,

This looks good to me, even though I note that this file
has moved in linux-next.

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] kexec: Use %pe format specifier for error pointer printing
  2025-10-21  9:41 ` Simon Horman
@ 2025-10-21 13:56   ` Zhu Yanjun
  2025-10-21 22:42   ` yanjun.zhu
  2025-10-31 20:09   ` Yanjun.Zhu
  2 siblings, 0 replies; 8+ messages in thread
From: Zhu Yanjun @ 2025-10-21 13:56 UTC (permalink / raw)
  To: Simon Horman; +Cc: kexec, linux-mm, graf, rppt, changyuanl, akpm, bhe


在 2025/10/21 2:41, Simon Horman 写道:
> On Thu, Oct 16, 2025 at 08:03:20PM +0000, Zhu Yanjun wrote:
>> Make pr_xxx() call to use the %pe format specifier instead of %d.
>> The %pe specifier prints a symbolic error string (e.g., -ENOMEM,
>> -EINVAL) when given an error pointer created with ERR_PTR(err).
>>
>> This change enhances the clarity and diagnostic value of the error
>> message by showing a descriptive error name rather than a numeric
>> error code.
>>
>> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
> Thanks,
>
> This looks good to me, even though I note that this file
> has moved in linux-next.

Thanks a lot.

Yanjun.Zhu

>
> Reviewed-by: Simon Horman <horms@kernel.org>

-- 
Best Regards,
Yanjun.Zhu



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] kexec: Use %pe format specifier for error pointer printing
  2025-10-21  9:41 ` Simon Horman
  2025-10-21 13:56   ` Zhu Yanjun
@ 2025-10-21 22:42   ` yanjun.zhu
  2025-10-31 20:09   ` Yanjun.Zhu
  2 siblings, 0 replies; 8+ messages in thread
From: yanjun.zhu @ 2025-10-21 22:42 UTC (permalink / raw)
  To: Simon Horman; +Cc: kexec, linux-mm, graf, rppt, changyuanl, akpm, bhe

On 10/21/25 2:41 AM, Simon Horman wrote:
> On Thu, Oct 16, 2025 at 08:03:20PM +0000, Zhu Yanjun wrote:
>> Make pr_xxx() call to use the %pe format specifier instead of %d.
>> The %pe specifier prints a symbolic error string (e.g., -ENOMEM,
>> -EINVAL) when given an error pointer created with ERR_PTR(err).
>>
>> This change enhances the clarity and diagnostic value of the error
>> message by showing a descriptive error name rather than a numeric
>> error code.
>>
>> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
> 
> Thanks,
> 
> This looks good to me, even though I note that this file
> has moved in linux-next.

Thank you very much. In next-20251021, I noticed that the directory is 
now kernel/liveupdate/.

If a new commit is needed to reflect this change, please feel free to 
let me know.

Yanjun.Zhu

> 
> Reviewed-by: Simon Horman <horms@kernel.org>
> 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] kexec: Use %pe format specifier for error pointer printing
  2025-10-21  9:41 ` Simon Horman
  2025-10-21 13:56   ` Zhu Yanjun
  2025-10-21 22:42   ` yanjun.zhu
@ 2025-10-31 20:09   ` Yanjun.Zhu
  2025-10-31 20:18     ` Pasha Tatashin
  2 siblings, 1 reply; 8+ messages in thread
From: Yanjun.Zhu @ 2025-10-31 20:09 UTC (permalink / raw)
  To: Simon Horman, Pasha Tatashin
  Cc: kexec, linux-mm, graf, rppt, changyuanl, akpm, bhe

[-- Attachment #1: Type: text/plain, Size: 1046 bytes --]

Hi, Pasha

I noticed that you are moving |kexec_handover.c| from the |kernel/| 
directory to |kernel/liveupdate/|.

Several developers suggested that I resend my patch after your patch 
series is merged upstream.
Therefore, I’d like to ask if you could include my patch in your series. 
This would help avoid extra work on my side to resend the commit later.

Thanks,

Yanjun.Zhu

On 10/21/25 2:41 AM, Simon Horman wrote:
> On Thu, Oct 16, 2025 at 08:03:20PM +0000, Zhu Yanjun wrote:
>> Make pr_xxx() call to use the %pe format specifier instead of %d.
>> The %pe specifier prints a symbolic error string (e.g., -ENOMEM,
>> -EINVAL) when given an error pointer created with ERR_PTR(err).
>>
>> This change enhances the clarity and diagnostic value of the error
>> message by showing a descriptive error name rather than a numeric
>> error code.
>>
>> Signed-off-by: Zhu Yanjun<yanjun.zhu@linux.dev>
> Thanks,
>
> This looks good to me, even though I note that this file
> has moved in linux-next.
>
> Reviewed-by: Simon Horman<horms@kernel.org>

[-- Attachment #2: Type: text/html, Size: 1977 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] kexec: Use %pe format specifier for error pointer printing
  2025-10-31 20:09   ` Yanjun.Zhu
@ 2025-10-31 20:18     ` Pasha Tatashin
  2025-10-31 21:00       ` Yanjun.Zhu
  0 siblings, 1 reply; 8+ messages in thread
From: Pasha Tatashin @ 2025-10-31 20:18 UTC (permalink / raw)
  To: Yanjun.Zhu
  Cc: Simon Horman, kexec mailing list, linux-mm, Alexander Graf,
	Mike Rapoport, Changyuan Lyu, akpm, Baoquan He

[-- Attachment #1: Type: text/plain, Size: 1245 bytes --]

Sure. Will include it

On Fri, Oct 31, 2025, 4:09 PM Yanjun.Zhu <yanjun.zhu@linux.dev> wrote:

> Hi, Pasha
>
> I noticed that you are moving kexec_handover.c from the kernel/ directory
> to kernel/liveupdate/.
>
> Several developers suggested that I resend my patch after your patch
> series is merged upstream.
> Therefore, I’d like to ask if you could include my patch in your series.
> This would help avoid extra work on my side to resend the commit later.
>
> Thanks,
>
> Yanjun.Zhu
> On 10/21/25 2:41 AM, Simon Horman wrote:
>
> On Thu, Oct 16, 2025 at 08:03:20PM +0000, Zhu Yanjun wrote:
>
> Make pr_xxx() call to use the %pe format specifier instead of %d.
> The %pe specifier prints a symbolic error string (e.g., -ENOMEM,
> -EINVAL) when given an error pointer created with ERR_PTR(err).
>
> This change enhances the clarity and diagnostic value of the error
> message by showing a descriptive error name rather than a numeric
> error code.
>
> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev> <yanjun.zhu@linux.dev>
>
>
> Thanks,
>
> This looks good to me, even though I note that this file
> has moved in linux-next.
>
> Reviewed-by: Simon Horman <horms@kernel.org> <horms@kernel.org>
>
>

[-- Attachment #2: Type: text/html, Size: 1940 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] kexec: Use %pe format specifier for error pointer printing
  2025-10-31 20:18     ` Pasha Tatashin
@ 2025-10-31 21:00       ` Yanjun.Zhu
  0 siblings, 0 replies; 8+ messages in thread
From: Yanjun.Zhu @ 2025-10-31 21:00 UTC (permalink / raw)
  To: Pasha Tatashin
  Cc: Simon Horman, kexec mailing list, linux-mm, Alexander Graf,
	Mike Rapoport, Changyuan Lyu, akpm, Baoquan He

[-- Attachment #1: Type: text/plain, Size: 1435 bytes --]


On 10/31/25 1:18 PM, Pasha Tatashin wrote:
> Sure. Will include it

Thanks a lot. Appreciate your helps.

Yanjun.Zhu


>
> On Fri, Oct 31, 2025, 4:09 PM Yanjun.Zhu <yanjun.zhu@linux.dev> wrote:
>
>     Hi, Pasha
>
>     I noticed that you are moving |kexec_handover.c| from the
>     |kernel/| directory to |kernel/liveupdate/|.
>
>     Several developers suggested that I resend my patch after your
>     patch series is merged upstream.
>     Therefore, I’d like to ask if you could include my patch in your
>     series. This would help avoid extra work on my side to resend the
>     commit later.
>
>     Thanks,
>
>     Yanjun.Zhu
>
>     On 10/21/25 2:41 AM, Simon Horman wrote:
>>     On Thu, Oct 16, 2025 at 08:03:20PM +0000, Zhu Yanjun wrote:
>>>     Make pr_xxx() call to use the %pe format specifier instead of %d.
>>>     The %pe specifier prints a symbolic error string (e.g., -ENOMEM,
>>>     -EINVAL) when given an error pointer created with ERR_PTR(err).
>>>
>>>     This change enhances the clarity and diagnostic value of the error
>>>     message by showing a descriptive error name rather than a numeric
>>>     error code.
>>>
>>>     Signed-off-by: Zhu Yanjun<yanjun.zhu@linux.dev> <mailto:yanjun.zhu@linux.dev>
>>     Thanks,
>>
>>     This looks good to me, even though I note that this file
>>     has moved in linux-next.
>>
>>     Reviewed-by: Simon Horman<horms@kernel.org> <mailto:horms@kernel.org>
>

[-- Attachment #2: Type: text/html, Size: 2915 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] kexec: Use %pe format specifier for error pointer printing
  2025-10-16 20:03 [PATCH 1/1] kexec: Use %pe format specifier for error pointer printing Zhu Yanjun
  2025-10-21  9:41 ` Simon Horman
@ 2025-11-01 13:49 ` Pasha Tatashin
  1 sibling, 0 replies; 8+ messages in thread
From: Pasha Tatashin @ 2025-11-01 13:49 UTC (permalink / raw)
  To: Zhu Yanjun; +Cc: kexec, linux-mm, graf, rppt, changyuanl, akpm, bhe

On Thu, Oct 16, 2025 at 4:03 PM Zhu Yanjun <yanjun.zhu@linux.dev> wrote:
>
> Make pr_xxx() call to use the %pe format specifier instead of %d.
> The %pe specifier prints a symbolic error string (e.g., -ENOMEM,
> -EINVAL) when given an error pointer created with ERR_PTR(err).
>
> This change enhances the clarity and diagnostic value of the error
> message by showing a descriptive error name rather than a numeric
> error code.
>
> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
> CC: graf@amazon.com
> CC: rppt@kernel.org
> CC: changyuanl@google.com
> CC: akpm@linux-foundation.org
> CC: bhe@redhat.com
>
> ---
>  kernel/kexec_handover.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/kernel/kexec_handover.c b/kernel/kexec_handover.c
> index 76f0940fb485..77af377022b0 100644
> --- a/kernel/kexec_handover.c
> +++ b/kernel/kexec_handover.c
> @@ -1095,7 +1095,7 @@ static int kho_abort(void)
>         err = notifier_to_errno(err);
>
>         if (err)
> -               pr_err("Failed to abort KHO finalization: %d\n", err);
> +               pr_err("Failed to abort KHO finalization: %pe\n", ERR_PTR(err));
>
>         return err;
>  }
> @@ -1142,7 +1142,7 @@ static int kho_finalize(void)
>
>  abort:
>         if (err) {
> -               pr_err("Failed to convert KHO state tree: %d\n", err);
> +               pr_err("Failed to convert KHO state tree: %pe\n", ERR_PTR(err));

The problem here (and in some other places below) is err a not an
-errno, but fdt error:
see: scripts/dtc/libfdt/libfdt.h

%pe ERR_PTR(err)  will output garbage, and make the debugging even harder.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-11-01 13:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-16 20:03 [PATCH 1/1] kexec: Use %pe format specifier for error pointer printing Zhu Yanjun
2025-10-21  9:41 ` Simon Horman
2025-10-21 13:56   ` Zhu Yanjun
2025-10-21 22:42   ` yanjun.zhu
2025-10-31 20:09   ` Yanjun.Zhu
2025-10-31 20:18     ` Pasha Tatashin
2025-10-31 21:00       ` Yanjun.Zhu
2025-11-01 13:49 ` Pasha Tatashin

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).