On 05/12/21 at 05:07pm, David Hildenbrand wrote: > On 12.05.21 16:51, Baoquan He wrote: > > On 05/11/21 at 07:07pm, David Hildenbrand wrote: > > > > > If the way adding default value into kernel config is disliked, > > > > > this a) option looks good. We can get value with x% of system RAM, but > > > > > clamp it with CRASH_KERNEL_MIN/MAX. The CRASH_KERNEL_MIN/MAX may need be > > > > > defined with a default value for different ARCHes. It's very close to > > > > > our current implementation, and handling 'auto' in kernel. > > > > > > > > > > And kernel config provided so that people can tune the MIN/MAX value, > > > > > but no need to post patch to do the tuning each time if have to? > > > > Maybe I'm missing something, but the whole point is to avoid kernel > > > > configuration option at all. If the crashkernel=auto works good for 99% of > > > > the cases, there is no need to provide build time configuration along with > > > > it. There are plenty of ways users can control crashkernel reservations > > > > with the existing 2-4 (depending on architecture) command line options. > > > > > > > > Simply hard coding a reasonable defaults (e.g. > > > > "1G-64G:128M,64G-1T:256M,1T-:512M"), and using these defaults when > > > > crashkernel=auto is set would cover the same 99% of users you referred to. > > > > > > Right, and we can easily allocate a bit more as a safety net temporarily > > > when we can actually shrink the area later. > > > > > > > > > > > If we can resize the reservation later during boot this will also address > > > > David's concern about the wasted memory. > > > > > > > > > > Yes. > > > > > > > You mentioned that amount of memory that is required for crash kernel > > > > reservation depends on the devices present on the system. Is is possible to > > > > detect how much memory is required at late stages of boot? > > > > > > Here is my thinking: > > > > > > There seems to be some kind of formula we can roughly use to come up with > > > the final crashkernel size. Baoquan for sure knows all the dirty details, I > > > assume it's roughly "core kernel + drivers + user space". > > > > > > In the kernel, we can only come up with "core kernel + drivers" expecting > > > that we will run > > > > > > a) roughly the same kernel > > > b) with roughly the same drivers > > > > As replied to Mike, kernel size is undecided for different kernel with > > different configs. We can define a default minimal size to cover kernel > > and driver on systems with not many devices, but hardcoding the size > > I never talked about hardcoding, did I? Sorry, I didn't make it clear. I said hardcoding, meaning a hardcoding min value. No matter what formula we take, it needs a default MIN value to restrict the lowest size, right? That MIN value is the hardcoding I meant. With it properly chosen, most of systems have no need to shrink or adjust the crashkernel, given most of systems own memory less than 64G. Let alone the later estimation is done in 1st kernel, very likely it will get a bigger value as really needed. > > > into upstream is not helpful. If the size is big, users will be asked to > > check and shrink always. If the size is too small, a new value need be > > got and added to cmdline and reboot. > > > -- > Thanks, > > David / dhildenb >