Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Jan 2015 10:11:22 +0100
From:      Lars Engels <lars.engels@0x20.net>
To:        Allan Jude <allanjude@freebsd.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: [PATCH] Display progress during getmemsize() so the kernel doesn't look like it hanged
Message-ID:  <20150113091122.GK67556@e-new.0x20.net>
In-Reply-To: <54B35B36.4040504@freebsd.org>
References:  <D0D89A8E.129518%rpokala@panasas.com> <54B35B36.4040504@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--9Jdw4pA1x1k2W7MG
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Jan 12, 2015 at 12:27:18AM -0500, Allan Jude wrote:
> On 2015-01-12 00:24, Pokala, Ravi wrote:
> > Hi folks,
> >=20
> > Several of us have noticed that there's a long pause at the start of
> > booting the kernel on amd64 systems with large amounts of RAM. During t=
his
> > pause, the kernel is mapping in the memory ranges, but does not emit any
> > progress indicators. Because this can take quite a while, it can look l=
ike
> > the kernel has hung. I filed PR 196650 about this issue; this patch just
> > prints out a dot for every GB that's mapped in. We've been using this
> > patch for years at Panasas, and I'm hoping someone can submit it for me.
> >=20
> > Thanks,
> >=20
> > Ravi
> >=20
> >=20
> > Index: sys/amd64/amd64/machdep.c
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> > --- sys/amd64/amd64/machdep.c	(revision 276903)
> > +++ sys/amd64/amd64/machdep.c	(working copy)
> > @@ -1575,6 +1575,9 @@
> >  	u_long physmem_start, physmem_tunable, memtest;
> >  	pt_entry_t *pte;
> >  	quad_t dcons_addr, dcons_size;
> > +	u_int32_t page_counter;
> > +	int PAGES_PER_MB =3D ((1024 * 1024) / PAGE_SIZE);
> > +	int PAGES_PER_GB =3D (PAGES_PER_MB * 1024);
> > =20
> >  	bzero(physmap, sizeof(physmap));
> >  	basemem =3D 0;
> > @@ -1678,6 +1681,8 @@
> >  	 * physmap is in bytes, so when converting to page boundaries,
> >  	 * round up the start address and round down the end address.
> >  	 */
> > +	printf("Mapping system memory");
> > +	page_counter =3D 0;
> >  	for (i =3D 0; i <=3D physmap_idx; i +=3D 2) {
> >  		vm_paddr_t end;
> > =20
> > @@ -1688,6 +1693,14 @@
> >  			int tmp, page_bad, full;
> >  			int *ptr =3D (int *)CADDR1;
> > =20
> > +			/*
> > +			 * Print a "." every GB, to show we're making progress
> > +			 */
> > +			page_counter++;
> > +			if ((page_counter % PAGES_PER_GB) =3D=3D 0) {
> > +				printf(".");
> > +			}
> > +
> >  			full =3D FALSE;
> >  			/*
> >  			 * block out kernel memory as not available.
> > @@ -1792,6 +1805,9 @@
> >  				break;
> >  		}
> >  	}
> > +	printf("\nMapped %d GB + %d MB total\n",
> > +	    (page_counter / PAGES_PER_GB),
> > +	    ((page_counter % PAGES_PER_GB) / PAGES_PER_MB));
> >  	*pte =3D 0;
> >  	invltlb();
> > =20
> >=20
> >=20
> > _______________________________________________
> > freebsd-hackers@freebsd.org mailing list
> > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.o=
rg"
> >=20
>=20
> Which version(s) of FreeBSD were you seeing this delay on?
>=20
> I know older versions had it, quite badly.
>=20
> setting hw.memtest.tests=3D0 in /boot/loader.conf makes most of the delay
> go away, and the default on -CURRENT is now 0 instead of 1.
>=20
> IIRC, in 10, it defaults to 1, but is switched to 0 in the case of
> virtual machines, because touching every page of memory ruined memory
> over-commit type features.
>=20
> Is this feature still useful with memtest.tests=3D0?

This feature is useful for everyone who has it set to 1, if they know
about it or not. So it's a very useful feature.

--9Jdw4pA1x1k2W7MG
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQF8BAEBCgBmBQJUtOE6XxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ4RjQwMDE3RTRERjUzMTI1N0FGRTUxNDlF
NTRDQjM3RDNBMDg5RDZEAAoJEOVMs306CJ1trFUH/iOnxon1rZIsHxGVUbE5/gdz
2WSkNeLSjOvXSjinInDcOV4nE3TIEVH+FIL8SqOceM1zCwIiGuRU6Wh0VPlU2nlD
thM20CU7aqhY+JXvSt9wEhONspDcCDTpF+xDLVH/HHKbj1d6DnolYMQQ6NSrulym
raRlMzsA8hjo6VRSR9F/dQYTDnFhm4hA4yb3M1eNNSmwGyeSJdOey1EN/JLQagBZ
1spwt4Kw6lptf+HexqAkTOx677CCm/4DyOy1PFOBdLBC+78zE+dWFlW/XZ1nk7L2
IjRY9wbU66ZSRE4zqZU4JlDA4huFgMRBeSbWuOdpoYMuqPNIVGguSHzZYOGxDDs=
=St1w
-----END PGP SIGNATURE-----

--9Jdw4pA1x1k2W7MG--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150113091122.GK67556>