Re: Panic when starting X with Intel KMS

2013-07-21 Thread Konstantin Belousov
On Sat, Jul 20, 2013 at 01:20:56PM +0200, Oliver Pinter wrote:
 On 7/20/13, Gustau P?rez i Querol gpe...@entel.upc.edu wrote:
  Reading the backtrace I see this:
 
panic: pmap_release: pmap resident count -398580 != 0
 
  which comes from amd64/amd64/pmap.c:1936. I suspect that
  pmap-pm_stats.resident_count being negative is a bug.

The issue happened somewhere before the process exit.  Try the patch
below, the idea is that your overflow count is really big, so the
wrong-doer could cause underflow when acting.

diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 19be4e0..fcdc6af 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -465,6 +465,9 @@ pmap_resident_count_dec(pmap_t pmap, int count)
 {
 
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
+   KASSERT(pmap-pm_stats.resident_count = count,
+   (pmap %p resident count underflow %ld %d, pmap,
+   pmap-pm_stats.resident_count, count));
pmap-pm_stats.resident_count -= count;
 }
 


pgpxM5H2dUidH.pgp
Description: PGP signature


Re: Lenovo x220 - hangs on shutdown

2013-07-21 Thread Joel Dahl
On Tue, Jul 16, 2013 at 10:48:35PM +0200, Joel Dahl wrote:
 Hi,
 
 Yesterday I upgraded my Lenovo x220 to the latest current (r253368). Now it 
 hangs when I do a shutdown from an xterm. The screen just goes black and the 
 fan never spins down. It doesn't respond to ping.
 
 It didn't do this while I was running a current from mid-June.
 
 Any specific revision I should try to back out before I start a time 
 consuming binary search?

I found it. r252652 works. r252653 does not.

-- 
Joel
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Panic when starting X with Intel KMS

2013-07-21 Thread Gustau Pérez i Querol



The issue happened somewhere before the process exit.  Try the patch
below, the idea is that your overflow count is really big, so the
wrong-doer could cause underflow when acting.

diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 19be4e0..fcdc6af 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -465,6 +465,9 @@ pmap_resident_count_dec(pmap_t pmap, int count)
  {
  
  	PMAP_LOCK_ASSERT(pmap, MA_OWNED);

+   KASSERT(pmap-pm_stats.resident_count = count,
+   (pmap %p resident count underflow %ld %d, pmap,
+   pmap-pm_stats.resident_count, count));
pmap-pm_stats.resident_count -= count;
  }
  

   Hi,

   the assert doesn't happen (that's resident_count is not bigger than 
count). You can find the complete core at:


  https://dl.dropboxusercontent.com/u/2094962/core.txt.5

   I'm no expert on that, but would this mean that the process, while 
freeying mem, causes the kernel to free more maps than the process has?


   Any other info during the panic, let me know (I have a second 
machine and I can connect to it via serial port).


   OTOH, in puzzled because the stack gets corrupted an thus I can't 
check which is the offending process (I don't know if that would be of 
any use in this situation).  It is my understanding that isn't the 
process who should be fixed but the kernel side. In this case the stack 
corruption isn't that very important (at least this is what I think), 
but sometimes it is very handy.



--
   Salut i força,

   Gustau

---
Prou top-posting :  http://ca.wikipedia.org/wiki/Top-posting
Stop top-posting :  http://en.wikipedia.org/wiki/Posting_style  

O O O Gustau Pérez i Querol
O O O Unitat de Gestió dels departaments
O O O Matemàtica Aplicada IV i Enginyeria Telemàtica

  Universitat Politècnica de Catalunya
  Edifici C3 - Despatx S101-B
 UPC  Campus Nord UPC
  C/ Jordi Girona, 1-3
  08034 - Barcelona

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: expanding past 1 TB on amd64

2013-07-21 Thread Chris Torek
(Apologies for delay in reply, family issues)

I'd be fine with 4 TB instead of 16; and, at this point, with the latest
patches, it's easily tuned.  The auto-sizing of the direct map is not
affected by sparse space as it keys off Maxmem, which is not actually
physical size, but rather one past last valid physical page.

