From: Baoquan He <bhe@redhat.com>
To: Joe Perches <joe@perches.com>
Cc: linux-parisc@vger.kernel.org, x86@kernel.org,
kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/7] kexec_file: add kexec_file flag to control debug printing
Date: Wed, 15 Nov 2023 08:58:30 +0800 [thread overview]
Message-ID: <ZVQXthHraBBVeNy2@MiWiFi-R3L-srv> (raw)
In-Reply-To: <1e7863ec4e4ab10b84fd0e64f30f8464d2e484a3.camel@perches.com>
On 11/14/23 at 08:03am, Joe Perches wrote:
> On Tue, 2023-11-14 at 23:32 +0800, Baoquan He wrote:
> > When specifying 'kexec -c -d', kexec_load interface will print loading
> > information, e.g the regions where kernel/initrd/purgatory/cmdline
> > are put, the memmap passed to 2nd kernel taken as system RAM ranges,
> > and printing all contents of struct kexec_segment, etc. These are
> > very helpful for analyzing or positioning what's happening when
> > kexec/kdump itself failed. The debugging printing for kexec_load
> > interface is made in user space utility kexec-tools.
> >
> > Whereas, with kexec_file_load interface, 'kexec -s -d' print nothing.
> > Because kexec_file code is mostly implemented in kernel space, and the
> > debugging printing functionality is missed. It's not convenient when
> > debugging kexec/kdump loading and jumping with kexec_file_load
> > interface.
> >
> > Now add KEXEC_FILE_DEBUG to kexec_file flag to control the debugging
> > message printing. And add global variable kexec_file_dbg_print and
> > macro kexec_dprintk() to facilitate the printing.
> >
> > This is a preparation, later kexec_dprintk() will be used to replace the
> > existing pr_debug(). Once 'kexec -s -d' is specified, it will print out
> > kexec/kdump loading information. If '-d' is not specified, it regresses
> > to pr_debug().
>
> Not quite as pr_debug is completely eliminated with
> zero object size when DEBUG is not #defined.
>
> Now the object size will be larger and contain the
> formats in .text.
Ah, I didn't realize that. Thanks for telling. I didn't take pr_info()
and pr_debug because I want to avoid printing the pr_fmt() string in
each file.
>
> []
> > diff --git a/include/linux/kexec.h b/include/linux/kexec.h
> []
> > @@ -264,6 +264,18 @@ arch_kexec_apply_relocations(struct purgatory_info *pi, Elf_Shdr *section,
> > return -ENOEXEC;
> > }
> > #endif
> > +
> > +extern bool kexec_file_dbg_print;
> > +
> > +#define kexec_dprintk(fmt, args...) \
> > + do { \
> > + if (kexec_file_dbg_print) \
> > + printk(KERN_INFO fmt, ##args); \
> > + else \
> > + printk(KERN_DEBUG fmt, ##args); \
> > + } while (0)
> > +
> > +
>
> I don't know how many of these printks exist and if
> overall object size matters but using
Not too much because they are spread in different arch.
>
> #define kexec_dprintkfmt, ...) \
> printk("%s" fmt, \
> kexec_file_dbg_print ? KERN_INFO : KERN_DEBUG, \
> ##__VA_ARGS__)
>
> should reduce overall object size by eliminating the
> mostly duplicated format in .text which differs only
> by the KERN_<PREFIX>
Sure, the new one looks great to me, I will update code to take it.
Thanks a lot for your great suggestion.
Thanks
Baoquan
next prev parent reply other threads:[~2023-11-15 0:59 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-14 15:32 [PATCH 0/7] kexec_file: print out debugging message if required Baoquan He
2023-11-14 15:32 ` [PATCH 1/7] kexec_file: add kexec_file flag to control debug printing Baoquan He
2023-11-14 16:03 ` Joe Perches
2023-11-15 0:58 ` Baoquan He [this message]
2023-11-15 12:51 ` [PATCH v2 " Baoquan He
2023-11-14 15:32 ` [PATCH 2/7] kexec_file: print out debugging message if required Baoquan He
2023-11-15 21:04 ` kernel test robot
2023-11-17 9:14 ` Baoquan He
2023-11-17 9:37 ` Liu, Yujie
2023-11-17 14:01 ` bhe
2023-11-23 13:49 ` bhe
2023-11-23 15:41 ` Nathan Chancellor
2023-11-24 1:56 ` bhe
2023-11-24 1:18 ` Yujie Liu
2023-11-24 1:57 ` bhe
2023-11-15 21:57 ` kernel test robot
2023-11-17 8:21 ` Baoquan He
2023-11-14 15:32 ` [PATCH 3/7] kexec_file, x86: " Baoquan He
2023-11-14 15:32 ` [PATCH 4/7] kexec_file, arm64: " Baoquan He
2023-11-15 16:58 ` kernel test robot
2023-11-17 0:55 ` Baoquan He
2023-11-14 15:32 ` [PATCH 5/7] kexec_file, ricv: " Baoquan He
2023-11-14 15:32 ` [PATCH 6/7] kexec_file, power: " Baoquan He
2023-11-14 15:32 ` [PATCH 7/7] kexec_file, parisc: " Baoquan He
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=ZVQXthHraBBVeNy2@MiWiFi-R3L-srv \
--to=bhe@redhat.com \
--cc=joe@perches.com \
--cc=kexec@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=x86@kernel.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 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).