Re: Arm64 crash while reading memory sysfs
From: Qian Cai
Date: Thu May 27 2021 - 13:00:39 EST
On 5/27/2021 12:22 PM, Mike Rapoport wrote:
> On Thu, May 27, 2021 at 10:33:13AM -0400, Qian Cai wrote:
>>
>>
>> On 5/27/2021 4:56 AM, Mike Rapoport wrote:
>>> Let's drop memblock=debug for now and add this instead:
>>
>> [ 0.000000][ T0] Booting Linux on physical CPU 0x0000000000 [0x503f0002]
>> [ 0.000000][ T0] Linux version 5.13.0-rc3-next-20210526+ (root@admin5) (gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #31 SMP Thu May 27 12:32:40 UTC 2021
>> [ 0.000000][ T0] Inode-cache hash table entries: 4194304 (order: 9, 33554432 bytes, linear)
>> [ 0.000000][ T0] mem auto-init: stack:off, heap alloc:on, heap free:off
>> [ 0.000000][ T0] MEMBLOCK configuration:
>> [ 0.000000][ T0] memory size = 0x0000001ff0000000 reserved size = 0x0000000421e33ae8
>> [ 0.000000][ T0] memory.cnt = 0xc
>> [ 0.000000][ T0] Memory: 777216K/133955584K available (17984K kernel code, 118722K rwdata, 4416K rodata, 6080K init, 67276K bss, 17379072K reserved, 0K cma-reserved)
>
> I still cannot understand where most of the memory disappeared, but it
> seems entirely different issue.
Interesting, it seems those memory did come back after booting.
# cat /proc/meminfo
MemTotal: 116656448 kB
MemFree: 110464000 kB
MemAvailable: 101919872 kB
Buffers: 16320 kB
Cached: 118912 kB
SwapCached: 3136 kB
Active: 63360 kB
Inactive: 199936 kB
Active(anon): 9792 kB
Inactive(anon): 132480 kB
Active(file): 53568 kB
Inactive(file): 67456 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 8388544 kB
SwapFree: 8344704 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 125056 kB
Mapped: 44992 kB
Shmem: 14784 kB
KReclaimable: 92160 kB
Slab: 4943424 kB
SReclaimable: 92160 kB
SUnreclaim: 4851264 kB
KernelStack: 24832 kB
PageTables: 10240 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 66716736 kB
Committed_AS: 708096 kB
VmallocTotal: 133143461888 kB
VmallocUsed: 49600 kB
VmallocChunk: 0 kB
Percpu: 45056 kB
HardwareCorrupted: 0 kB
AnonHugePages: 0 kB
ShmemHugePages: 0 kB
ShmemPmdMapped: 0 kB
FileHugePages: 0 kB
FilePmdMapped: 0 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 524288 kB
Hugetlb: 0 kB
>
>>> Sorry, I've missed that the BUG is apparently triggered for pfn + i. Can
>>> you please try this instead:
>>
>> [ 259.216661][ T1417] test_pages_in_a_zone: pfn 8000 is not valid
>> [ 259.226547][ T1417] page:00000000f4aa8c5c is uninitialized and poisoned
>> [ 259.226560][ T1417] page dumped because: VM_BUG_ON_PAGE(PagePoisoned(p))
>
> Can you please try Anshuman's patch "arm64/mm: Drop HAVE_ARCH_PFN_VALID":
>
> https://lore.kernel.org/lkml/1621947349-25421-1-git-send-email-anshuman.khandual@xxxxxxx
>
> It seems to me that the check for memblock_is_memory() in
> arm64::pfn_valid() is what makes init_unavailable_range() to bail out for
> section parts that are not actually populated and then we have
> VM_BUG_ON_PAGE(PagePoisoned(p)) for these pages.
That patch fixed it.