On Tue, Feb 11, 2025 at 7:49 AM Jason Gunthorpe <jgg@xxxxxxxxxx> wrote: > > On Mon, Feb 10, 2025 at 03:58:00PM -0500, Pasha Tatashin wrote: > > > > > > > +What: /sys/kernel/kho/dt_max > > > > +Date: December 2023 > > > > +Contact: Alexander Graf <graf@xxxxxxxxxx> > > > > +Description: > > > > + KHO needs to allocate a buffer for the DT that gets > > > > + generated before it knows the final size. By default, it > > > > + will allocate 10 MiB for it. You can write to this file > > > > + to modify the size of that allocation. > > > > > > Seems gross, why can't it use a non-contiguous page list to generate > > > the FDT? :\ > > > > We will consider some of these ideas in the future version. I like the > > idea of using preserved memory to carry sparse KHO tree: i.e FDT over > > sparse memory, maybe use the anchor page to describe how it should be > > vmapped into a virtually contiguous tree in the next kernel? > > Yeah, but this is now permanent uAPI that has to be kept forever. I Agree, what I meant in the future patch version is before it gets merged. I should have been more clear. > think you should not add this when there are enough ideas on how to > completely avoid it. Thinking about it some more, I'm actually leaning towards keeping things as they are, instead of going with a sparse FDT. With a sparse KHO-tree, we'd be kinda trying to fix something that should be handled higher up. All userspace preservable memory (like emulated pmem with devdax/fsdax and also pstore for logging) can already survive cold reboots with modified firmware Google and Microsoft do this. Similarly, the firmware could give the kernel the KHO-tree (generated by firmware or from the previous kernel) to keep stuff like telemetry, oops messages, time stamps etc. KHO should not be considered explicitly as a mechanism to carry device serialization data, the KHO should be a standard and simple way to pass kernel data between reboots. The more complex state can be built on top of it, for example guestmemfs, could preserve terabytes of data and have only one node in the KHO tree. > > Jason