svn commit: r323290 - head/sys/vm

Mark Johnston markj at FreeBSD.org
Sat Sep 16 22:28:53 UTC 2017


On Sat, Sep 16, 2017 at 09:01:56PM +0200, Andreas Tobler wrote:
> On 14.09.17 22:32, Mark Johnston wrote:
> > On Thu, Sep 14, 2017 at 09:51:17PM +0200, Andreas Tobler wrote:
> >> Hi Mark,
> >>
> >> On 07.09.17 23:43, Mark Johnston wrote:
> >>> Author: markj
> >>> Date: Thu Sep  7 21:43:39 2017
> >>> New Revision: 323290
> >>> URL: https://svnweb.freebsd.org/changeset/base/323290
> >>>
> >>> Log:
> >>>     Speed up vm_page_array initialization.
> >>>     
> >>>     We currently initialize the vm_page array in three passes: one to zero
> >>>     the array, one to initialize the "order" field of each page (necessary
> >>>     when inserting them into the vm_phys buddy allocator one-by-one), and
> >>>     one to initialize the remaining non-zero fields and individually insert
> >>>     each page into the allocator.
> >>>     
> >>>     Merge the three passes into one following a suggestion from alc:
> >>>     initialize vm_page fields in a single pass, and use vm_phys_free_contig()
> >>>     to efficiently insert physical memory segments into the buddy allocator.
> >>>     This reduces the initialization time to a third or a quarter of what it
> >>>     was before on most systems that I tested.
> >>>     
> >>>     Reviewed by:	alc, kib
> >>>     MFC after:	3 weeks
> >>>     Differential Revision:	https://reviews.freebsd.org/D12248
> >>>
> >>> Modified:
> >>>     head/sys/vm/vm_page.c
> >>>     head/sys/vm/vm_phys.c
> >>>     head/sys/vm/vm_phys.h
> >>
> >> I just found out that this commit breaks booting my powerpc64 Quad G5.
> >> It hangs, pressing ctrl-t shows: cmd: sh [*vm active pagequeue].
> >>
> >> Sometimes it hangs earlier when the kbd is not there yet (usb), then I
> >> can't get the process/task where it hangs.
> >>
> >> Note, this kernel is compiled with the default gcc (4.2.1-FreeBSD)
> >>
> >> Any ideas how to find out what's wrong?
> > 
> > Are you able to break into DDB when the hang occurs? If so, the output
> > of "show page" would be helpful.
> 
> Unfortunately not from the beginning. The keyboard is usb and it gets 
> installed late. Once it survives the loading of the kbd and co, I can 
> enter into ddb. But it is a trial and error. So far I didn't succeed to 
> come that far.
> 
> > Are you running with INVARIANTS configured? If not, please try that.
> 
> The above was w/o INVARIANTS. With invariants the kernel panics 
> immediately after boot, see pic.

Thanks. Could you please try applying the patch at the end of this email
and see if that fixes the issue? I have not yet tried to compile it,
sorry.

> 
> >> The previous revision, r323289 seems stable, at least it survived
> >> several kernel builds.
> > 
> > Could you apply the patch below and capture the first page or so of
> > output from after the kernel starts booting?
> 
> I applied this diff and you see its output on the pic:
> 
> https://people.freebsd.org/~andreast/r323290_generic64_with_dbg_patch.jpg
> 
> I try now to get that far that I have a kbd and capture a 'show page'.

I don't think that's necessary anymore given the information provided in
the picture.

diff --git a/sys/powerpc/aim/mmu_oea.c b/sys/powerpc/aim/mmu_oea.c
index 04066418fcc1..b576474fcd1d 100644
--- a/sys/powerpc/aim/mmu_oea.c
+++ b/sys/powerpc/aim/mmu_oea.c
@@ -287,6 +287,7 @@ boolean_t moea_is_referenced(mmu_t, vm_page_t);
 int moea_ts_referenced(mmu_t, vm_page_t);
 vm_offset_t moea_map(mmu_t, vm_offset_t *, vm_paddr_t, vm_paddr_t, int);
 boolean_t moea_page_exists_quick(mmu_t, pmap_t, vm_page_t);
+void moea_page_init(mmu_t, vm_page_t);
 int moea_page_wired_mappings(mmu_t, vm_page_t);
 void moea_pinit(mmu_t, pmap_t);
 void moea_pinit0(mmu_t, pmap_t);
@@ -334,6 +335,7 @@ static mmu_method_t moea_methods[] = {
 	MMUMETHOD(mmu_ts_referenced,	moea_ts_referenced),
 	MMUMETHOD(mmu_map,     		moea_map),
 	MMUMETHOD(mmu_page_exists_quick,moea_page_exists_quick),
+	MMUMETHOD(mmu_page_init,	moea_page_init),
 	MMUMETHOD(mmu_page_wired_mappings,moea_page_wired_mappings),
 	MMUMETHOD(mmu_pinit,		moea_pinit),
 	MMUMETHOD(mmu_pinit0,		moea_pinit0),
@@ -1594,6 +1596,15 @@ moea_page_exists_quick(mmu_t mmu, pmap_t pmap, vm_page_t m)
 	return (rv);
 }
 
+void
+moea_page_init(mmu_t mmu __unused, vm_page_t m)
+{
+
+	m->md.mdpg_attrs = 0;
+	m->md.mdpg_cache_attrs = VM_MEMATTR_DEFAULT;
+	LIST_INIT(&m->md.mdpg_pvoh);
+}
+
 /*
  * Return the number of managed mappings to the given physical page
  * that are wired.
diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c
index c0461ff57453..28c9c79916f1 100644
--- a/sys/powerpc/aim/mmu_oea64.c
+++ b/sys/powerpc/aim/mmu_oea64.c
@@ -251,6 +251,7 @@ boolean_t moea64_is_referenced(mmu_t, vm_page_t);
 int moea64_ts_referenced(mmu_t, vm_page_t);
 vm_offset_t moea64_map(mmu_t, vm_offset_t *, vm_paddr_t, vm_paddr_t, int);
 boolean_t moea64_page_exists_quick(mmu_t, pmap_t, vm_page_t);
+void moea64_page_init(mmu_t, vm_page_t);
 int moea64_page_wired_mappings(mmu_t, vm_page_t);
 void moea64_pinit(mmu_t, pmap_t);
 void moea64_pinit0(mmu_t, pmap_t);
@@ -298,6 +299,7 @@ static mmu_method_t moea64_methods[] = {
 	MMUMETHOD(mmu_ts_referenced,	moea64_ts_referenced),
 	MMUMETHOD(mmu_map,     		moea64_map),
 	MMUMETHOD(mmu_page_exists_quick,moea64_page_exists_quick),
+	MMUMETHOD(mmu_page_init,	moea64_page_init),
 	MMUMETHOD(mmu_page_wired_mappings,moea64_page_wired_mappings),
 	MMUMETHOD(mmu_pinit,		moea64_pinit),
 	MMUMETHOD(mmu_pinit0,		moea64_pinit0),
@@ -1898,6 +1900,15 @@ moea64_page_exists_quick(mmu_t mmu, pmap_t pmap, vm_page_t m)
 	return (rv);
 }
 
+void
+moea64_page_init(mmu_t mmu __unused, vm_page_t m)
+{
+
+	m->md.mdpg_attrs = 0;
+	m->md.mdpg_cache_attrs = VM_MEMATTR_DEFAULT;
+	LIST_INIT(&m->md.mdpg_pvoh);
+}
+
 /*
  * Return the number of managed mappings to the given physical page
  * that are wired.


More information about the svn-src-all mailing list