[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAE-0n517ZDD8ySTqT2GvKv-KNf1DFP2qmaqt3Pc=-AEndLTevg@mail.gmail.com>
Date: Thu, 29 Apr 2021 01:14:43 +0200
From: Stephen Boyd <swboyd@...omium.org>
To: Baoquan He <bhe@...hat.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, Jiri Olsa <jolsa@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
Jessica Yu <jeyu@...nel.org>,
Evan Green <evgreen@...omium.org>,
Hsin-Yi Wang <hsinyi@...omium.org>,
Dave Young <dyoung@...hat.com>,
Vivek Goyal <vgoyal@...hat.com>, kexec@...ts.infradead.org
Subject: Re: [PATCH v5 13/13] kdump: Use vmlinux_build_id to simplify
Quoting Baoquan He (2021-04-28 03:13:55)
> On 04/20/21 at 02:50pm, Stephen Boyd wrote:
> > We can use the vmlinux_build_id array here now instead of open coding
> > it. This mostly consolidates code.
> >
> > Cc: Jiri Olsa <jolsa@...nel.org>
> > Cc: Alexei Starovoitov <ast@...nel.org>
> > Cc: Jessica Yu <jeyu@...nel.org>
> > Cc: Evan Green <evgreen@...omium.org>
> > Cc: Hsin-Yi Wang <hsinyi@...omium.org>
> > Cc: Dave Young <dyoung@...hat.com>
> > Cc: Baoquan He <bhe@...hat.com>
> > Cc: Vivek Goyal <vgoyal@...hat.com>
> > Cc: <kexec@...ts.infradead.org>
> > Signed-off-by: Stephen Boyd <swboyd@...omium.org>
> > ---
> > include/linux/crash_core.h | 12 ++++-----
> > kernel/crash_core.c | 50 ++------------------------------------
> > 2 files changed, 8 insertions(+), 54 deletions(-)
> >
> > diff --git a/include/linux/crash_core.h b/include/linux/crash_core.h
> > index 206bde8308b2..de62a722431e 100644
> > --- a/include/linux/crash_core.h
> > +++ b/include/linux/crash_core.h
> > @@ -38,8 +38,12 @@ phys_addr_t paddr_vmcoreinfo_note(void);
> >
> > #define VMCOREINFO_OSRELEASE(value) \
> > vmcoreinfo_append_str("OSRELEASE=%s\n", value)
> > -#define VMCOREINFO_BUILD_ID(value) \
> > - vmcoreinfo_append_str("BUILD-ID=%s\n", value)
> > +#define VMCOREINFO_BUILD_ID() \
> > + ({ \
> > + static_assert(sizeof(vmlinux_build_id) == 20); \
> > + vmcoreinfo_append_str("BUILD-ID=%20phN\n", vmlinux_build_id); \
>
> Since there has been static_assert at above, can we remove the magic
> number '20'?
>
> And I checked format_decode(), didn't find which type corresponds to
> 'N', could you tell?
It is documented in Documentation/core-api/printk-formats.rst (see "Raw
buffer as a hex string") where the '20' replaces the '*' to specify a
fixed size buffer to format. We could pass the 20 as an argument instead
of encoding it in the format, but then it would still be there twice. We
could use a #define but then it would have to be passed as an argument.
I don't know of a good way to enforce in printk that the buffer is the
size that matches the format size. Maybe it shouldn't be an option to
have a size in the format string if it's a problem to put the size of
the buffer in there.
>
> Other than these, this patch looks good to me, thanks for the effort.
>
Thanks.
Powered by blists - more mailing lists