The direct map limit might not need to be twice kernel virtual size but
on Intel memory-controller systems needs to be greater than KVM size due
to moving DRAM up past the PCI hole.  Unless the restriction that the
direct-map area be a power of two size is removed, that winds up meaning
twice.  (Removing the restriction seems easy enough—instead of pa |
highbits to obtain VA and va ~ highbits to obtain PA, just use phys +
offset and virt - offset.  I didn't see a reason to bother with the
effort, though.)

Chris
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


where is the startkde file of kde4

2013-07-21 Thread Robin Lehrmann
hello mailing-list, 
I have installed kde4 on the current freebsd. 

Now I want to start it but I don't find the start script in /usr/local/kde4/bin

I try the scripts kde4 kded4 kdeinit4 but I get always the error $Display is 
Not Set 

how can I set the display or start kde4?

- Robin Lehrmann
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Lenovo x220 - hangs on shutdown

2013-07-21 Thread Adrian Chadd
Hi! Great catch!

Neel - any ideas why this change would stop Joel's machine from
cleanly shutting down?



-adrian

On 21 July 2013 00:20, Joel Dahl j...@freebsd.org wrote:
 On Tue, Jul 16, 2013 at 10:48:35PM +0200, Joel Dahl wrote:
 Hi,

 Yesterday I upgraded my Lenovo x220 to the latest current (r253368). Now it 
 hangs when I do a shutdown from an xterm. The screen just goes black and the 
 fan never spins down. It doesn't respond to ping.

 It didn't do this while I was running a current from mid-June.

 Any specific revision I should try to back out before I start a time 
 consuming binary search?

 I found it. r252652 works. r252653 does not.

 --
 Joel
 ___
 freebsd-current@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-current
 To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Lenovo x220 - hangs on shutdown

2013-07-21 Thread Konstantin Belousov
On Sun, Jul 21, 2013 at 09:20:45AM +0200, Joel Dahl wrote:
 On Tue, Jul 16, 2013 at 10:48:35PM +0200, Joel Dahl wrote:
  Hi,
  
  Yesterday I upgraded my Lenovo x220 to the latest current (r253368). Now it 
  hangs when I do a shutdown from an xterm. The screen just goes black and 
  the fan never spins down. It doesn't respond to ping.
  
  It didn't do this while I was running a current from mid-June.
  
  Any specific revision I should try to back out before I start a time 
  consuming binary search?
 
 I found it. r252652 works. r252653 does not.

What is the chipset on your machine ?

Do you have AMT ?  If yes, please configure serial over LAN using AMT
and use it for the console, to obtain the usual debugging information
from the kernel.  At least, 'ps' output from ddb is needed.



pgpQ99BKOxtME.pgp
Description: PGP signature


CFT: cloned_interfaces and gifconfig in rc.d/netif

2013-07-21 Thread Hiroki Sato
Hi,

 The attached patch allows rc.d/netif to create IFs in
 $cloned_interfaces when interface name(s) is specified.  For example,
 when the following lines are in rc.conf:

  cloned_interfaces=bridge0 bridge1
  ifconfig_bridge0=...
  ifconfig_bridge1=...

 The following commands create the interfaces and destroy them.

  # /etc/rc.d/netif start bridge0 bridge1
  # /etc/rc.d/netif stop bridge0 bridge1

 netif cloneup/clonedown does this without the patch, but it cannot
 configure the interfaces and does not support clean teardown.

 Also, routines which handle $gif_interfaces are merged into ones for
 $cloned_interfaces.  ifconfig_gifN and other variants did not work
 with gif interfaces defined in $gif_interfaces.  The patch solves
 this issue.

 Basically there should be no functionality regression for the
 existing configurations.  Can anyone who are using $gif_interfaces
 and/or $cloned_interfaces test this?  I would like to know if there is
 regression or not.

-- Hiroki
Index: etc/network.subr
===
--- etc/network.subr	(revision 253520)
+++ etc/network.subr	(working copy)
@@ -660,6 +660,11 @@
 	IFS=$_ifs
 	for _inet in $inetList ; do
 		# get rid of extraneous line
+		case $_inet in
+		)		break ;;
+		inet\ *)	;;
+		*)		continue ;;
+		esac
 		[ -z $_inet ]  break

 		_inet=`expr $_inet : '.*\(inet \([0-9]\{1,3\}\.\)\{3\}[0-9]\{1,3\}\).*'`
