Re: [PATCH] arm64: use the vmcore info to get module/vmalloc/vmemmap ranges

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----Original Message-----
> The kernel patch has been merged:
>      "arm64: crash_core: Export MODULES, VMALLOC, and VMEMMAP ranges"
>      https://git.kernel.org/arm64/c/2369f171d5c5
> 
> and it will be available in v5.18-rc1.
> 
> So we can get module/vmalloc/vmemmap ranges from the vmcore info
> since the v5.18, and we have no need to calculate them by hand
> any more.
> 
> This patch adds a new hook arm64_get_range_v5_18 which could parse
> out all the module/vmalloc/vmemmap ranges from the vmcore info.
> 
> Signed-off-by: Huang Shijie <shijie@xxxxxxxxxxxxxxxxxxxxxx>
> ---
>  arm64.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 47 insertions(+), 2 deletions(-)
> 
> diff --git a/arm64.c b/arm64.c
> index 841016c..b91938e 100644
> --- a/arm64.c
> +++ b/arm64.c
> @@ -569,6 +569,48 @@ static int arm64_get_struct_page_max_shift(struct machine_specific *ms)
>  	return 0;
>  }
> 
> +/* Return 0 if we succeed, return 1 on failure. */
> +static int arm64_get_vmcoreinfo_ul(unsigned long *vaddr, const char* label)
> +{
> +	char *string = pc->read_vmcoreinfo(label);
> +
> +	if (!string)
> +		return 1;
> +
> +	*vaddr  = strtoul(string, NULL, 0);
> +	free(string);
> +	return 0;

The return value is irregular in crash.
Would you use TRUE on success and FALSE on failure?

Thanks,
Kazu



> +}
> +
> +/*
> + *  The change is caused by the kernel patch since v5.18-rc1:
> + *    "arm64: crash_core: Export MODULES, VMALLOC, and VMEMMAP ranges"
> + */
> +static struct kernel_range *arm64_get_range_v5_18(struct machine_specific *ms)
> +{
> +	struct kernel_range *r = &tmp_range;
> +
> +	/* Get the MODULES_VADDR ~ MODULES_END */
> +	if (arm64_get_vmcoreinfo_ul(&r->modules_vaddr, "NUMBER(MODULES_VADDR)"))
> +		return NULL;
> +	if (arm64_get_vmcoreinfo_ul(&r->modules_end, "NUMBER(MODULES_END)"))
> +		return NULL;
> +
> +	/* Get the VMEMMAP_START ~ VMEMMAP_END */
> +	if (arm64_get_vmcoreinfo_ul(&r->vmemmap_vaddr, "NUMBER(VMEMMAP_START)"))
> +		return NULL;
> +	if (arm64_get_vmcoreinfo_ul(&r->vmemmap_end, "NUMBER(VMEMMAP_END)"))
> +		return NULL;
> +
> +	/* Get the VMALLOC_START ~ VMALLOC_END */
> +	if (arm64_get_vmcoreinfo_ul(&r->vmalloc_start_addr, "NUMBER(VMALLOC_START)"))
> +		return NULL;
> +	if (arm64_get_vmcoreinfo_ul(&r->vmalloc_end, "NUMBER(VMALLOC_END)"))
> +		return NULL;
> +
> +	return r;
> +}
> +
>  /*
>   *  The change is caused by the kernel patch since v5.17-rc1:
>   *    "b89ddf4cca43 arm64/bpf: Remove 128MB limit for BPF JIT programs"
> @@ -774,8 +816,11 @@ static struct kernel_range *arm64_get_range_v5_0(struct machine_specific *ms)
> 
>  static struct kernel_va_range_handler kernel_va_range_handlers[] = {
>  	{
> -		LINUX(5,17,0),
> -		LINUX(99,0,0), /* Just a boundary, Change it later */
> +		LINUX(5,18,0),
> +		LINUX(99,0,0), /* Just a boundary */
> +		get_range: arm64_get_range_v5_18,
> +	}, {
> +		LINUX(5,17,0), LINUX(5,18,0),
>  		get_range: arm64_get_range_v5_17,
>  	}, {
>  		LINUX(5,11,0), LINUX(5,17,0),
> --
> 2.30.2

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/crash-utility
Contribution Guidelines: https://github.com/crash-utility/crash/wiki




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux