From nobody@FreeBSD.org  Sun Oct 16 18:19:04 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0458C106566C
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 16 Oct 2011 18:19:04 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id E82E88FC0A
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 16 Oct 2011 18:19:03 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p9GIJ3w4010443
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 16 Oct 2011 18:19:03 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p9GIJ3xh010442;
	Sun, 16 Oct 2011 18:19:03 GMT
	(envelope-from nobody)
Message-Id: <201110161819.p9GIJ3xh010442@red.freebsd.org>
Date: Sun, 16 Oct 2011 18:19:03 GMT
From: Eugen Konkov <kes-kes@yandex.ru>
To: freebsd-gnats-submit@FreeBSD.org
Subject: compiling kernel with KVA_PAGES=512 does not allow system to boot
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         161721
>Category:       kern
>Synopsis:       [boot] compiling kernel with KVA_PAGES=512 does not allow system to boot
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    alc
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 16 18:20:07 UTC 2011
>Closed-Date:    Sat Jan 21 08:28:41 UTC 2012
>Last-Modified:  Sat Jan 21 08:30:11 UTC 2012
>Originator:     Eugen Konkov
>Release:        
>Organization:
ISP FreeLine
>Environment:
FreeBSD flux 9.0-CURRENT FreeBSD 9.0-CURRENT #4: Fri Jun 10 01:30:12 UTC 2011     @:/usr/obj/usr/src/sys/KES_KERN_v9  i386
>Description:
adding option to KERNCONF

options KVA_PAGES=512

does not allow system to boot.


FreeBSD must tune sysctl variables itself. at least to that values that
allow system to boot and WARN user for that tuning!

In other words: changing KVA_PAGES must affect vm.kmem_size and vm.kmem_size_max
>How-To-Repeat:

>Fix:
You must make additional tuning in /boot/loader.conf:

vm.kmem_size="330M"
vm.kmem_size_max="330M"
vfs.zfs.arc_max="40M"
vfs.zfs.vdev.cache.size="5M"

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-i386->freebsd-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sun Oct 16 23:01:31 UTC 2011 
Responsible-Changed-Why:  
This does not sound i386-specific. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=161721 
State-Changed-From-To: open->closed 
State-Changed-By: remko 
State-Changed-When: Tue Oct 18 18:27:15 UTC 2011 
State-Changed-Why:  
If you fiddle with kernel settings you should be aware of what you are 
doing. The KVA pages is a problem that popped up before and is mentioned 
enough. I do not think this is a PR worth, apologies if this offends 
you. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=161721 
State-Changed-From-To: closed->open 
State-Changed-By: remko 
State-Changed-When: Thu Oct 20 19:22:24 UTC 2011 
State-Changed-Why:  
Per request of Alan, reopen the ticket and assign it to him. 
Thanks for taking care of this Alan! 


Responsible-Changed-From-To: freebsd-bugs->alc 
Responsible-Changed-By: remko 
Responsible-Changed-When: Thu Oct 20 19:22:24 UTC 2011 
Responsible-Changed-Why:  
Per request of Alan, reopen the ticket and assign it to him. 
Thanks for taking care of this Alan! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=161721 

From: Mark Linimon <linimon@lonesome.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/161721: [boot] compiling kernel with KVA_PAGES=512 does
 not allow system to boot
Date: Sat, 22 Oct 2011 01:57:49 -0500

 ----- Forwarded message from Alan Cox <alc@rice.edu> -----
 
 Date: Thu, 20 Oct 2011 12:28:14 -0500
 From: Alan Cox <alc@rice.edu>
 To: Remko Lodder <remko@elvandar.org>
 Cc: alc@FreeBSD.org, Коньков Евгений <kes-kes@yandex.ru>,
 	freebsd-bugs@FreeBSD.org
 Subject: Re: kern/161721: [boot] compiling kernel with KVA_PAGES=512 does
 	not allow system to boot
 
 Kes,
 
 Your problem report doesn't include any details on the panic that
 occurs.  Could you please provide this?
 
 Is this problem occurring with or without the use of PAE?  If I
 presume that you are not using PAE, then setting KVA_PAGES to 512
 makes the kernel address space 2 GB in size.
 
 Have you ever tried a slightly smaller setting for KVA_PAGES, for
 example, 508?
 
 Remko,
 
 I suspect this a bug, specifically, arithmetic overflow is occurring
 somewhere because 32-bit arithmetic is being used and the kernel
 address space is 2^31 bytes in size.
 
 I would recommend that you reopen this PR, and assign it to me.  While
 you can certainly shoot yourself in the foot by messing with low-level
 configuration, like KVA_PAGES, in this case, I think we may have a
 bug.
 
 Alan
 
 ----- End forwarded message -----

