[Crash-utility] [PATCHv3] crash-utility/arm64: store phy_offset and memstart_addr separately

piliu piliu at redhat.com
Wed Apr 7 09:34:45 UTC 2021



On 4/7/21 5:16 PM, Pingfan Liu wrote:
> Crash encounters a bug like the following:
>      ...
>      License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
>      This is free software: you are free to change and redistribute it.
>      There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
>      and "show warranty" for details.
>      This GDB was configured as "aarch64-unknown-linux-gnu"...
> 
>      crash: read error: kernel virtual address: ffff000f789c0050  type: "IRQ stack pointer"
>      crash: read error: kernel virtual address: ffff000f78a60050  type: "IRQ stack pointer"
>      crash: read error: kernel virtual address: ffff000f78b00050  type: "IRQ stack pointer"
>      ...
> 
> This bug connects with kernel commit 7bc1a0f9e176 ("arm64: mm: use
> single quantity to represent the PA to VA translation"), memstart_addr
> can be negative, which makes it different from real phys_offset.
> 
> In crash utility, PTOV() needs memstart_addr to calculate VA from PA,
> while getting PFN offset in a dumpfile, phys_offset is required.
> 
> To serve the different purpose, using phys_offset_nominal and
> phys_offset to store them.
> 
> Signed-off-by: Pingfan Liu <piliu at redhat.com>
> Cc: HAGIO KAZUHITO <k-hagio-ab at nec.com>
> Cc: Lianbo Jiang <lijiang at redhat.com>
> Cc: Bhupesh Sharma <bhupesh.sharma at linaro.org>
> Cc: Mark Salter <msalter at redhat.com>
> Cc: Mark Langsdorf <mlangsdo at redhat.com>
> Cc: Jeremy Linton <jlinton at redhat.com>
> To: crash-utility at redhat.com
> ---
> v2 -> v3:
>    rename ms->memstart_addr as ms->phys_offset_nominal ( I keep the name
> as phys_offset* since it is in accordance with other platform
> conventions)
> ---
>   arm64.c | 25 ++++++++++++++++++++++---
>   defs.h  |  3 +++
>   2 files changed, 25 insertions(+), 3 deletions(-)
> 
> diff --git a/arm64.c b/arm64.c
> index 37aed07..5e567ca 100644
> --- a/arm64.c
> +++ b/arm64.c
> @@ -24,6 +24,9 @@
>   
>   #define NOT_IMPLEMENTED(X) error((X), "%s: function not implemented\n", __func__)
>   
> +#define MEMSTART_ADDR_OFFSET \
> +	(0xffffffffffffffff << 48 - 0xffffffffffffffff << 56)
> +
For this macro, it is ideal to use the kernel macro " #define 
_PAGE_OFFSET(va)    (-(UL(1) << (va)))". But it will introduce a series 
of files in kernel.

To Bhupesh:
Can it be deferred to be done until more users occur?

Thanks,
Pingfan




More information about the Crash-utility mailing list