@@ -1192,12 +1197,17 @@
 #
 clone_up()
 {
-	local _prefix _list ifn
+	local _prefix _list ifn _iflist _n tmpargs
 	_prefix=
 	_list=
+	_iflist=$*

 	# create_args_IF
 	for ifn in ${cloned_interfaces}; do
+		case $_iflist in
+		|$ifn|$ifn\ *|*\ $ifn\ *|*\ $ifn)	;;
+		*)	continue ;;
+		esac
 		${IFCONFIG_CMD} ${ifn} create `get_if_var ${ifn} create_args_IF`
 		if [ $? -eq 0 ]; then
 			_list=${_list}${_prefix}${ifn}
@@ -1204,6 +1214,30 @@
 			[ -z $_prefix ]  _prefix=' '
 		fi
 	done
+	if [ -n $gif_interfaces ]; then
+		warn \$gif_interfaces is obsolete.  Use \$cloned_interfaces instead.
+	fi
+	for ifn in ${gif_interfaces}; do
+		case $_iflist in
+		|$ifn|$ifn\ *|*\ $ifn\ *|*\ $ifn)	;;
+		*)	continue ;;
+		esac
+		case $ifn in
+		gif[0-9]*)
+			${IFCONFIG_CMD} $ifn create
+		;;
+		*)
+			_n=$(${IFCONFIG_CMD} gif create)
+			${IFCONFIG_CMD} $_n name $ifn
+		;;
+		esac
+		if [ $? -eq 0 ]; then
+			_list=${_list}${_prefix}${ifn}
+			[ -z $_prefix ]  _prefix=' '
+		fi
+		tmpargs=$(get_if_var $ifn gifconfig_IF)
+		eval ifconfig_${ifn}=\tunnel \$tmpargs\
+	done
 	debug Cloned: ${_list}
 }

@@ -1213,11 +1247,16 @@
 #
 clone_down()
 {
-	local _prefix _list ifn
+	local _prefix _list ifn _iflist
 	_prefix=
 	_list=
+	_iflist=$*

-	for ifn in ${cloned_interfaces}; do
+	for ifn in ${cloned_interfaces} ${gif_interfaces}; do
+		case $_iflist in
+		|$ifn|$ifn\ *|*\ $ifn\ *|*\ $ifn)	;;
+		*)	continue ;;
+		esac
 		${IFCONFIG_CMD} -n ${ifn} destroy
 		if [ $? -eq 0 ]; then
 			_list=${_list}${_prefix}${ifn}
@@ -1224,6 +1263,9 @@
 			[ -z $_prefix ]  _prefix=' '
 		fi
 	done
+	if [ -n ${_list} ]; then
+		echo Destroyed clone interfaces: ${_list}.
+	fi
 	debug Destroyed clones: ${_list}
 }

@@ -1347,32 +1389,6 @@
 	done
 }

-# gif_up
-#	Create gif(4) tunnel interfaces.
-gif_up()
-{
-	local i peers
-
-	for i in ${gif_interfaces}; do
-		peers=`get_if_var $i gifconfig_IF`
-		case ${peers} in
-		'')
-			continue
-			;;
-		*)
-			if expr $i : 'gif[0-9][0-9]*$' /dev/null 21; then
-${IFCONFIG_CMD} $i create /dev/null 21
-			else
-gif=`${IFCONFIG_CMD} gif create`
-${IFCONFIG_CMD} $gif name $i
-			fi
-			${IFCONFIG_CMD} $i tunnel ${peers}
-			${IFCONFIG_CMD} $i up
-			;;
-		esac
-	done
-}
-
 # ng_fec_create ifn
 #	Configure Fast EtherChannel for interface $ifn. Returns 0 if
 #	FEC arguments were found and configured; returns !0 otherwise.
Index: etc/rc.d/netif
===
--- etc/rc.d/netif	(revision 253505)
+++ etc/rc.d/netif	(working copy)
@@ -60,18 +60,15 @@
 		# disable SIGINT (Ctrl-c) when running at startup
 		trap : 2

-		# Create cloned interfaces
-		clone_up
-
 		# Create Fast EtherChannel interfaces
 		fec_up
+	fi

