From: Baoquan He <bhe@redhat.com>
To: Alexandre Ghiti <alexandre.ghiti@canonical.com>
Cc: Jisheng Zhang <jszhang@kernel.org>,
Russell King <linux@armlinux.org.uk>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, hpa@zytor.com,
Eric Biederman <ebiederm@xmission.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
kexec@lists.infradead.org, Alexandre ghiti <alex@ghiti.fr>
Subject: Re: [PATCH v2 0/5] kexec: use IS_ENABLED(CONFIG_KEXEC_CORE) instead of #ifdef
Date: Wed, 19 Jan 2022 17:33:22 +0800 [thread overview]
Message-ID: <20220119093322.GC4977@MiWiFi-R3L-srv> (raw)
In-Reply-To: <CA+zEjCvqYAWaWW9hVbHqYm_GbV-BaiOM4c77WHnxDNh+SRDUuw@mail.gmail.com>
On 01/19/22 at 09:52am, Alexandre Ghiti wrote:
> Hi Baoquan,
>
> On Wed, Jan 19, 2022 at 9:11 AM Baoquan He <bhe@redhat.com> wrote:
> >
> > On 01/18/22 at 10:13pm, Jisheng Zhang wrote:
> > > On Sun, Jan 16, 2022 at 09:38:47PM +0800, Baoquan He wrote:
> > > > Hi Jisheng,
> > >
> > > Hi Baoquan,
> > >
> > > >
> > > > On 12/07/21 at 12:05am, Jisheng Zhang wrote:
> > > > > Replace the conditional compilation using "#ifdef CONFIG_KEXEC_CORE"
> > > > > by a check for "IS_ENABLED(CONFIG_KEXEC_CORE)", to simplify the code
> > > > > and increase compile coverage.
> > > >
> > > > I go through this patchset, You mention the benefits it brings are
> > > > 1) simplity the code;
> > > > 2) increase compile coverage;
> > > >
> > > > For benefit 1), it mainly removes the dummy function in x86, arm and
> > > > arm64, right?
> > >
> > > Another benefit: remove those #ifdef #else #endif usage. Recently, I
> > > fixed a bug due to lots of "#ifdefs":
> > > http://lists.infradead.org/pipermail/linux-riscv/2021-December/010607.html
> >
> > Glad to know the fix. While, sometime the ifdeffery is necessary. I am
> > sorry about the one in riscv and you have fixed, it's truly a bug . But,
> > the increasing compile coverage at below you tried to make, it may cause
> > issue. Please see below my comment.
> >
> > >
> > > >
> > > > For benefit 2), increasing compile coverage, could you tell more how it
> > > > achieves and why it matters? What if people disables CONFIG_KEXEC_CORE in
> > > > purpose? Please forgive my poor compiling knowledge.
> > >
> > > Just my humble opinion, let's compare the code::
> > >
> > > #ifdef CONFIG_KEXEC_CORE
> > >
> > > code block A;
> > >
> > > #endif
> > >
> > > If KEXEC_CORE is disabled, code block A won't be compiled at all, the
> > > preprocessor will remove code block A;
> > >
> > > If we convert the code to:
> > >
> > > if (IS_ENABLED(CONFIG_KEXEC_CORE)) {
> > > code block A;
> > > }
> > >
> > > Even if KEXEC_CORE is disabled, code block A is still compiled.
> >
> > This is what I am worried about. Before, if CONFIG_KEXEC_CORE is
> > unset, those relevant codes are not compiled in. I can't see what
> > benefit is brought in if compiled in the unneeded code block. Do I miss
> > anything?
> >
>
> This is explained in Documentation/process/coding-style.rst "21)
> Conditional Compilation".
Thanks for the pointer, Alex.
I read that part, while my confusion isn't gone. With the current code,
CONFIG_KEXEC_CORE is set,
- reserve_crashkernel_low() and reserve_crashkernel() compiled in.
CONFIG_KEXEC_CORE is unset,
- reserve_crashkernel_low() and reserve_crashkernel() compiled out.
After this patch applied, does it have the same effect as the old code?
arch/x86/kernel/setup.c:
before
======
#ifdef CONFIG_KEXEC_CORE
static int __init reserve_crashkernel_low(void)
{
......
}
static void __init reserve_crashkernel(void)
{
......
}
#else
static void __init reserve_crashkernel(void)
{
}
#endif
after
=======
static int __init reserve_crashkernel_low(void)
{
......
}
static void __init reserve_crashkernel(void)
{
......
if (!IS_ENABLED(CONFIG_KEXEC_CORE))
return;
......
}
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-01-19 9:35 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-06 16:05 [PATCH v2 0/5] kexec: use IS_ENABLED(CONFIG_KEXEC_CORE) instead of #ifdef Jisheng Zhang
2021-12-06 16:05 ` [PATCH v2 1/5] kexec: make crashk_res, crashk_low_res and crash_notes symbols always visible Jisheng Zhang
2021-12-06 16:05 ` [PATCH v2 2/5] riscv: mm: init: use IS_ENABLED(CONFIG_KEXEC_CORE) instead of #ifdef Jisheng Zhang
2022-01-11 17:29 ` Palmer Dabbelt
2021-12-06 16:05 ` [PATCH v2 3/5] x86/setup: " Jisheng Zhang
2021-12-06 16:05 ` [PATCH v2 4/5] arm64: mm: " Jisheng Zhang
2021-12-06 16:05 ` [PATCH v2 5/5] arm: " Jisheng Zhang
2022-01-16 13:38 ` [PATCH v2 0/5] kexec: " Baoquan He
2022-01-18 14:13 ` Jisheng Zhang
2022-01-19 8:08 ` Baoquan He
2022-01-19 8:52 ` Alexandre Ghiti
2022-01-19 9:33 ` Baoquan He [this message]
2022-01-19 11:44 ` Jisheng Zhang
2022-01-20 9:45 ` Baoquan He
2022-01-20 9:50 ` 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=20220119093322.GC4977@MiWiFi-R3L-srv \
--to=bhe@redhat.com \
--cc=alex@ghiti.fr \
--cc=alexandre.ghiti@canonical.com \
--cc=aou@eecs.berkeley.edu \
--cc=bp@alien8.de \
--cc=catalin.marinas@arm.com \
--cc=dave.hansen@linux.intel.com \
--cc=ebiederm@xmission.com \
--cc=hpa@zytor.com \
--cc=jszhang@kernel.org \
--cc=kexec@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=mingo@redhat.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=tglx@linutronix.de \
--cc=will@kernel.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).