[PATCH v16 7/7] x86/crash: add x86 crash hotplug support
Baoquan He
bhe at redhat.com
Mon Jan 9 15:47:43 PST 2023
On 01/09/23 at 01:43pm, Eric DeVolder wrote:
>
>
> On 1/9/23 01:36, Baoquan He wrote:
> > On 01/05/23 at 10:17am, Eric DeVolder wrote:
> > ......
> > > @@ -394,10 +409,37 @@ int crash_load_segments(struct kimage *image)
> > > if (ret)
> > > return ret;
> > > - image->elf_headers = kbuf.buffer;
> > > - image->elf_headers_sz = kbuf.bufsz;
> > > + image->elf_headers = kbuf.buffer;
> > > + image->elf_headers_sz = kbuf.bufsz;
> > > + kbuf.memsz = kbuf.bufsz;
> > > +
> > > + if (IS_ENABLED(CONFIG_CRASH_HOTPLUG)) {
> > > + /*
> > > + * Ensure the elfcorehdr segment large enough for hotplug changes.
> > > + * Start with VMCOREINFO and kernel_map.
> > > + */
> > > + unsigned long pnum = 2;
> > > +
> > > + if (IS_ENABLED(CONFIG_HOTPLUG_CPU))
> > > + pnum += CONFIG_NR_CPUS_DEFAULT;
> > > +
> > > + if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG))
> > > + pnum += CRASH_MAX_MEMORY_RANGES;
> >
> > Logic of pnum calculating is a little confusing to me. If I only enable
> > one of CONFIG_HOTPLUG_CPU and CONFIG_MEMORY_HOTPLUG, is it OK? Say I
> > only enable CONFIG_HOTPLUG_CPU and CONFIG_SMP, on x86_64,
> > CONFIG_NR_CPUS_DEFAULT will be 64. pnum will be 64, is it OK. Am I miss
> > anything?
>
> Ah, your understanding is correct, and the issue you point out I need to fix.
> Specifically is only one of HOTPLUG_CPU or MEMORY_HOTPLUG is set, then I need
> to allow a default for the other. Using the example you have above, there would
> not be room for a single memory region, so I need to allow for a default number
> of memory regions.
Hmm, for the above example, should we get real number of memory
regions? I am worried if the default number of memory regions
need be big enough. Because on system w/o memory hotplug, it could have
very many memory regions. The cpu number is similar.
More information about the kexec
mailing list