Re: git: c9b06fa52776 - main - vm_phys_enqueue_contig: handle npages==0

From: Mike Karels <mike_at_karels.net>
Date: Fri, 04 Aug 2023 01:22:16 UTC
On 3 Aug 2023, at 9:21, Doug Moore wrote:

> The branch main has been updated by dougm:
>
> URL: https://cgit.FreeBSD.org/src/commit/?id=c9b06fa52776fbf555b9397a8d28a54c957108ec
>
> commit c9b06fa52776fbf555b9397a8d28a54c957108ec
> Author:     Doug Moore <dougm@FreeBSD.org>
> AuthorDate: 2023-08-03 14:19:48 +0000
> Commit:     Doug Moore <dougm@FreeBSD.org>
> CommitDate: 2023-08-03 14:19:48 +0000
>
>     vm_phys_enqueue_contig: handle npages==0
>
>     By letting vm_phys_enqueue_contig handle the case when npages == 0,
>     the callers can stop checking it, and the compiler can stop
>     zero-checking with every call to ffs(). Letting vm_phys_enqueue_contig
>     call vm_phys_enqueue_contig for part of its work also saves a few
>     bytes.
>
>     The amd64 object code shrinks by 128 bytes.
>
>     Reviewed by:    kib (previous version)
>     Tested by:      pho
>     Differential Revision:  https://reviews.freebsd.org/D41154

My machine panics like this during startup with this change in place again:

real memory  = 68717379584 (65534 MB)
panic: vm_phys_enq_range: page 0xfffffe006cdc8108 and npages 0 are misaligned
cpuid = 0
time = 1
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xffffffff83177ac0
vpanic() at vpanic+0x132/frame 0xffffffff83177bf0
panic() at panic+0x43/frame 0xffffffff83177c50
vm_phys_enq_range() at vm_phys_enq_range+0x12d/frame 0xffffffff83177c60
vm_phys_alloc_contig() at vm_phys_alloc_contig+0x557/frame 0xffffffff83177cf0
vm_page_find_contig_domain() at vm_page_find_contig_domain+0xbe/frame 0xffffffff83177d60
vm_page_alloc_contig_domain() at vm_page_alloc_contig_domain+0x135/frame 0xffffffff83177df0
kmem_alloc_contig_pages() at kmem_alloc_contig_pages+0x92/frame 0xffffffff83177e80
kmem_alloc_attr_domainset() at kmem_alloc_attr_domainset+0x20d/frame 0xffffffff83177f40
vm_ksubmap_init() at vm_ksubmap_init+0x65/frame 0xffffffff83177f80
cpu_startup() at cpu_startup+0x20b/frame 0xffffffff83177fa0
mi_startup() at mi_startup+0x1f1/frame 0xffffffff83177ff0
btext() at btext+0x23
KDB: enter: panic
[ thread pid 0 tid 0 ]
Stopped at      kdb_enter+0x32: movq    $0,0xe29533(%rip)
db>

If I comment out the assert, it boots and runs.

		Mike