On Fri, Oct 4, 2019 at 3:06 AM Kees Cook <keescook@xxxxxxxxxxxx> wrote: > > On Thu, Oct 03, 2019 at 10:18:48PM +0530, Muni Sekhar wrote: > > Thanks a lot for letting me know about pstore, will try this option. > > It will be helpful if you can share some pointers on 'how to enable > > software ECC'? > > When I boot with pstore, I use a bunch of command line arguments to test > all its feature: > > 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 > > but I'm using pmem driver to reserve the 1MB of memory at 0x440000000. > > To do a RAM reservation on a regular system, you'll need to do something > like boot with: > > memmap=1M!1023M > > which says, reserve 1MB of memory at the 1023M offset. So this depends > on how much physical memory you have, etc, but you'll be able to see the > reservation after booting in /proc/iomem. e.g. for me, before: > > ... > 00100000-bffd9fff : System RAM > ... > > with memmap: > > ... > 00100000-3fefffff : System RAM > 3ff00000-3fffffff : Persistent Memory (legacy) > 40000000-bffd9fff : System RAM > ... > > So in that example, the address you'd want is 0x3ff00000 > > memmap=1M!1023M > ramoops.mem_size=1048576 > ramoops.ecc=1 > ramoops.mem_address=0x3ff00000 > ramoops.console_size=16384 > ramoops.ftrace_size=16384 > ramoops.pmsg_size=16384 > ramoops.record_size=32768 > > In dmesg you should see: > > [ 0.868818] pstore: Registered ramoops as persistent store backend > [ 0.869713] ramoops: using 0x100000@0x3ff00000, ecc: 16 > > And if that address lines up with the "Persistent Memory (legacy)" line > in /proc/iomem you should be good to go. > > Just mount /sys/fs/pstore and see if the console dump updates between > warm boots, then try some cold boots, see if the ECC works, etc. > > Good luck! > > -- > Kees Cook Thanks for the answers. My kernel is configured with following .config options: CONFIG_EFI_VARS_PSTORE=y # CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE is not set CONFIG_PSTORE=y CONFIG_PSTORE_CONSOLE=y CONFIG_PSTORE_PMSG=y # CONFIG_PSTORE_FTRACE is not set CONFIG_PSTORE_RAM=y Before RAM reservation, I see the following in /proc/iomem : # cat iomem | grep "System RAM" 00001000-0009d7ff : System RAM 00100000-1fffffff : System RAM 20100000-b937dfff : System RAM b9ba6000-b9ba6fff : System RAM b9be9000-b9d5dfff : System RAM b9ffa000-b9ffffff : System RAM 100000000-13fffffff : System RAM Later I booted with “memmap=1M!1023M ramoops.mem_size=1048576 ramoops.ecc=1 ramoops.mem_address=0x3ff00000 ramoops.console_size=16384 ramoops.ftrace_size=16384 ramoops.pmsg_size=16384 ramoops.record_size=32768 ramoops.mem_type=1 ramoops.dump_oops=1” After reboot, In dmesg I see the following lines: [ 0.373084] pstore: Registered ramoops as persistent store backend [ 0.373266] ramoops: attached 0x100000@0x3ff00000, ecc: 16/0 # cat /proc/iomem | grep "System RAM" 00001000-0009d7ff : System RAM 00100000-1fffffff : System RAM 20100000-3fefffff : System RAM 3ff00000-3fffffff : Persistent RAM 40000000-b937dfff : System RAM b9ba6000-b9ba6fff : System RAM b9be9000-b9d5dfff : System RAM b9ffa000-b9ffffff : System RAM 100000000-13fffffff : System RAM I noticed Persistent RAM, not Persistent Memory (legacy). What is the difference between these two? I could not find any file in /sys/fs/pstore after warm boot. Even tried to trigger the crash by running “echo c > /proc/sysrq-trigger” and then rebooted the system manually. After system boots up, I could not find dmesg-ramoops-N file in /sys/fs/pstore, even I could not find any file in /sys/fs/pstore directory. Am I missing anything? -- Thanks, Sekhar