From: Mark Linimon <linimon@lonesome.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/161721: [boot] compiling kernel with KVA_PAGES=512 does
 not allow system to boot
Date: Sat, 22 Oct 2011 01:58:15 -0500

 ----- Forwarded message from remko@FreeBSD.org -----
 
 Date: Thu, 20 Oct 2011 19:23:03 GMT
 From: remko@FreeBSD.org
 To: kes-kes@yandex.ru, remko@FreeBSD.org, freebsd-bugs@FreeBSD.org,
 	alc@FreeBSD.org
 Subject: Re: kern/161721: [boot] compiling kernel with KVA_PAGES=512 does
 	not allow system to boot
 
 Synopsis: [boot] compiling kernel with KVA_PAGES=512 does not allow system to boot
 
 State-Changed-From-To: closed->open
 State-Changed-By: remko
 State-Changed-When: Thu Oct 20 19:22:24 UTC 2011
 State-Changed-Why: 
 Per request of Alan, reopen the ticket and assign it to him.
 Thanks for taking care of this Alan!
 
 ----- End forwarded message -----

From: Mark Linimon <linimon@lonesome.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/161721: [boot] compiling kernel with KVA_PAGES=512 does
 not allow system to boot
Date: Sat, 22 Oct 2011 02:00:00 -0500

 ----- Forwarded message from Коньков Евгений <kes-kes@yandex.ru> -----
 
 Date: Thu, 20 Oct 2011 22:25:59 +0300
 From: Коньков Евгений <kes-kes@yandex.ru>
 To: Alan Cox <alc@rice.edu>
 Cc: alc@FreeBSD.org, freebsd-bugs@FreeBSD.org,
 	Remko Lodder <remko@elvandar.org>
 Subject: Re[2]: kern/161721: [boot] compiling kernel with KVA_PAGES=512 does
 	not allow system to boot
 
    I get system halted on this stage:
 
    Oct 10 13:52:22 syslogd: kernel boot file is /boot/kernel/kernel
    Oct 10 13:52:22 kernel: Copyright (c) 1992-2011 The FreeBSD Project.
    Oct 10 13:52:22 kernel: Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
    Oct 10 13:52:22 kernel: The Regents of the University of California.  All rights reserved.
    Oct 10 13:52:22 kernel: FreeBSD is a registered trademark of The FreeBSD Foundation.
    Oct 10 13:52:22 kernel: FreeBSD 9.0-BETA2 #11: Thu Oct 6 18:02:28 EEST 2011
    Oct 10 13:52:22 kernel: @:/usr/obj/usr/src/sys/KES_KERN_v9 i386
 
    But as I discover later it was a bug (problem) with KVA_PAGES, I have
    added that option to GENERIC
 
    and in new installed slice I have no /boot/loader.conf file, so system
    is halt.
 
    on old slice I have /boot/loader.conf, so I have no problem with
    KVA_PAGES option.
 
    I know, that FreeBSD automatically reboot if something nasty is
    happen.
 
    but in this case even no coredumps are present.
 
    > Is this problem occurring with or without the use of PAE?  If I
    > presume that you are not using PAE, then setting KVA_PAGES to 512
    > makes the kernel address space 2 GB in size.
 
    > Have you ever tried a slightly smaller setting for KVA_PAGES, for
    > example, 508?
 
    Ok, I will try 508 and report results.
 
    --
 
    S uvazheniem,
 
     Kon'kov                          [7]mailto:kes-kes@yandex.ru
 
 References
 
    1. http://www.freebsd.org/cgi/query-pr.cgi?pr=161458
    2. http://www.freebsd.org/cgi/query-pr.cgi?pr=161721
    3. mailto:kes-kes@yandex.ru
    4. mailto:remko@elvandar.org
    5. mailto:remko@FreeBSD.org
    6. http://www.evilcoder.org/
    7. mailto:kes-kes@yandex.ru
 _______________________________________________
 freebsd-bugs@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
 To unsubscribe, send any mail to "freebsd-bugs-unsubscribe@freebsd.org"
 
 
 ----- End forwarded message -----

From: =?windows-1251?B?yu7t/Oru4iDF4uPl7ejp?= <kes-kes@yandex.ru>
To: bug-followup@FreeBSD.org, kes-kes@yandex.ru
Cc:  
Subject: Re: kern/161721: [boot] compiling kernel with KVA_PAGES=512 does not allow system to boot
Date: Mon, 5 Dec 2011 02:30:53 +0200

 with KVA_PAGES = 508 it is booted OK
 
 