-		# Create IPv6--IPv4 tunnels
-		gif_up
+	# Create cloned interfaces
+	clone_up $cmdifn

-		# Rename interfaces.
-		ifnet_rename
-	fi
+	# Rename interfaces.
+	ifnet_rename $cmdifn

 	# Configure the interface(s).
 	network_common ifn_start
@@ -101,6 +98,9 @@
 	# Deconfigure the interface(s)
 	network_common ifn_stop

+	# Destroy cloned interfaces
+	clone_down $cmdifn
+
 	if [ -f /etc/rc.d/routing -a -n $cmdifn ] ; then
 		for _if in $cmdifn; do
 			/etc/rc.d/routing stop any $_if


pgpTrmINvZNat.pgp
Description: PGP signature


Enabling clang/llvm for MIPS?

2013-07-21 Thread Adrian Chadd
Hiya,

I'd like to start doing test builds of the mips stuff (specifically
mips4kc, mips24k and mips74k) on freebsd-head with clang/llvm.

What changes are needed to the makefile framework to enable this?

Thanks,


-Adrian
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Panic when starting X with Intel KMS

2013-07-21 Thread Konstantin Belousov
On Sun, Jul 21, 2013 at 11:31:34AM +0200, Gustau P?rez i Querol wrote:
 
  The issue happened somewhere before the process exit.  Try the patch
  below, the idea is that your overflow count is really big, so the
  wrong-doer could cause underflow when acting.
 
  diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
  index 19be4e0..fcdc6af 100644
  --- a/sys/amd64/amd64/pmap.c
  +++ b/sys/amd64/amd64/pmap.c
  @@ -465,6 +465,9 @@ pmap_resident_count_dec(pmap_t pmap, int count)
{

  PMAP_LOCK_ASSERT(pmap, MA_OWNED);
  +   KASSERT(pmap-pm_stats.resident_count = count,
  +   (pmap %p resident count underflow %ld %d, pmap,
  +   pmap-pm_stats.resident_count, count));
  pmap-pm_stats.resident_count -= count;
}

 Hi,
 
 the assert doesn't happen (that's resident_count is not bigger than 
 count). You can find the complete core at:
 
https://dl.dropboxusercontent.com/u/2094962/core.txt.5
I do not understand what do you mean, it seems that core.txt.5 has
exactly the assertion fired which I added.

Show me the verbose dmesg, including the i915 driver attach.

Did the issue started at some moment, or it is a new install which
exhibit the problem from the beginning ?  As a blind shot, try to
revert r252653.

I am sure that the serial console would be useful, but I did not decided
yet on where to start looking.


pgplk0TLPExt6.pgp
Description: PGP signature


Re: Enabling clang/llvm for MIPS?

2013-07-21 Thread Dimitry Andric

On Jul 21, 2013, at 20:42, Adrian Chadd adr...@freebsd.org wrote:
 I'd like to start doing test builds of the mips stuff (specifically
 mips4kc, mips24k and mips74k) on freebsd-head with clang/llvm.
 
 What changes are needed to the makefile framework to enable this?

In share/mk/bsd.own.mk, modify these parts:

# Clang is only for x86, powerpc and little-endian arm right now, by default.
.if ${__T} == amd64 || ${__T} == i386 || ${__T:Mpowerpc*}
__DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL
.elif ${__T} == arm || ${__T} == armv6
__DEFAULT_YES_OPTIONS+=CLANG
# GCC is unable to build the full clang on arm, disable it by default.
__DEFAULT_NO_OPTIONS+=CLANG_FULL
.else
__DEFAULT_NO_OPTIONS+=CLANG CLANG_FULL
.endif
# Clang the default system compiler only on little-endian arm and x86.
.if ${__T} == amd64 || ${__T} == arm || ${__T} == armv6 || \
${__T} == i386
__DEFAULT_YES_OPTIONS+=CLANG_IS_CC
.else
__DEFAULT_NO_OPTIONS+=CLANG_IS_CC
.endif

The first part enables building clang, the second makes it the default
compiler.  I take it you only want the first one for now?

-Dimitry

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Panic when starting X with Intel KMS

2013-07-21 Thread Gustau Pérez i Querol

