On Sat, Mar 09, 2024 at 01:51:16PM -0500, Steven Rostedt wrote: > On Sat, 9 Mar 2024 10:27:47 -0800 > Kees Cook <keesc...@chromium.org> wrote: > > > On Tue, Mar 05, 2024 at 08:59:10PM -0500, Steven Rostedt wrote: > > > This is a way to map a ring buffer instance across reboots. > > > > As mentioned on Fedi, check out the persistent storage subsystem > > (pstore)[1]. It already does what you're starting to construct for RAM > > backends (but also supports reed-solomon ECC), and supports several > > other backends including EFI storage (which is default enabled on at > > least Fedora[2]), block devices, etc. It has an existing mechanism for > > handling reservations (including via device tree), and supports multiple > > "frontends" including the Oops handler, console output, and even ftrace > > which does per-cpu recording and event reconstruction (Joel wrote this > > frontend). > > Mathieu was telling me about the pmem infrastructure.
I use nvdimm to back my RAM backend testing with qemu so I can examine the storage "externally": RAM_SIZE=16384 NVDIMM_SIZE=200 MAX_SIZE=$(( RAM_SIZE + NVDIMM_SIZE )) ... qemu-system-x86_64 \ ... -machine pc,nvdimm=on \ -m ${RAM_SIZE}M,slots=2,maxmem=${MAX_SIZE}M \ -object memory-backend-file,id=mem1,share=on,mem-path=$IMAGES/x86/nvdimm.img,size=${NVDIMM_SIZE}M,align=128M \ -device nvdimm,id=nvdimm1,memdev=mem1,label-size=1M \ ... -append 'console=uart,io,0x3f8,115200n8 loglevel=8 root=/dev/vda1 ro ramoops.mem_size=1048576 ramoops.ecc=1 ramoops.mem_address=0x440000000 ramoops.console_size=16384 ramoops.ftrace_size=16384 ramoops.pmsg_size=16384 ramoops.record_size=32768 panic=-1 init=/root/resume.sh '"$@" The part I'd like to get wired up sanely is having pstore find the nvdimm area automatically, but it never quite happened: https://lore.kernel.org/lkml/CAGXu5jLtmb3qinZnX3rScUJLUFdf+pRDVPjy=cs4kutw9tl...@mail.gmail.com/ > Thanks for the info. We use pstore on ChromeOS, but it is currently > restricted to 1MB which is too small for the tracing buffers. From what > I understand, it's also in a specific location where there's only 1MB > available for contiguous memory. That's the area that is specifically hardware backed with persistent RAM. > I'm looking at finding a way to get consistent memory outside that > range. That's what I'll be doing next week ;-) > > But this code was just to see if I could get a single contiguous range > of memory mapped to ftrace, and this patch set does exactly that. Well, please take a look at pstore. It should be able to do everything you mention already; it just needs a way to define multiple regions if you want to use an area outside of the persistent ram area defined by Chrome OS's platform driver. -Kees -- Kees Cook