State-Changed-From-To: open->patched 
State-Changed-By: alc 
State-Changed-When: Sat Dec 10 18:44:45 UTC 2011 
State-Changed-Why:  
A fix has been applied to HEAD. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=161721 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/161721: commit references a PR
Date: Sat, 10 Dec 2011 18:42:14 +0000 (UTC)

 Author: alc
 Date: Sat Dec 10 18:42:00 2011
 New Revision: 228398
 URL: http://svn.freebsd.org/changeset/base/228398
 
 Log:
   Avoid the possibility of integer overflow in the calculation of
   VM_KMEM_SIZE_MAX.  Specifically, if the user/kernel address space split
   was changed such that the kernel address space was greater than or equal
   to 2 GB, then overflow would occur.
   
   PR:		161721
   MFC after:	3 weeks
 
 Modified:
   head/sys/i386/include/vmparam.h
 
 Modified: head/sys/i386/include/vmparam.h
 ==============================================================================
 --- head/sys/i386/include/vmparam.h	Sat Dec 10 18:35:26 2011	(r228397)
 +++ head/sys/i386/include/vmparam.h	Sat Dec 10 18:42:00 2011	(r228398)
 @@ -186,11 +186,12 @@
  #endif
  
  /*
 - * Ceiling on amount of kmem_map kva space.
 + * Ceiling on the amount of kmem_map KVA space: 40% of the entire KVA space
 + * rounded to the nearest multiple of the superpage size.
   */
  #ifndef VM_KMEM_SIZE_MAX
 -#define	VM_KMEM_SIZE_MAX	((VM_MAX_KERNEL_ADDRESS - \
 -    VM_MIN_KERNEL_ADDRESS) * 2 / 5)
 +#define	VM_KMEM_SIZE_MAX	(((((VM_MAX_KERNEL_ADDRESS - \
 +    VM_MIN_KERNEL_ADDRESS) >> (PDRSHIFT - 2)) + 5) / 10) << PDRSHIFT)
  #endif
  
  /* initial pagein size of beginning of executable file */
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: alc 
State-Changed-When: Sat Jan 21 08:27:39 UTC 2012 
State-Changed-Why:  
All affected branches have been fixed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=161721 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/161721: commit references a PR
Date: Sat, 21 Jan 2012 08:26:56 +0000 (UTC)

 Author: alc
 Date: Sat Jan 21 08:26:41 2012
 New Revision: 230421
 URL: http://svn.freebsd.org/changeset/base/230421
 
 Log:
   MFC r228398
     Avoid the possibility of integer overflow in the calculation of
     VM_KMEM_SIZE_MAX.  Specifically, if the user/kernel address space split
     was changed such that the kernel address space was greater than or equal
     to 2 GB, then overflow would occur.
   
   PR:		161721
 
 Modified:
   stable/9/sys/i386/include/vmparam.h
 Directory Properties:
   stable/9/sys/   (props changed)
   stable/9/sys/amd64/include/xen/   (props changed)
   stable/9/sys/boot/   (props changed)
   stable/9/sys/boot/i386/efi/   (props changed)
   stable/9/sys/boot/ia64/efi/   (props changed)
   stable/9/sys/boot/ia64/ski/   (props changed)
   stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
   stable/9/sys/boot/powerpc/ofw/   (props changed)
   stable/9/sys/cddl/contrib/opensolaris/   (props changed)
   stable/9/sys/conf/   (props changed)
   stable/9/sys/contrib/dev/acpica/   (props changed)
   stable/9/sys/contrib/octeon-sdk/   (props changed)
   stable/9/sys/contrib/pf/   (props changed)
   stable/9/sys/contrib/x86emu/   (props changed)
 
 Modified: stable/9/sys/i386/include/vmparam.h
 ==============================================================================
 --- stable/9/sys/i386/include/vmparam.h	Sat Jan 21 07:57:27 2012	(r230420)
 +++ stable/9/sys/i386/include/vmparam.h	Sat Jan 21 08:26:41 2012	(r230421)
 @@ -186,11 +186,12 @@
  #endif
  
  /*
 - * Ceiling on amount of kmem_map kva space.
 + * Ceiling on the amount of kmem_map KVA space: 40% of the entire KVA space
 + * rounded to the nearest multiple of the superpage size.
   */
  #ifndef VM_KMEM_SIZE_MAX
 -#define	VM_KMEM_SIZE_MAX	((VM_MAX_KERNEL_ADDRESS - \
 -    VM_MIN_KERNEL_ADDRESS) * 2 / 5)
 +#define	VM_KMEM_SIZE_MAX	(((((VM_MAX_KERNEL_ADDRESS - \
 +    VM_MIN_KERNEL_ADDRESS) >> (PDRSHIFT - 2)) + 5) / 10) << PDRSHIFT)
  #endif
  
  /* initial pagein size of beginning of executable file */
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