Al 21/07/2013 20:51, En/na Konstantin Belousov ha escrit:


 Hi,

 the assert doesn't happen (that's resident_count is not bigger than
count). You can find the complete core at:

https://dl.dropboxusercontent.com/u/2094962/core.txt.5
I do not understand what do you mean, it seems that core.txt.5 has
exactly the assertion fired which I added.


   I was trying to state what you suspected: the condition in the 
assert did not hold so the kernel paniced.



Show me the verbose dmesg, including the i915 driver attach.


   Will do it tomorrow morning (I'm UTC+1).


Did the issue started at some moment, or it is a new install which
exhibit the problem from the beginning ?
   It was an update of a three months old head machine. A dicotomic 
search would be a long process (I'd say).



As a blind shot, try to
revert r252653.


 I tried 252528 (I picked that randomly, only wanting to try to 
avoid r252695 and r252653 because they state they had to do with pmaps) 
and it works fine. Tomorrow I'm gonna revert to 252653 and 252652 and 
see what happens.


   OFFTOPIC: I used to track src via gitorious but they lag behind and 
the github repo hasn't the svn revisionm does anyone know of any other 
git repo with the svn revision?




I am sure that the serial console would be useful, but I did not decided
yet on where to start looking.


  Well, if you need some testing via serial be sure it will be possible.



--
   Salut i força,

   Gustau

---
Prou top-posting :  http://ca.wikipedia.org/wiki/Top-posting
Stop top-posting :  http://en.wikipedia.org/wiki/Posting_style  

O O O Gustau Pérez i Querol
O O O Unitat de Gestió dels departaments
O O O Matemàtica Aplicada IV i Enginyeria Telemàtica

  Universitat Politècnica de Catalunya
  Edifici C3 - Despatx S101-B
 UPC  Campus Nord UPC
  C/ Jordi Girona, 1-3
  08034 - Barcelona

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org

Re: Panic when starting X with Intel KMS

2013-07-21 Thread Andriy Gapon
on 21/07/2013 23:25 Gustau Pérez i Querol said the following:
 github repo hasn't the svn revision

The github repo does have svn revision numbers -- as git notes (google for this
term).

-- 
Andriy Gapon
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org

Re: Lenovo x220 - hangs on shutdown

2013-07-21 Thread Joel Dahl
On Sun, Jul 21, 2013 at 07:12:33PM +0300, Konstantin Belousov wrote:
 On Sun, Jul 21, 2013 at 09:20:45AM +0200, Joel Dahl wrote:
  On Tue, Jul 16, 2013 at 10:48:35PM +0200, Joel Dahl wrote:
   Hi,
   
   Yesterday I upgraded my Lenovo x220 to the latest current (r253368). Now 
   it hangs when I do a shutdown from an xterm. The screen just goes black 
   and the fan never spins down. It doesn't respond to ping.
   
   It didn't do this while I was running a current from mid-June.
   
   Any specific revision I should try to back out before I start a time 
   consuming binary search?
  
  I found it. r252652 works. r252653 does not.
 
 What is the chipset on your machine ?

Intel Core i7-2640M / Mobile Intel QM67 Express Chipset

 Do you have AMT ?  If yes, please configure serial over LAN using AMT
 and use it for the console, to obtain the usual debugging information
 from the kernel.  At least, 'ps' output from ddb is needed.

I found Intel (R) AMT Control in the BIOS. It's enabled. I haven't figured
out how it works yet though.



-- 
Joel
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Enabling clang/llvm for MIPS?

2013-07-21 Thread Warner Losh

On Jul 21, 2013, at 2:04 PM, Dimitry Andric wrote:

 
 On Jul 21, 2013, at 20:42, Adrian Chadd adr...@freebsd.org wrote:
 I'd like to start doing test builds of the mips stuff (specifically
 mips4kc, mips24k and mips74k) on freebsd-head with clang/llvm.
 
 What changes are needed to the makefile framework to enable this?
 
 In share/mk/bsd.own.mk, modify these parts:
 
 # Clang is only for x86, powerpc and little-endian arm right now, by default.
 .if ${__T} == amd64 || ${__T} == i386 || ${__T:Mpowerpc*}
 __DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL
 .elif ${__T} == arm || ${__T} == armv6
 __DEFAULT_YES_OPTIONS+=CLANG
 # GCC is unable to build the full clang on arm, disable it by default.
 __DEFAULT_NO_OPTIONS+=CLANG_FULL
 .else
 __DEFAULT_NO_OPTIONS+=CLANG CLANG_FULL
 .endif
 # Clang the default system compiler only on little-endian arm and x86.
 .if ${__T} == amd64 || ${__T} == arm || ${__T} == armv6 || \
${__T} == i386
 __DEFAULT_YES_OPTIONS+=CLANG_IS_CC
 .else
 __DEFAULT_NO_OPTIONS+=CLANG_IS_CC
 .endif
 
 The first part enables building clang, the second makes it the default
 compiler.  I take it you only want the first one for now?

make buildworld WITH_CLANG=t WITHOUT_CLANG_FULL=t WITHOUT_CLANG_IS_CC=t

Warner
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Fix for sys_munlock(2) with racct

2013-07-21 Thread Jeremie Le Hen
On Sat, Jul 20, 2013 at 08:33:35PM -0700, Alan Cox wrote:
 
 On Jul 20, 2013, at 4:22 AM, Jeremie Le Hen wrote:
 
  Hi Edward, Alan,
  
  I plan to commit the following patch:
  http://people.freebsd.org/~jlh/racct_munlock.diff
  
  This solves the following panic:
  
  panic: racct_sub: freeing 301989888 of resource 5, which is more than 
  allocated 73728 for pwsafe (pid 4177)
  
  The problem is that the racct code in sys_munlock() trusts too much the
  user's input.  vm_map_unwire_count() now returns how much memory has
  really been unwired.
  
  Any objection?
 
 
 Can you elaborate on what you mean by sys_munlock() trusts too much
 the user's input.   munlock(2) is supposed to return ENOMEM if any
 addresses within the specified range are not backed by valid mappings.
 (Valid mappings with PROT_NONE access are something of a gray area
 here.)  However, it is not error for a to call munlock() on a range
 that isn't locked, or to call it a second, third, etc. time on the
 same range.  Is that what is provoking your panic?

I'm using sysutils/pwsafe and it seems to mlock(2) 18 pages (end - start
= 73728 bytes) but then munlock(2) 73728 pages :-). vm_map_unwire()
seems to do the right thing with those buggy boundaries, but then the
racct code assumes that those boundaries were correct as long as
vm_map_unwire() returned successfully.  This is what causes the
assertion failure.


 By the way, sys_mlock() uses a simpler approach to deal with a similar
 situation:
 
 error = vm_map_wire(map, start, end, 
 VM_MAP_WIRE_USER | VM_MAP_WIRE_NOHOLES);
 #ifdef RACCT
 if (error != KERN_SUCCESS) {
 PROC_LOCK(proc);
 racct_set(proc, RACCT_MEMLOCK,
 ptoa(pmap_wired_count(map-pmap)));
 PROC_UNLOCK(proc);
 }
 #endif
 
 However, the code in sys_mlock() for maintaining RACCT_MEMLOCK,
 including the above snippet, is race-y.  Two simultaneous callers to
 sys_mlock() will produce incorrect results.  (I haven't looked at
 sys_mlockall() or vm_map_growstack().)

Ok, I will commit that as the first bandaid then.


 Also, a wired mapping can be destroyed by calling munmap(2) without
 first calling munlock(2), in which case, RACCT_MEMLOCK will be
 incorrect.

So I think the right way to tackle this is to handle racct in the vm
layer rather than at the syscall layer.

vm_fault_{wire,unwire}() look like natural places for this, but racct
functions require the struct proc to be locked.  Any idea how to handle
this?

-- 
Jeremie Le Hen

Scientists say the world is made up of Protons, Neutrons and Electrons.
They forgot to mention Morons.
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


NFSv4.1 server for testing/review

2013-07-21 Thread Rick Macklem
Hi,

Just in case anyone is interested, I have put an experimental
NFSv4.1 server in the svn repository under:
  projects/nfsv4.1-server

It lacks required support for backchannels. However, since it
never issues delegations at this point, it seems to work ok
against the extant NFSv4.1 clients that I have had the opportunity
to test it against.

I will be adding backchannel support sometime soon and hope to
merge it into head sometime after that.

rick
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org