[PATCH 1/3] ARM: dts: rainier: Add reserved memory for ramoops

Andrew Jeffery andrew at aj.id.au
Fri Oct 16 14:38:02 AEDT 2020



On Tue, 6 Oct 2020, at 13:52, Joel Stanley wrote:
> On Fri, 2 Oct 2020 at 06:35, Andrew Jeffery <andrew at aj.id.au> wrote:
> >
> > Reserve a 1MiB region of memory to record kmsg dumps and console state
> > into 16kiB ring-buffer slots. The sizing allows for up to 32 dumps to be
> > captured and read out.
> >
> > Signed-off-by: Andrew Jeffery <andrew at aj.id.au>
> > ---
> >  arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> >
> > diff --git a/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts b/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts
> > index e6f422edf454..46a0e95049fd 100644
> > --- a/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts
> > +++ b/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts
> > @@ -47,6 +47,14 @@ reserved-memory {
> >                 #size-cells = <1>;
> >                 ranges;
> >
> > +               ramoops at b7f00000 {
> > +                       compatible = "ramoops";
> > +                       reg = <0xb7f00000 0x100000>;
> > +                       record-size = <0x4000>;
> > +                       console-size = <0x4000>;
> 
> This is conserative. We've got plenty of space, how about we make it bigger?
> 
> $ git grep console-size *.dts* | grep -Po "0x([0-9]+)" | xargs printf
> "%x\n" | sort -n
> 8000
> 8000
> 10000
> 10000
> 20000
> 20000
> 20000
> 20000
> 20000
> 60000
> 100000
> 
> The median is 128KB, which sounds reasonable.

Well, maybe? Why should we basing it on what everyone else has done rather than 
what we need? We're compressing the data before it's written to the pstore 
ring. Uncompressed, 16k is in the order of 200 lines of text. With the default 
DEFLATE compression we can fit 3-4x more:

root at rain15bmc:~# uptime
 14:44:20 up 14:44,  load average: 0.01, 0.01, 0.01
root at rain15bmc:~# dmesg | wc -l
640
root at rain15bmc:~# dmesg  >/tmp/dmesg
root at rain15bmc:~# stat -c "%s" /tmp/dmesg
44032
root at rain15bmc:~# gzip /tmp/dmesg
root at rain15bmc:~# stat -c "%s" /tmp/dmesg.gz
11059

I think 16k is more than enough for now?

> 
> $ git grep record-size *.dts* | grep -Po "0x([0-9]+)" | xargs printf "%x\n"
> 20000
> 400
> 400
> 20000
> 20000
> 20000
> 10000
> 10000
> 10000
> 10000
> 20000
> 
> 64KB is the median record size.
> 
> > +                       pmsg-size = <0x4000>;
> 
> Do we want to add ftrace too?

I figured getting an oops/panic stack dump might be enough for the moment.

> 
> Should we also add max-reason = KMSG_DUMP_EMERG?
> 
> Logging reboots and shutdowns is informative (you know if a reboot was
> intentional or due to a crash that wasn't recorded) and allows for
> testing.

Yeah, that's a good idea.

Thanks.

Andrew


More information about the openbmc mailing list