On 08/31/23 at 11:43am, Leizhen (ThunderTown) wrote:
......  
> > -static void __init reserve_crashkernel(void)
> > +static void __init arch_reserve_crashkernel(void)
> >  {
> > -   unsigned long long crash_size, crash_base, total_mem;
> > +   unsigned long long crash_base, crash_size, low_size = 0;
> > +   char *cmdline = boot_command_line;
> >     bool high = false;
> >     int ret;
> >  
> >     if (!IS_ENABLED(CONFIG_KEXEC_CORE))
> >             return;
> >  
> > -   total_mem = memblock_phys_mem_size();
> > -
> > -   /* crashkernel=XM */
> > -   ret = parse_crashkernel(boot_command_line, total_mem,
> > -                           &crash_size, &crash_base, NULL, NULL);
> > -   if (ret != 0 || crash_size <= 0) {
> > -           /* crashkernel=X,high */
> > -           ret = parse_crashkernel_high(boot_command_line, total_mem,
> > -                                        &crash_size, &crash_base);
> > -           if (ret != 0 || crash_size <= 0)
> > -                   return;
> > -           high = true;
> > -   }
> > +   ret = parse_crashkernel(cmdline, memblock_phys_mem_size(),
> > +                           &crash_size, &crash_base,
> > +                           &low_size, &high);
> > +   if (ret)
> > +           return;
> >  
> >     if (xen_pv_domain()) {
> >             pr_info("Ignoring crashkernel for a Xen PV domain\n");
> >             return;
> >     }
> >  
> > -   /* 0 means: find the address automatically */
> > -   if (!crash_base) {
> > -           /*
> > -            * Set CRASH_ADDR_LOW_MAX upper bound for crash memory,
> > -            * crashkernel=x,high reserves memory over 4G, also allocates
> > -            * 256M extra low memory for DMA buffers and swiotlb.
> > -            * But the extra memory is not required for all machines.
> > -            * So try low memory first and fall back to high memory
> > -            * unless "crashkernel=size[KMG],high" is specified.
> > -            */
> > -           if (!high)
> > -                   crash_base = memblock_phys_alloc_range(crash_size,
> > -                                           CRASH_ALIGN, CRASH_ALIGN,
> > -                                           CRASH_ADDR_LOW_MAX);
> > -           if (!crash_base)
> > -                   crash_base = memblock_phys_alloc_range(crash_size,
> > -                                           CRASH_ALIGN, CRASH_ALIGN,
> > -                                           CRASH_ADDR_HIGH_MAX);
> > -           if (!crash_base) {
> > -                   pr_info("crashkernel reservation failed - No suitable 
> > area found.\n");
> > -                   return;
> > -           }
> > -   } else {
> > -           unsigned long long start;
> > -
> > -           start = memblock_phys_alloc_range(crash_size, SZ_1M, crash_base,
> > -                                             crash_base + crash_size);
> > -           if (start != crash_base) {
> > -                   pr_info("crashkernel reservation failed - memory is in 
> > use.\n");
> > -                   return;
> > -           }
> > -   }
> > -
> > -   if (crash_base >= (1ULL << 32) && reserve_crashkernel_low()) {
> > -           memblock_phys_free(crash_base, crash_size);
> > -           return;
> > -   }
> > -
> > -   pr_info("Reserving %ldMB of memory at %ldMB for crashkernel (System 
> > RAM: %ldMB)\n",
> > -           (unsigned long)(crash_size >> 20),
> > -           (unsigned long)(crash_base >> 20),
> > -           (unsigned long)(total_mem >> 20));
> > +   reserve_crashkernel_generic(cmdline, crash_size, crash_base,
> > +                               low_size, high);
> >  
> > -   crashk_res.start = crash_base;
> > -   crashk_res.end   = crash_base + crash_size - 1;
> > -   insert_resource(&iomem_resource, &crashk_res);
> > +   return;
> 
> This can be omitted.

Will update, thx.

> 
> >  }
......


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

Reply via email to