Re: [Crash-utility] [营销邮件] Re: [营销邮件] Re: [营销邮件] Re: [External Mail][????] Re: ramdump support for va_bits_actual

2020-04-20 Thread Dave Anderson



- Original Message -
> In fact,vmemmap  not easy to calculated in crash-utility,if
> CONFIG_RANDOMIZE_BASE is configured,memstart_addr  will be changed since 
> below codes:
> [arm64_memblock_init]
> 348 vmemmap = ((struct page *)VMEMMAP_START - (memstart_addr >> 
> PAGE_SHIFT));
> ...
> 413 if (IS_ENABLED(CONFIG_RANDOMIZE_BASE)) {
> 414 extern u16 memstart_offset_seed;
> 415 u64 range = linear_region_size -
> 416 (memblock_end_of_DRAM() - 
> memblock_start_of_DRAM());
> 417
> 418 /*
> 419  * If the size of the linear region exceeds, by a 
> sufficient
> 420  * margin, the size of the region that the available 
> physical
> 421  * memory spans, randomize the linear region as well.
> 422  */
> 423 if (memstart_offset_seed > 0 && range >= 
> ARM64_MEMSTART_ALIGN) {
> 424 range /= ARM64_MEMSTART_ALIGN;
> 425 memstart_addr -= ARM64_MEMSTART_ALIGN *
> 426  ((range * memstart_offset_seed) 
> >> 16);
> 427 }
> 428 }

OK.

> 
> the reason i  showed the "address_markers " is just to prove vmemmap and
> ms->vmemmap_start is wrong.we'd better to do below change.
> -   vmemmap_start = (-vmemmap_size);
> +   vmemmap_start = (-vmemmap_size - MEGABYTES(2));

This looks correct, although I've never seen a problem using the current
setting on 5.4 and later kernels.  What happens on your system?  Is your
system's memstart_addr within that low 2MB? 

Thanks,
  Dave

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility



Re: [Crash-utility] [营销邮件] Re: [营销邮件] Re: [营销邮件] Re: [External Mail][????] Re: ramdump support for va_bits_actual

2020-04-20 Thread 赵乾利
In fact,vmemmap  not easy to calculated in crash-utility,if 
CONFIG_RANDOMIZE_BASE is configured,memstart_addr  will be changed since below 
codes:
[arm64_memblock_init]
348 vmemmap = ((struct page *)VMEMMAP_START - (memstart_addr >> 
PAGE_SHIFT));
...
413 if (IS_ENABLED(CONFIG_RANDOMIZE_BASE)) {
414 extern u16 memstart_offset_seed;
415 u64 range = linear_region_size -
416 (memblock_end_of_DRAM() - 
memblock_start_of_DRAM());
417
418 /*
419  * If the size of the linear region exceeds, by a sufficient
420  * margin, the size of the region that the available 
physical
421  * memory spans, randomize the linear region as well.
422  */
423 if (memstart_offset_seed > 0 && range >= 
ARM64_MEMSTART_ALIGN) {
424 range /= ARM64_MEMSTART_ALIGN;
425 memstart_addr -= ARM64_MEMSTART_ALIGN *
426  ((range * memstart_offset_seed) >> 
16);
427 }
428 }

the reason i  showed the "address_markers " is just to prove vmemmap and 
ms->vmemmap_start is wrong.we'd better to do below change.
-   vmemmap_start = (-vmemmap_size);
+   vmemmap_start = (-vmemmap_size - MEGABYTES(2));


From: crash-utility-boun...@redhat.com  on 
behalf of Dave Anderson 
Sent: Monday, April 20, 2020 21:13
To: Discussion list for crash utility usage,    maintenance and development
Subject: [营销邮件] Re: [Crash-utility] [营销邮件] Re:  [营销邮件] Re:  [External 
Mail][] Re: ramdump support for   va_bits_actual

- Original Message -
> Hi
> vmemmap and VMEMMAP_START are different,vmemmap begin from physical address
> 0x0 of page,but VMEMMAP_START start with memstart_addr.
>
> [mm/init.c]
> arm64_memblock_init
> 348 vmemmap = ((struct page *)VMEMMAP_START - (memstart_addr >> 
> PAGE_SHIFT));

Right, so VMEMMAP_START can be calculated by reading vmemmap and memstart_addr.

>
> We can look at address_markers, this symbol indicates the entire memory map 
> allocation
> check vmemmap and address_markers, we can see vmemmap has out of vmemmap range

It would be ideal if address_markers was guaranteed to be there, but it
only exists if CONFIG_PTDUMP_CORE was configured.

> crash> p -x vmemmap
> vmemmap = $1 = (struct page *) 0xfffefde0
>
> address_markers = $2 =
>  {{
>   start_address = 0xff80,
> name = 0xffd44b1fed8f "Linear Mapping start"
> ...
>   }, {
> start_address = 0xfffeffe0,
> name = 0xffd44b2c5beb "vmemmap start"
>   }, {
> start_address = 0xffe0,
> name = 0xffd44b1eb00c "vmemmap end"
>   }, {
> start_address = 0x,
> name = 0x0
>   }}
>
>
> > When the readmem() of symbol_value("physvirt_offset") is made, arm64_VTOP() 
> > will
> > be called with its virtual address, right?
> Yes, arm64_VTOP to get physvirt_offset needs virtual address, and
> physvirt_offset is a kimage symbol,so just need kimage_voffset can translate
> to physical address,then get value of physvirt_offset.

Ah, you're right, it's a mapped kernel symbol and doesn't use it.

Dave

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility

#/**本邮件及其附件含有小米公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件!
 This e-mail and its attachments contain confidential information from XIAOMI, 
which is intended only for the person or entity whose address is listed above. 
Any use of the information contained herein in any way (including, but not 
limited to, total or partial disclosure, reproduction, or dissemination) by 
persons other than the intended recipient(s) is prohibited. If you receive this 
e-mail in error, please notify the sender by phone or email immediately and 
delete it!**/#

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility