Re: svn commit: r225937 - in head: . release release/amd64 release/i386 release/ia64 release/pc98 release/powerpc release/scripts release/sparc64 usr.sbin usr.sbin/sysinstall

2011-10-04 Thread Craig Rodrigues
On Mon, Oct 3, 2011 at 6:35 PM, Daniel O'Connor docon...@gsoft.com.au wrote:

 No it can't, but speaking as someone who used this feature in sysinstall… 
 Good riddance :)

 I wrote a shell script which does an install itself (i.e. no bsdinstall - 
 which is just [mostly] a shell script).

 It is 200 lines, a fair chunk of which is pre-canned stuff to go into 
 rc.conf, loader.conf, etc..

 http://www.gsoft.com.au/~doconnor/install-os.sh

 I also modified the rc.local script the installer uses to add an option to 
 call my script.

Hi,

Indeed, I have written my own Bourne shell based installers
for FreeBSD in two different companies I have worked for.
The path you went down to do this is not uncommon.many
people walk down the same path to write in their own installer in
shell scripts, and the results are often better than sysinstall.

However, I have seen at least two places which have written Jumpstart/Kickstart
based installers based on sysinstall.  This use case is not uncommon.
For example, using an install.cfg was documented here, and people
have followed it:
http://www.freebsd.org/doc/en/articles/pxe/article.html


If in the 10.0 timeframe, if we can provide something (bsdinstall,
pc-sysinstall, whatever) that has some compatibility with the old
sysinstall scripted syntax, that would be nice for users who have
built installers based on this stuff.

-- 
Craig Rodrigues
rodr...@crodrigues.org
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r225937 - in head: . release release/amd64 release/i386 release/ia64 release/pc98 release/powerpc release/scripts release/sparc64 usr.sbin usr.sbin/sysinstall

2011-10-04 Thread Daniel O'Connor

On 04/10/2011, at 17:09, Craig Rodrigues wrote:
 However, I have seen at least two places which have written 
 Jumpstart/Kickstart
 based installers based on sysinstall.  This use case is not uncommon.
 For example, using an install.cfg was documented here, and people
 have followed it:
 http://www.freebsd.org/doc/en/articles/pxe/article.html
 
 
 If in the 10.0 timeframe, if we can provide something (bsdinstall,
 pc-sysinstall, whatever) that has some compatibility with the old
 sysinstall scripted syntax, that would be nice for users who have
 built installers based on this stuff.
 

I suspect this would be problematic because bsdinstall is architected 
differently to sysinstall and the later's scripting is based on calling various 
C functions :(

Also things like dist names are different..

Don't let me stop you writing it though ;)

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






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


svn commit: r225973 - in head/sys/arm: arm include

2011-10-04 Thread Konstantin Belousov
Author: kib
Date: Tue Oct  4 13:14:24 2011
New Revision: 225973
URL: http://svn.freebsd.org/changeset/base/225973

Log:
  Convert ARM to the syscallenter/syscallret system call sequence handlers.
  
  Tested by:gber
  MFC after:1 month

Modified:
  head/sys/arm/arm/elf_machdep.c
  head/sys/arm/arm/trap.c
  head/sys/arm/include/proc.h

Modified: head/sys/arm/arm/elf_machdep.c
==
--- head/sys/arm/arm/elf_machdep.c  Tue Oct  4 13:05:07 2011
(r225972)
+++ head/sys/arm/arm/elf_machdep.c  Tue Oct  4 13:14:24 2011
(r225973)
@@ -76,7 +76,7 @@ struct sysentvec elf32_freebsd_sysvec = 
.sv_maxssiz = NULL,
.sv_flags   = SV_ABI_FREEBSD | SV_ILP32,
.sv_set_syscall_retval = cpu_set_syscall_retval,
-   .sv_fetch_syscall_args = NULL, /* XXXKIB */
+   .sv_fetch_syscall_args = cpu_fetch_syscall_args,
.sv_syscallnames = syscallnames,
.sv_schedtail   = NULL,
 };

Modified: head/sys/arm/arm/trap.c
==
--- head/sys/arm/arm/trap.c Tue Oct  4 13:05:07 2011(r225972)
+++ head/sys/arm/arm/trap.c Tue Oct  4 13:14:24 2011(r225973)
@@ -861,98 +861,68 @@ badaddr_read(void *addr, size_t size, vo
return (rv);
 }
 
-#define MAXARGS8
+int
+cpu_fetch_syscall_args(struct thread *td, struct syscall_args *sa)
+{
+   struct proc *p;
+   register_t *ap;
+   int error;
+
+   sa-code = sa-insn  0x000f;
+   ap = td-td_frame-tf_r0;
+   if (sa-code == SYS_syscall) {
+   sa-code = *ap++;
+   sa-nap--;
+   } else if (sa-code == SYS___syscall) {
+   sa-code = ap[_QUAD_LOWWORD];
+   sa-nap -= 2;
+   ap += 2;
+   }
+   p = td-td_proc;
+   if (p-p_sysent-sv_mask)
+   sa-code = p-p_sysent-sv_mask;
+   if (sa-code = p-p_sysent-sv_size)
+   sa-callp = p-p_sysent-sv_table[0];
+   else
+   sa-callp = p-p_sysent-sv_table[sa-code];
+   sa-narg = sa-callp-sy_narg;
+   error = 0;
+   memcpy(sa-args, ap, sa-nap * sizeof(register_t));
+   if (sa-narg  sa-nap) {
+   error = copyin((void *)td-td_frame-tf_usr_sp, sa-args +
+   sa-nap, (sa-narg - sa-nap) * sizeof(register_t));
+   }
+   if (error == 0) {
+   td-td_retval[0] = 0;
+   td-td_retval[1] = 0;
+   }
+   return (error);
+}
+
+#include ../../kern/subr_syscall.c
+
 static void
 syscall(struct thread *td, trapframe_t *frame, u_int32_t insn)
 {
-   struct proc *p = td-td_proc;
-   int code, error;
-   u_int nap, nargs;
-   register_t *ap, *args, copyargs[MAXARGS];
-   struct sysent *callp;
+   struct syscall_args sa;
+   int error;
 
-   PCPU_INC(cnt.v_syscall);
-   td-td_pticks = 0;
-   if (td-td_ucred != td-td_proc-p_ucred)
-   cred_update_thread(td);
+   td-td_frame = frame;
+   sa.insn = insn;
switch (insn  SWI_OS_MASK) {
case 0: /* XXX: we need our own one. */
-   nap = 4;
+   sa.nap = 4;
break;
default:
call_trapsignal(td, SIGILL, 0);
userret(td, frame);
return;
}
-   code = insn  0x000f;
-   td-td_pticks = 0;
-   ap = frame-tf_r0;
-   if (code == SYS_syscall) {
-   code = *ap++;
-   
-   nap--;
-   } else if (code == SYS___syscall) {
-   code = ap[_QUAD_LOWWORD];
-   nap -= 2;
-   ap += 2;
-   }
-   if (p-p_sysent-sv_mask)
-   code = p-p_sysent-sv_mask;
-   if (code = p-p_sysent-sv_size)
-   callp = p-p_sysent-sv_table[0];
-   else
-   callp = p-p_sysent-sv_table[code];
-   nargs = callp-sy_narg;
-   memcpy(copyargs, ap, nap * sizeof(register_t));
-   if (nargs  nap) {
-   error = copyin((void *)frame-tf_usr_sp, copyargs + nap,
-   (nargs - nap) * sizeof(register_t));
-   if (error)
-   goto bad;
-   }
-   args = copyargs;
-   error = 0;
-#ifdef KTRACE
-   if (KTRPOINT(td, KTR_SYSCALL))
-   ktrsyscall(code, nargs, args);
-#endif
-   
-   CTR4(KTR_SYSC, syscall enter thread %p pid %d proc %s code %d, td,
-   td-td_proc-p_pid, td-td_name, code);
-   if (error == 0) {
-   td-td_retval[0] = 0;
-   td-td_retval[1] = 0;
-   STOPEVENT(p, S_SCE, callp-sy_narg);
-   PTRACESTOP_SC(p, td, S_PT_SCE);
-   AUDIT_SYSCALL_ENTER(code, td);
-   error = (*callp-sy_call)(td, args);
-   AUDIT_SYSCALL_EXIT(error, td);
-   KASSERT(td-td_ar == NULL, 
-   

svn commit: r225974 - head/lib/libc/sys

2011-10-04 Thread Konstantin Belousov
Author: kib
Date: Tue Oct  4 13:15:12 2011
New Revision: 225974
URL: http://svn.freebsd.org/changeset/base/225974

Log:
  Remove no longer valid statement about ARM.
  
  MFC after:1 month

Modified:
  head/lib/libc/sys/ptrace.2

Modified: head/lib/libc/sys/ptrace.2
==
--- head/lib/libc/sys/ptrace.2  Tue Oct  4 13:14:24 2011(r225973)
+++ head/lib/libc/sys/ptrace.2  Tue Oct  4 13:15:12 2011(r225974)
@@ -2,7 +2,7 @@
 .\$NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $
 .\
 .\ This file is in the public domain.
-.Dd January 23, 2011
+.Dd October 3, 2011
 .Dt PTRACE 2
 .Os
 .Sh NAME
@@ -606,4 +606,4 @@ The
 .Dv PL_FLAG_SCX
 and
 .Dv PL_FLAG_EXEC
-are not implemented for MIPS and ARM architectures.
+are not implemented for MIPS architecture.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r225977 - head/sys/pc98/pc98

2011-10-04 Thread Takahashi Yoshihiro
Author: nyan
Date: Tue Oct  4 13:24:22 2011
New Revision: 225977
URL: http://svn.freebsd.org/changeset/base/225977

Log:
  MFi386: revision 225936
  
Add some improvements in the idle table callbacks:
- Replace instances of manual assembly instruction hlt call
  with halt() function calling.
- In cpu_idle_mwait() avoid races in check to sched_runnable() using
  the same pattern used in cpu_idle_hlt() with the 'hlt' instruction.
- Add comments explaining the logic behind the pattern used in
  cpu_idle_hlt() and other idle callbacks.

Modified:
  head/sys/pc98/pc98/machdep.c

Modified: head/sys/pc98/pc98/machdep.c
==
--- head/sys/pc98/pc98/machdep.cTue Oct  4 13:19:21 2011
(r225976)
+++ head/sys/pc98/pc98/machdep.cTue Oct  4 13:24:22 2011
(r225977)
@@ -1117,7 +1117,7 @@ void
 cpu_halt(void)
 {
for (;;)
-   __asm__ (hlt);
+   halt();
 }
 
 static int idle_mwait = 1; /* Use MONITOR/MWAIT for short idle. */
@@ -1136,9 +1136,22 @@ cpu_idle_hlt(int busy)
 
state = (int *)PCPU_PTR(monitorbuf);
*state = STATE_SLEEPING;
+
/*
-* We must absolutely guarentee that hlt is the next instruction
-* after sti or we introduce a timing window.
+* Since we may be in a critical section from cpu_idle(), if
+* an interrupt fires during that critical section we may have
+* a pending preemption.  If the CPU halts, then that thread
+* may not execute until a later interrupt awakens the CPU.
+* To handle this race, check for a runnable thread after
+* disabling interrupts and immediately return if one is
+* found.  Also, we must absolutely guarentee that hlt is
+* the next instruction after sti.  This ensures that any
+* interrupt that fires after the call to disable_intr() will
+* immediately awaken the CPU from hlt.  Finally, please note
+* that on x86 this works fine because of interrupts enabled only
+* after the instruction following sti takes place, while IF is set
+* to 1 immediately, allowing hlt instruction to acknowledge the
+* interrupt.
 */
disable_intr();
if (sched_runnable())
@@ -1164,11 +1177,19 @@ cpu_idle_mwait(int busy)
 
state = (int *)PCPU_PTR(monitorbuf);
*state = STATE_MWAIT;
-   if (!sched_runnable()) {
-   cpu_monitor(state, 0, 0);
-   if (*state == STATE_MWAIT)
-   cpu_mwait(0, MWAIT_C1);
+
+   /* See comments in cpu_idle_hlt(). */
+   disable_intr();
+   if (sched_runnable()) {
+   enable_intr();
+   *state = STATE_RUNNING;
+   return;
}
+   cpu_monitor(state, 0, 0);
+   if (*state == STATE_MWAIT)
+   __asm __volatile(sti; mwait : : a (MWAIT_C1), c (0));
+   else
+   enable_intr();
*state = STATE_RUNNING;
 }
 
@@ -1180,6 +1201,12 @@ cpu_idle_spin(int busy)
 
state = (int *)PCPU_PTR(monitorbuf);
*state = STATE_RUNNING;
+
+   /*
+* The sched_runnable() call is racy but as long as there is
+* a loop missing it one time will have just a little impact if any 
+* (and it is much better than missing the check at all).
+*/
for (i = 0; i  1000; i++) {
if (sched_runnable())
return;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r225937 - in head: . release release/amd64 release/i386 release/ia64 release/pc98 release/powerpc release/scripts release/sparc64 usr.sbin usr.sbin/sysinstall

2011-10-04 Thread Nathan Whitehorn

On 10/03/11 20:35, Daniel O'Connor wrote:

On 04/10/2011, at 8:41, Craig Rodrigues wrote:

Can bsdinstall be used as a drop-in replacement for
sysinstall when run with the SCRIPT SYNTAX batch mode?
If not, how much code would need to be added to bsdinstall?  Or, is there
some other utility, such as something from the PC-BSD suite of scripts,
that can be used as a drop-in replacement for sysinstall in SCRIPT
SYNTAX mode?

No it can't, but speaking as someone who used this feature in sysinstall… Good 
riddance :)

I wrote a shell script which does an install itself (i.e. no bsdinstall - which 
is just [mostly] a shell script).

It is 200 lines, a fair chunk of which is pre-canned stuff to go into rc.conf, 
loader.conf, etc..

http://www.gsoft.com.au/~doconnor/install-os.sh

I also modified the rc.local script the installer uses to add an option to call 
my script.



Although pc-sysinstall is probably the [much] better choice for 
scripting, there are facilities in bsdinstall to help writing of custom 
installers like this, and the regular installer is in fact an example of 
a scripted install. There's some more information in bsdinstall(8) for 
the curious.

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


svn commit: r225979 - head/usr.bin/csup

2011-10-04 Thread Adrian Chadd
Author: adrian
Date: Tue Oct  4 14:25:10 2011
New Revision: 225979
URL: http://svn.freebsd.org/changeset/base/225979

Log:
  Update the comment to reflect what is actually going on.
  
  Submitted by: mux

Modified:
  head/usr.bin/csup/updater.c

Modified: head/usr.bin/csup/updater.c
==
--- head/usr.bin/csup/updater.c Tue Oct  4 13:31:57 2011(r225978)
+++ head/usr.bin/csup/updater.c Tue Oct  4 14:25:10 2011(r225979)
@@ -238,7 +238,7 @@ updater(void *arg)
 
/*
 * Make sure to close the fixups even in case of an error,
-* so that the lister thread doesn't block indefinitely.
+* so that the detailer thread doesn't block indefinitely.
 */
fixups_close(up-config-fixups);
if (!error)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r225980 - head/usr.bin/csup

2011-10-04 Thread Adrian Chadd
Author: adrian
Date: Tue Oct  4 14:26:45 2011
New Revision: 225980
URL: http://svn.freebsd.org/changeset/base/225980

Log:
  Handle the situation where fixups_close() has been called but more fixups
  are still available on the queue.
  
  Without this, the fixups producer/consumer pipeline will artifically terminate
  before all of the fixups have been processed, leading to incomplete updates
  and generally quite unhappy users.
  
  Submitted by: mux

Modified:
  head/usr.bin/csup/fixups.c

Modified: head/usr.bin/csup/fixups.c
==
--- head/usr.bin/csup/fixups.c  Tue Oct  4 14:25:10 2011(r225979)
+++ head/usr.bin/csup/fixups.c  Tue Oct  4 14:26:45 2011(r225980)
@@ -141,7 +141,7 @@ fixups_get(struct fixups *f)
fixups_lock(f);
while (f-size == 0  !f-closed)
pthread_cond_wait(f-cond, f-lock);
-   if (f-closed) {
+   if (f-closed  f-size == 0) {
fixups_unlock(f);
return (NULL);
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r225981 - head/sys/kern

2011-10-04 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Oct  4 14:56:33 2011
New Revision: 225981
URL: http://svn.freebsd.org/changeset/base/225981

Log:
  Actually enforce limit for inheritable resources on fork.
  
  MFC after:3 days

Modified:
  head/sys/kern/kern_racct.c

Modified: head/sys/kern/kern_racct.c
==
--- head/sys/kern/kern_racct.c  Tue Oct  4 14:26:45 2011(r225980)
+++ head/sys/kern/kern_racct.c  Tue Oct  4 14:56:33 2011(r225981)
@@ -567,6 +567,12 @@ racct_proc_fork(struct proc *parent, str
PROC_LOCK(child);
mtx_lock(racct_lock);
 
+#ifdef RCTL
+   error = rctl_proc_fork(parent, child);
+   if (error != 0)
+   goto out;
+#endif
+
/*
 * Inherit resource usage.
 */
@@ -581,12 +587,6 @@ racct_proc_fork(struct proc *parent, str
goto out;
}
 
-#ifdef RCTL
-   error = rctl_proc_fork(parent, child);
-   if (error != 0)
-   goto out;
-#endif
-
error = racct_add_locked(child, RACCT_NPROC, 1);
error += racct_add_locked(child, RACCT_NTHR, 1);
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r225982 - head/usr.bin/fetch

2011-10-04 Thread Dag-Erling Smorgrav
Author: des
Date: Tue Oct  4 15:00:54 2011
New Revision: 225982
URL: http://svn.freebsd.org/changeset/base/225982

Log:
  latin1 - utf8

Modified:
  head/usr.bin/fetch/fetch.1

Modified: head/usr.bin/fetch/fetch.1
==
--- head/usr.bin/fetch/fetch.1  Tue Oct  4 14:56:33 2011(r225981)
+++ head/usr.bin/fetch/fetch.1  Tue Oct  4 15:00:54 2011(r225982)
@@ -1,5 +1,5 @@
 .\-
-.\ Copyright (c) 2000-2011 Dag-Erling Sm�rgrav
+.\ Copyright (c) 2000-2011 Dag-Erling Smørgrav
 .\ All rights reserved.
 .\ Portions Copyright (c) 1999 Massachusetts Institute of Technology; used
 .\ by permission.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r225372 - head/sys/kern

2011-10-04 Thread Bruce Evans

On Tue, 4 Oct 2011, Attilio Rao wrote:


2011/10/3 Bruce Evans b...@optusnet.com.au:

On Mon, 26 Sep 2011, Attilio Rao wrote:


2011/9/4 Bruce Evans b...@optusnet.com.au:


On Sun, 4 Sep 2011, Attilio Rao wrote:


Also please notice that intr enable/disable happens in the wrong way
as it is done via the MD (x86 specific likely) interface. This is
wrong for 2 reasons:


No, intr_disable() is MI. ??It is also used by witness. ??disable_intr()
is the corresponding x86 interface that you may be thinking of. ??The MI
interface intr_disable() was introduced to avoid the MD'ness of
intr_disable().


I was a bit surprised to verify that you are right but
spinlock_enter() has the big difference besides disable_intr() of also
explicitly disabling preemption via critical_enter() which some
codepath can trigger without even noticing it.
This means it is more safer in presence of PREEMPTION option on and
thus should be preferred to the normal intr_disable(), in particular
for convoluted codepaths.


I think this is another implementation detail which shouldn't be depended
on. ??Spinlocks may or may not need either interrupts disabled or a critical
section to work. ??Now I'm a little surprised to remember that they use a
critical section. ??This is to prevent context switching. ??It is useful
behaviour, but not strictly necessary.

Since disabling interrupts also prevents context switching (excep by buggy
trap handlers including NMI), it is safe to use hard interrupt disabling
instead of critical_enter() to prevent context switching. ??This is safe
because code that has interrupts disabled cannot wander off into other
code that doesn't understand this and does context switching! (unless it
is broken). ??But for preventing context switching, critical_enter() is
better now that it doesn't hard-disable interrupts internally.


This is not entirely correct, infact you may have preemption even with
interrupts disabled by calling code that schedule threads. This is why
spinlock_enter() disables interrupts _and_ preemption altogether.
Look for example at hardclock() and its internal magic (this is what I
meant, earlier, with non convoluted codepaths).


That is a bug in -current.  As I said, only broken code can wander off
into other code that doesn't understand the caller's context.  This is
one of the things that prevents hardclock() being a non-broken fast
interrupt handler.  hardclock() wants to call scheduling code, but non-
broken fast interrupt handlers can't do that.


By un-inlining (un-macroizing) mtx_lock_spin(), but inlining
critical_enter(), I get the same number of function calls but much smaller
code since it is the tiny critical_enter() function and not the big
mtx_lock_spin() one that is inlined.


I'm not entirely sure I follow.

In -CURRENT, right now mtx_lock_spin() just yields
_mtx_lock_spin_flags() which is not inlined.


That is the debugging version.  sys/mutex.h is obfuscated as follows:
- mtx_lock_spin(m) is mtx_lock_spin_flags((m), 0)
- if LOCK_DEBUG  0 or defined(MUTEX_NOINLINE)
mtx_lock_spin_flags((m), 0) is _mtx_lock_spin_flags((m), curthread, (0),
LOCK_FILE, LOCK_LINE)
This gives the version that you described.
if LOCK_DEBUG  0
  LOCK_FILE is __FILE__ and LOCK_LINE is __LINE__
else
  LOCK_FILE is NULL and LOCK_LINE is 0
  else
mtx_lock_spin_flags((m), 0) is __mtx_lock_spin((m), curthread, (0),
NULL, 0)
This gives the version that I described.
__mtx_lock_spin() is passed a dummy LOCK_FILE and LOCK_LINE although
it doesn't use them in this case.  It is convoluted so that it can
be used both in this case and in the non-inlined case, where it is
expanded in _mtx_lock_spin_flags(), where it is passed __FILE__
and __LINE__ iff LOCK_DEBUG  0.  But this reuse is not so good since
it gives a further obfuscations:
  __mtx_lock_spin() takes flags args but doesn't have `flags' in its
  name like some other mtx functions.
  In the non-inlined case:
mtx_lock_spin(...) is _mtx_lock_spin_flags() as described above
_mtx_lock_spin_flags(...) invokes __mtx_lock_spin(...) as desc. above
__mtx_lock_spin(...) invokes _mtx_lock_spin(...)
The macro obfuscations end at this point -- _mtx_lock_spin() is
always a function.
_mtx_lock_spin(), like __mtx_lock_spin(), takes flags args but
doesn't have `flags' in its name.
  end if


So the improvement here is just to have inlined critical_enter()? How
this can lead to smaller code?


This should be obvious now.  Another detail is that my mtx_lock_spin()
takes only 1 arg (this is the normal API).  It doesn't need to support
passing (td, opt, file, line).  critical_enter() takes no args at all
(td = curthread is implicit for it, as it is for mtx_lock_spin()).  So
mtx_lock_spin(mp) calls expand to slightly more object code than
critical_enter() calls.  In -current for the inlined case, mtx_lock_spin()
expands to critical_enter() plus about 

svn commit: r225988 - head/sys/arm/arm

2011-10-04 Thread Marcel Moolenaar
Author: marcel
Date: Tue Oct  4 16:53:11 2011
New Revision: 225988
URL: http://svn.freebsd.org/changeset/base/225988

Log:
  Fix build when DEBUG is defined (e.g. for LINT).

Modified:
  head/sys/arm/arm/pmap.c

Modified: head/sys/arm/arm/pmap.c
==
--- head/sys/arm/arm/pmap.c Tue Oct  4 16:52:25 2011(r225987)
+++ head/sys/arm/arm/pmap.c Tue Oct  4 16:53:11 2011(r225988)
@@ -185,6 +185,9 @@ int pmap_debug_level = 0;
 #endif  /* PMAP_DEBUG */
 
 extern struct pv_addr systempage;
+
+extern int last_fault_code;
+
 /*
  * Internal function prototypes
  */
@@ -2054,9 +2057,8 @@ pmap_fault_fixup(pmap_t pm, vm_offset_t 
 * the TLB.
 */
if (rv == 0  pm-pm_l1-l1_domain_use_count == 1) {
-   extern int last_fault_code;
printf(fixup: pm %p, va 0x%lx, ftype %d - nothing to do!\n,
-   pm, va, ftype);
+   pm, (u_long)va, ftype);
printf(fixup: l2 %p, l2b %p, ptep %p, pl1pd %p\n,
l2, l2b, ptep, pl1pd);
printf(fixup: pte 0x%x, l1pd 0x%x, last code 0x%x\n,
@@ -4012,13 +4014,6 @@ pmap_zero_page_generic(vm_paddr_t phys, 
char *dstpg;
 #endif
 
-#ifdef DEBUG
-   struct vm_page *pg = PHYS_TO_VM_PAGE(phys);
-
-   if (pg-md.pvh_list != NULL)
-   panic(pmap_zero_page: page has mappings);
-#endif
-
if (_arm_bzero  size = _min_bzero_size 
_arm_bzero((void *)(phys + off), size, IS_PHYSICAL) == 0)
return;
@@ -4290,13 +4285,6 @@ pmap_copy_page_generic(vm_paddr_t src, v
 #if 0
struct vm_page *src_pg = PHYS_TO_VM_PAGE(src);
 #endif
-#ifdef DEBUG
-   struct vm_page *dst_pg = PHYS_TO_VM_PAGE(dst);
-
-   if (dst_pg-md.pvh_list != NULL)
-   panic(pmap_copy_page: dst page has mappings);
-#endif
-
 
/*
 * Clean the source page.  Hold the source page's lock for
@@ -4342,13 +4330,6 @@ pmap_copy_page_xscale(vm_paddr_t src, vm
/* XXX: Only needed for pmap_clean_page(), which is commented out. */
struct vm_page *src_pg = PHYS_TO_VM_PAGE(src);
 #endif
-#ifdef DEBUG
-   struct vm_page *dst_pg = PHYS_TO_VM_PAGE(dst);
-
-   if (dst_pg-md.pvh_list != NULL)
-   panic(pmap_copy_page: dst page has mappings);
-#endif
-
 
/*
 * Clean the source page.  Hold the source page's lock for
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r225990 - head/sys/arm/arm

2011-10-04 Thread Marcel Moolenaar
Author: marcel
Date: Tue Oct  4 16:55:53 2011
New Revision: 225990
URL: http://svn.freebsd.org/changeset/base/225990

Log:
  Include opt_* headers first. Otherwise we can end up with redefined
  symbols.

Modified:
  head/sys/arm/arm/elf_trampoline.c

Modified: head/sys/arm/arm/elf_trampoline.c
==
--- head/sys/arm/arm/elf_trampoline.c   Tue Oct  4 16:54:21 2011
(r225989)
+++ head/sys/arm/arm/elf_trampoline.c   Tue Oct  4 16:55:53 2011
(r225990)
@@ -22,6 +22,13 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+/*
+ * Since we are compiled outside of the normal kernel build process, we
+ * need to include opt_global.h manually.
+ */
+#include opt_global.h
+#include opt_kernname.h
+
 #include sys/cdefs.h
 __FBSDID($FreeBSD$);
 #include machine/asm.h
@@ -33,13 +40,6 @@ __FBSDID($FreeBSD$);
 #include machine/cpufunc.h
 #include machine/armreg.h
 
-/*
- * Since we are compiled outside of the normal kernel build process, we
- * need to include opt_global.h manually.
- */
-#include opt_global.h
-#include opt_kernname.h
-
 extern char kernel_start[];
 extern char kernel_end[];
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r225991 - head/sys/arm/mv

2011-10-04 Thread Marcel Moolenaar
Author: marcel
Date: Tue Oct  4 16:58:20 2011
New Revision: 225991
URL: http://svn.freebsd.org/changeset/base/225991

Log:
  Fix build when DEBUG is defined in the kernel configuration file (e.g.
  LINT).

Modified:
  head/sys/arm/mv/common.c
  head/sys/arm/mv/mv_machdep.c

Modified: head/sys/arm/mv/common.c
==
--- head/sys/arm/mv/common.cTue Oct  4 16:55:53 2011(r225990)
+++ head/sys/arm/mv/common.cTue Oct  4 16:58:20 2011(r225991)
@@ -49,9 +49,6 @@ __FBSDID($FreeBSD$);
 
 #define MAX_CPU_WIN5
 
-#define DEBUG
-#undef DEBUG
-
 #ifdef DEBUG
 #define debugf(fmt, args...) do { printf(%s(): , __func__);  \
 printf(fmt,##args); } while (0)

Modified: head/sys/arm/mv/mv_machdep.c
==
--- head/sys/arm/mv/mv_machdep.cTue Oct  4 16:55:53 2011
(r225990)
+++ head/sys/arm/mv/mv_machdep.cTue Oct  4 16:58:20 2011
(r225991)
@@ -91,9 +91,6 @@ __FBSDID($FreeBSD$);
 #include arm/mv/mvvar.h  /* XXX eventually this should be eliminated */
 #include arm/mv/mvwin.h
 
-#define DEBUG
-#undef DEBUG
-
 #ifdef  DEBUG
 #define debugf(fmt, args...) printf(fmt, ##args)
 #else
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r225995 - head/sys/arm/include

2011-10-04 Thread Marcel Moolenaar
Author: marcel
Date: Tue Oct  4 17:00:50 2011
New Revision: 225995
URL: http://svn.freebsd.org/changeset/base/225995

Log:
  Properly guard definitions of DFLDSIZ, MAXDSIZ, DFLSSIZ, MAXSSIZ and
  SGROWSIZ. They can be set in the kernel configuration file.

Modified:
  head/sys/arm/include/vmparam.h

Modified: head/sys/arm/include/vmparam.h
==
--- head/sys/arm/include/vmparam.h  Tue Oct  4 17:00:39 2011
(r225994)
+++ head/sys/arm/include/vmparam.h  Tue Oct  4 17:00:50 2011
(r225995)
@@ -141,11 +141,21 @@
 #endif
 
 #define MAXTSIZ(16*1024*1024)
+#ifndef DFLDSIZ
 #define DFLDSIZ (128*1024*1024)
+#endif
+#ifndef MAXDSIZ
 #define MAXDSIZ (512*1024*1024)
+#endif
+#ifndef DFLSSIZ
 #define DFLSSIZ (2*1024*1024)
+#endif
+#ifndef MAXSSIZ
 #define MAXSSIZ (8*1024*1024)
+#endif
+#ifndef SGROWSIZ
 #define SGROWSIZ(128*1024)
+#endif
 
 #ifdef ARM_USE_SMALL_ALLOC
 #define UMA_MD_SMALL_ALLOC
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r226013 - head/sys/conf

2011-10-04 Thread Marcel Moolenaar
Author: marcel
Date: Tue Oct  4 17:11:38 2011
New Revision: 226013
URL: http://svn.freebsd.org/changeset/base/226013

Log:
  Match the files directive and all the ways to add or subtract options
  and makeoptions by being a little smarter about REs.

Modified:
  head/sys/conf/makeLINT.sed

Modified: head/sys/conf/makeLINT.sed
==
--- head/sys/conf/makeLINT.sed  Tue Oct  4 17:09:10 2011(r226012)
+++ head/sys/conf/makeLINT.sed  Tue Oct  4 17:11:38 2011(r226013)
@@ -1,7 +1,7 @@
 #!/usr/bin/sed -E -n -f
 # $FreeBSD$
 
-/^(machine|ident|device|nodevice|makeoptions|nomakeoption|options|option|nooption|profile|cpu|maxusers)[[:space:]]/
 {
+/^(machine|files|ident|(no)?device|(no)?makeoption(s)?|(no)?option(s)?|profile|cpu|maxusers)[[:space:]]/
 {
 s/[[:space:]]*#.*$//
 p
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r226018 - head/sys/mips/cavium

2011-10-04 Thread Marcel Moolenaar
Author: marcel
Date: Tue Oct  4 17:49:19 2011
New Revision: 226018
URL: http://svn.freebsd.org/changeset/base/226018

Log:
  Partially revert r224661:
  octeon_ap_boot is not a bitmask. It holds the CPU Id of the
  AP currently being started. As such there's no need to make
  it a 64-bit integral and we're not limited to 64 CPUs.
  
  Reported by: jmallet
  Obtained from:Andre Duane

Modified:
  head/sys/mips/cavium/asm_octeon.S
  head/sys/mips/cavium/octeon_mp.c

Modified: head/sys/mips/cavium/asm_octeon.S
==
--- head/sys/mips/cavium/asm_octeon.S   Tue Oct  4 17:32:01 2011
(r226017)
+++ head/sys/mips/cavium/asm_octeon.S   Tue Oct  4 17:49:19 2011
(r226018)
@@ -50,12 +50,12 @@ LEAF(octeon_ap_wait)
jal platform_processor_id
nop
 
-1: lld t0, octeon_ap_boot
+1: ll  t0, octeon_ap_boot
bne v0, t0, 1b
nop
 
movet0, zero
-   scd t0, octeon_ap_boot
+   sc  t0, octeon_ap_boot
 
beqzt0, 1b
nop

Modified: head/sys/mips/cavium/octeon_mp.c
==
--- head/sys/mips/cavium/octeon_mp.cTue Oct  4 17:32:01 2011
(r226017)
+++ head/sys/mips/cavium/octeon_mp.cTue Oct  4 17:49:19 2011
(r226018)
@@ -46,8 +46,7 @@ __FBSDID($FreeBSD$);
 /* XXX */
 extern cvmx_bootinfo_t *octeon_bootinfo;
 
-/* NOTE: this 64-bit mask (and many others) limits MAXCPU to 64 */
-uint64_t octeon_ap_boot = ~0ULL;
+unsigned octeon_ap_boot = ~0;
 
 void
 platform_ipi_send(int cpuid)
@@ -139,11 +138,11 @@ platform_start_ap(int cpuid)
DELAY(2000);/* Give it a moment to start */
}
 
-   if (atomic_cmpset_64(octeon_ap_boot, ~0, cpuid) == 0)
+   if (atomic_cmpset_32(octeon_ap_boot, ~0, cpuid) == 0)
return (-1);
for (;;) {
DELAY(1000);
-   if (atomic_cmpset_64(octeon_ap_boot, 0, ~0) != 0)
+   if (atomic_cmpset_32(octeon_ap_boot, 0, ~0) != 0)
return (0);
printf(Waiting for cpu%d to start\n, cpuid);
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r226020 - head/sys/mips/cavium

2011-10-04 Thread Marcel Moolenaar
Author: marcel
Date: Tue Oct  4 18:03:55 2011
New Revision: 226020
URL: http://svn.freebsd.org/changeset/base/226020

Log:
  o   Clean up some ID printfs, and put under bootverbose
  o   Remove redundant lookups of base address in cf_identify
  o   Fix some indenting issues
  o   Fix an identification bug that uses DRQ to checlk for ident block
  returned. The correct spec is to look for BSY to be cleared.
  
  Reviewed by: imp, marcel
  Obtained from: Juniper Networks, Inc
  Author: Andrew Duane

Modified:
  head/sys/mips/cavium/octeon_ebt3000_cf.c

Modified: head/sys/mips/cavium/octeon_ebt3000_cf.c
==
--- head/sys/mips/cavium/octeon_ebt3000_cf.cTue Oct  4 17:50:22 2011
(r226019)
+++ head/sys/mips/cavium/octeon_ebt3000_cf.cTue Oct  4 18:03:55 2011
(r226020)
@@ -484,7 +484,12 @@ static int cf_cmd_identify (void)
drive_param.sec_track   =  SWAP_SHORT 
(drive_param.u.driveid.current_sectors);
drive_param.nr_sectors  = (uint32_t)SWAP_SHORT 
(drive_param.u.driveid.lba_size_1) |
((uint32_t)SWAP_SHORT (drive_param.u.driveid.lba_size_2));
-   printf(cf0: %s %lld sectors\n, drive_param.model, (long 
long)drive_param.nr_sectors);
+   if (bootverbose) {
+   printf(model %s\n, drive_param.model);
+   printf(heads %d tracks %d sec_tracks %d sectors %d\n,
+   drive_param.heads, drive_param.tracks,
+   drive_param.sec_track, drive_param.nr_sectors);
+   }
 
return (0);
 }
@@ -578,7 +583,10 @@ static int cf_wait_busy (void)
}
break;
}
-   if ((status  STATUS_DRQ) == 0) {
+
+   /* DRQ is only for when read data is actually available; check BSY */
+   /* Some vendors do assert DRQ, but not all. Check BSY instead. */
+   if (status  STATUS_BSY) {
printf(%s: device not ready (status=%x)\n, __func__, status);
return (ENXIO);
}
@@ -634,24 +642,25 @@ static int cf_probe (device_t dev)
  * inserted.
  *
  */
-typedef unsigned long long llu;
 static void cf_identify (driver_t *drv, device_t parent)
 {
-int bus_region;
+   int bus_region;
int count = 0;
-cvmx_mio_boot_reg_cfgx_t cfg;
+   cvmx_mio_boot_reg_cfgx_t cfg;
+
+   uint64_t phys_base = octeon_bootinfo-compact_flash_common_base_addr;
 
if (octeon_is_simulation())
return;
 
-   base_addr = 
cvmx_phys_to_ptr(octeon_bootinfo-compact_flash_common_base_addr);
+   base_addr = cvmx_phys_to_ptr(phys_base);
 
 for (bus_region = 0; bus_region  8; bus_region++)
 {
 cfg.u64 = cvmx_read_csr(CVMX_MIO_BOOT_REG_CFGX(bus_region));
-if (cfg.s.base == 
octeon_bootinfo-compact_flash_common_base_addr  16)
+if (cfg.s.base == phys_base  16)
 {
-   if (octeon_bootinfo-compact_flash_attribute_base_addr 
== 0)
+   if 
(cvmx_sysinfo_get()-compact_flash_attribute_base_addr == 0)
bus_type = CF_TRUE_IDE_8;
else
bus_type = (cfg.s.width) ? CF_16 : CF_8;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r226021 - head/sys/mips/include

2011-10-04 Thread Marcel Moolenaar
Author: marcel
Date: Tue Oct  4 18:06:08 2011
New Revision: 226021
URL: http://svn.freebsd.org/changeset/base/226021

Log:
  Remove bogus and wrong definition of BLKDEV_IOSIZE.
  Wrong in that it must be guarded (it's configurable)
  and bogus in that there's absolutely no rationale for
  it not default to a page size like all other archs.

Modified:
  head/sys/mips/include/param.h

Modified: head/sys/mips/include/param.h
==
--- head/sys/mips/include/param.h   Tue Oct  4 18:03:55 2011
(r226020)
+++ head/sys/mips/include/param.h   Tue Oct  4 18:06:08 2011
(r226021)
@@ -149,7 +149,6 @@
 
 #defineMAXPAGESIZES1   /* max supported 
pagesizes */
 
-#defineBLKDEV_IOSIZE   2048/* xxx: Why is this 1/2 
page? */
 #defineMAXDUMPPGS  1   /* xxx: why is this 
only one? */
 
 /*
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r226022 - head/sys/kern

2011-10-04 Thread Konstantin Belousov
Author: kib
Date: Tue Oct  4 18:45:29 2011
New Revision: 226022
URL: http://svn.freebsd.org/changeset/base/226022

Log:
  Move parts of the commit log for r166167, where Tor explained the
  interaction between vnode locks and vfs_busy(), into comment.
  
  MFC after:1 week

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cTue Oct  4 18:06:08 2011(r226021)
+++ head/sys/kern/vfs_subr.cTue Oct  4 18:45:29 2011(r226022)
@@ -348,6 +348,38 @@ SYSINIT(vfs, SI_SUB_VFS, SI_ORDER_FIRST,
 /*
  * Mark a mount point as busy. Used to synchronize access and to delay
  * unmounting. Eventually, mountlist_mtx is not released on failure.
+ *
+ * vfs_busy() is a custom lock, it can block the caller.
+ * vfs_busy() only sleeps if the unmount is active on the mount point.
+ * For a mountpoint mp, vfs_busy-enforced lock is before lock of any
+ * vnode belonging to mp.
+ *
+ * Lookup uses vfs_busy() to traverse mount points.
+ * root fs var fs
+ * / vnode lockA   / vnode lock (/var) D
+ * /var vnode lock B   /log vnode lock(/var/log)   E
+ * vfs_busy lock   C   vfs_busy lock   F
+ *
+ * Within each file system, the lock order is C-A-B and F-D-E.
+ *
+ * When traversing across mounts, the system follows that lock order:
+ *
+ *C-A-B
+ *  |
+ *  +-F-D-E
+ *
+ * The lookup() process for namei(/var) illustrates the process:
+ *  VOP_LOOKUP() obtains B while A is held
+ *  vfs_busy() obtains a shared lock on F while A and B are held
+ *  vput() releases lock on B
+ *  vput() releases lock on A
+ *  VFS_ROOT() obtains lock on D while shared lock on F is held
+ *  vfs_unbusy() releases shared lock on F
+ *  vn_lock() obtains lock on deadfs vnode vp_crossmp instead of A.
+ *Attempt to lock A (instead of vp_crossmp) while D is held would
+ *violate the global order, causing deadlocks.
+ *
+ * dounmount() locks B while F is drained.
  */
 int
 vfs_busy(struct mount *mp, int flags)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r225937 - in head: . release release/amd64 release/i386 release/ia64 release/pc98 release/powerpc release/scripts release/sparc64 usr.sbin usr.sbin/sysinstall

2011-10-04 Thread Doug Barton
On 10/03/2011 16:32, Craig Rodrigues wrote:
 Hi,
 
 If pc-sysinstall can be a drop-in replacement for sysinstall in
 SCRIPT SYNTAX mode, even better.  sysinstall needs to go...
 while people do use it, it has a lot of problems that aren't getting fixed,
 and it is clear that bsdinstall is the future for FreeBSD installation.

My initial point was not about installation, it was about
post-installation configuration. We don't have a new tool for that yet.

 Nathan is doing a good thing by forcing the issue by removing
 itthere is too much brokenness in sysinstall that is not getting
 fixed, and the sooner we can move to
 bsdinstall/pc-sysinstall, the better.
 
 Since the sysinstall removal is happening only in HEAD/10.0, we have
 some time to fix the issues before 10.0 is released.

Sorry, that's backwards. Garrett was right.

I'll have no objection to sysinstall being gone in 10.0-RELEASE after
it's lived with the deprecated tag in 9.x, but the new functionality
needs to be feature complete first. And for the record, yes I am aware
that this problem is why sysinstall has lived so long in the first place.

I should also point out for the record that I don't see anything
malicious in Nathan's actions, my only concern is that they are premature.


Doug

-- 

Nothin' ever doesn't change, but nothin' changes much.
-- OK Go

Breadth of IT experience, and depth of knowledge in the DNS.
Yours for the right price.  :)  http://SupersetSolutions.com/

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


svn commit: r226023 - head/sys/compat/linux releng/7.3 releng/7.3/sys/compat/linux releng/7.3/sys/conf releng/7.4 releng/7.4/sys/compat/linux releng/7.4/sys/conf releng/8.1 releng/8.1/sys/compat/li...

2011-10-04 Thread Colin Percival
Author: cperciva
Date: Tue Oct  4 19:07:38 2011
New Revision: 226023
URL: http://svn.freebsd.org/changeset/base/226023

Log:
  Fix a bug in UNIX socket handling in the linux emulator which was
  exposed by the security fix in FreeBSD-SA-11:05.unix.
  
  Approved by:  so (cperciva)
  Approved by:  re (kib)
  Security: Related to FreeBSD-SA-11:05.unix, but not actually
a security fix.

Modified:
  head/sys/compat/linux/linux_socket.c

Changes in other areas also in this revision:
Modified:
  releng/7.3/UPDATING
  releng/7.3/sys/compat/linux/linux_socket.c
  releng/7.3/sys/conf/newvers.sh
  releng/7.4/UPDATING
  releng/7.4/sys/compat/linux/linux_socket.c
  releng/7.4/sys/conf/newvers.sh
  releng/8.1/UPDATING
  releng/8.1/sys/compat/linux/linux_socket.c
  releng/8.1/sys/conf/newvers.sh
  releng/8.2/UPDATING
  releng/8.2/sys/compat/linux/linux_socket.c
  releng/8.2/sys/conf/newvers.sh
  stable/7/sys/compat/linux/linux_socket.c
  stable/8/sys/compat/linux/linux_socket.c
  stable/9/sys/compat/linux/linux_socket.c

Modified: head/sys/compat/linux/linux_socket.c
==
--- head/sys/compat/linux/linux_socket.cTue Oct  4 18:45:29 2011
(r226022)
+++ head/sys/compat/linux/linux_socket.cTue Oct  4 19:07:38 2011
(r226023)
@@ -104,6 +104,7 @@ do_sa_get(struct sockaddr **sap, const s
int oldv6size;
struct sockaddr_in6 *sin6;
 #endif
+   int namelen;
 
if (*osalen  2 || *osalen  UCHAR_MAX || !osa)
return (EINVAL);
@@ -166,6 +167,20 @@ do_sa_get(struct sockaddr **sap, const s
}
}
 
+   if ((bdom == AF_LOCAL)  (*osalen  sizeof(struct sockaddr_un))) {
+   for (namelen = 0;
+   namelen  *osalen - offsetof(struct sockaddr_un, sun_path);
+   namelen++)
+   if (!((struct sockaddr_un *)kosa)-sun_path[namelen])
+   break;
+   if (namelen + offsetof(struct sockaddr_un, sun_path) 
+   sizeof(struct sockaddr_un)) {
+   error = EINVAL;
+   goto out;
+   }
+   alloclen = sizeof(struct sockaddr_un);
+   }
+
sa = (struct sockaddr *) kosa;
sa-sa_family = bdom;
sa-sa_len = alloclen;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r226024 - in head/sys/mips/cavium: . octe

2011-10-04 Thread Marcel Moolenaar
Author: marcel
Date: Tue Oct  4 20:17:43 2011
New Revision: 226024
URL: http://svn.freebsd.org/changeset/base/226024

Log:
  Remove octeon_bootinfo from all files except octeon_machdep.c.
  Use instead cvmx_sysinfo_get() consistently.
  
  Reviewed by: jmallett, marcel
  Obtained from: Juniper Networks, Inc
  Author: Andrew Duane

Modified:
  head/sys/mips/cavium/if_octm.c
  head/sys/mips/cavium/octe/ethernet-common.c
  head/sys/mips/cavium/octe/ethernet.c
  head/sys/mips/cavium/octeon_ebt3000_cf.c
  head/sys/mips/cavium/octeon_mp.c

Modified: head/sys/mips/cavium/if_octm.c
==
--- head/sys/mips/cavium/if_octm.c  Tue Oct  4 19:07:38 2011
(r226023)
+++ head/sys/mips/cavium/if_octm.c  Tue Oct  4 20:17:43 2011
(r226024)
@@ -64,8 +64,6 @@
 #include contrib/octeon-sdk/cvmx-interrupt.h
 #include contrib/octeon-sdk/cvmx-mgmt-port.h
 
-extern cvmx_bootinfo_t *octeon_bootinfo;
-
 struct octm_softc {
struct ifnet *sc_ifp;
device_t sc_dev;
@@ -179,7 +177,7 @@ octm_attach(device_t dev)
 * Set MAC address for this management port.
 */
mac = 0;
-   memcpy((u_int8_t *)mac + 2, octeon_bootinfo-mac_addr_base, 6);
+   memcpy((u_int8_t *)mac + 2, cvmx_sysinfo_get()-mac_addr_base, 6);
mac += sc-sc_port;
cvmx_mgmt_port_set_mac(sc-sc_port, mac);
 

Modified: head/sys/mips/cavium/octe/ethernet-common.c
==
--- head/sys/mips/cavium/octe/ethernet-common.c Tue Oct  4 19:07:38 2011
(r226023)
+++ head/sys/mips/cavium/octe/ethernet-common.c Tue Oct  4 20:17:43 2011
(r226024)
@@ -45,7 +45,6 @@ __FBSDID($FreeBSD$);
 #include ethernet-headers.h
 
 extern int octeon_is_simulation(void);
-extern cvmx_bootinfo_t *octeon_bootinfo;
 
 
 /**
@@ -270,12 +269,12 @@ void cvm_oct_common_poll(struct ifnet *i
 int cvm_oct_common_init(struct ifnet *ifp)
 {
char mac[6] = {
-   octeon_bootinfo-mac_addr_base[0],
-   octeon_bootinfo-mac_addr_base[1],
-   octeon_bootinfo-mac_addr_base[2],
-   octeon_bootinfo-mac_addr_base[3],
-   octeon_bootinfo-mac_addr_base[4],
-   octeon_bootinfo-mac_addr_base[5] };
+   cvmx_sysinfo_get()-mac_addr_base[0],
+   cvmx_sysinfo_get()-mac_addr_base[1],
+   cvmx_sysinfo_get()-mac_addr_base[2],
+   cvmx_sysinfo_get()-mac_addr_base[3],
+   cvmx_sysinfo_get()-mac_addr_base[4],
+   cvmx_sysinfo_get()-mac_addr_base[5] };
cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp-if_softc;
 
mac[5] += cvm_oct_mac_addr_offset++;

Modified: head/sys/mips/cavium/octe/ethernet.c
==
--- head/sys/mips/cavium/octe/ethernet.cTue Oct  4 19:07:38 2011
(r226023)
+++ head/sys/mips/cavium/octe/ethernet.cTue Oct  4 20:17:43 2011
(r226024)
@@ -77,12 +77,6 @@ TUNABLE_INT(hw.octe.pow_receive_group,
 extern int octeon_is_simulation(void);
 
 /**
- * Exported from the kernel so we can determine board information. It is
- * passed by the bootloader to the kernel.
- */
-extern cvmx_bootinfo_t *octeon_bootinfo;
-
-/**
  * Periodic timer to check auto negotiation
  */
 static struct callout cvm_oct_poll_timer;
@@ -475,7 +469,7 @@ int cvm_oct_init_module(device_t bus)
 
if (INTERRUPT_LIMIT) {
/* Set the POW timer rate to give an interrupt at most 
INTERRUPT_LIMIT times per second */
-   cvmx_write_csr(CVMX_POW_WQ_INT_PC, 
octeon_bootinfo-eclock_hz/(INTERRUPT_LIMIT*16*256)8);
+   cvmx_write_csr(CVMX_POW_WQ_INT_PC, 
cvmx_clock_get_rate(CVMX_CLOCK_CORE)/(INTERRUPT_LIMIT*16*256)8);
 
/* Enable POW timer interrupt. It will count when there are 
packets available */
cvmx_write_csr(CVMX_POW_WQ_INT_THRX(pow_receive_group), 
0x1ful24);

Modified: head/sys/mips/cavium/octeon_ebt3000_cf.c
==
--- head/sys/mips/cavium/octeon_ebt3000_cf.cTue Oct  4 19:07:38 2011
(r226023)
+++ head/sys/mips/cavium/octeon_ebt3000_cf.cTue Oct  4 20:17:43 2011
(r226024)
@@ -100,9 +100,6 @@ __FBSDID($FreeBSD$);
 #define SWAP_SHORT(x)  ((x  8) | (x  8))
 #define MODEL_STR_SIZE 40
 
-/* XXX */
-extern cvmx_bootinfo_t *octeon_bootinfo;
-
 /* Globals */
 /*
  * There's three bus types supported by this driver.
@@ -648,7 +645,7 @@ static void cf_identify (driver_t *drv, 
int count = 0;
cvmx_mio_boot_reg_cfgx_t cfg;
 
-   uint64_t phys_base = octeon_bootinfo-compact_flash_common_base_addr;
+   uint64_t phys_base = cvmx_sysinfo_get()-compact_flash_common_base_addr;
 
if (octeon_is_simulation())
return;

Modified: head/sys/mips/cavium/octeon_mp.c

svn commit: r226025 - head/sys/mips/cavium

2011-10-04 Thread Marcel Moolenaar
Author: marcel
Date: Tue Oct  4 20:30:15 2011
New Revision: 226025
URL: http://svn.freebsd.org/changeset/base/226025

Log:
  Add default address for FLASH mapping on the boot bus.
  
  Reviewed by: jmallett, marcel
  Obtained from: Juniper Networks, Inc
  Author: Andrew Duane

Modified:
  head/sys/mips/cavium/octeon_pcmap_regs.h

Modified: head/sys/mips/cavium/octeon_pcmap_regs.h
==
--- head/sys/mips/cavium/octeon_pcmap_regs.hTue Oct  4 20:17:43 2011
(r226024)
+++ head/sys/mips/cavium/octeon_pcmap_regs.hTue Oct  4 20:30:15 2011
(r226025)
@@ -297,4 +297,9 @@ extern int octeon_is_simulation(void);
  */
 #define  OCTEON_CHAR_LED_BASE_ADDR (0x1d02 | (0x1ull  31))
 
+/*
+ * Default FLASH device (physical) base address
+ */
+#define  OCTEON_FLASH_BASE_ADDR(0x1d04ull)
+
 #endif /* !OCTEON_PCMAP_REGS_H__ */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r226018 - head/sys/mips/cavium

2011-10-04 Thread Marcel Moolenaar

On Oct 4, 2011, at 10:28 PM, Juli Mallett wrote:

 Thanks!

Sorry for the delay.

-- 
Marcel Moolenaar
mar...@xcllnt.net


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


svn commit: r226026 - in head: share/man/man4 sys/amd64/conf sys/conf sys/dev/tws sys/i386/conf sys/modules sys/modules/tws

2011-10-04 Thread Xin LI
Author: delphij
Date: Tue Oct  4 21:40:25 2011
New Revision: 226026
URL: http://svn.freebsd.org/changeset/base/226026

Log:
  Add the 9750 SATA+SAS 6Gb/s RAID controller card driver, tws(4).  Many
  thanks for their contiued support to FreeBSD.
  
  This is version 10.80.00.003 from codeset 10.2.1 [1]
  
  Obtained from:LSI http://kb.lsi.com/Download16574.aspx [1]

Added:
  head/share/man/man4/tws.4   (contents, props changed)
  head/sys/dev/tws/
  head/sys/dev/tws/tws.c   (contents, props changed)
  head/sys/dev/tws/tws.h   (contents, props changed)
  head/sys/dev/tws/tws_cam.c   (contents, props changed)
  head/sys/dev/tws/tws_hdm.c   (contents, props changed)
  head/sys/dev/tws/tws_hdm.h   (contents, props changed)
  head/sys/dev/tws/tws_services.c   (contents, props changed)
  head/sys/dev/tws/tws_services.h   (contents, props changed)
  head/sys/dev/tws/tws_user.c   (contents, props changed)
  head/sys/dev/tws/tws_user.h   (contents, props changed)
  head/sys/modules/tws/
  head/sys/modules/tws/Makefile   (contents, props changed)
Modified:
  head/share/man/man4/Makefile
  head/sys/amd64/conf/GENERIC
  head/sys/conf/files
  head/sys/i386/conf/GENERIC
  head/sys/modules/Makefile

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileTue Oct  4 20:30:15 2011
(r226025)
+++ head/share/man/man4/MakefileTue Oct  4 21:40:25 2011
(r226026)
@@ -447,6 +447,7 @@ MAN=aac.4 \
tun.4 \
twa.4 \
twe.4 \
+   tws.4 \
tx.4 \
txp.4 \
u3g.4 \

Added: head/share/man/man4/tws.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/tws.4   Tue Oct  4 21:40:25 2011(r226026)
@@ -0,0 +1,118 @@
+.\
+.\Copyright (c) 2010, 2011 iXsystems, Inc.
+.\All rights reserved.
+.\ written by: Xin LI delp...@freebsd.org
+.\
+.\Redistribution and use in source and binary forms, with or without
+.\modification, are permitted provided that the following conditions
+.\are met:
+.\1. Redistributions of source code must retain the above copyright
+.\   notice, this list of conditions and the following disclaimer.
+.\2. Redistributions in binary form must reproduce the above copyright
+.\   notice, this list of conditions and the following disclaimer in the
+.\   documentation and/or other materials provided with the distribution.
+.\
+.\THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\SUCH DAMAGE.
+.\
+.\ $FreeBSD$
+.\
+.Dd October 4, 2011
+.Dt TWS 4
+.Os
+.Sh NAME
+.Nm tws
+.Nd 3ware 9750 SATA+SAS 6Gb/s RAID controller card driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd device scbus
+.Cd device tws
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+tws_load=YES
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for LSI's 3ware 9750 SATA+SAS 6Gb/s RAID controller 
cards.
+.Pp
+These controllers feature the LSISAS2108 6Gb/s SAS RAID-on-Chip (ROC)
+and are available in 4- and 8-port configurations, supports RAID levels
+0, 1, 5, 6, 10, 50 and single disk, with 96 SATA and/or SAS hard drives and 
SSDs.
+.Pp
+For further hardware information, see
+.Pa http://www.lsi.com/.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following SATA/SAS RAID controller:
+.Pp
+.Bl -bullet -compact
+.It
+LSI's 3ware SAS 9750 series
+.El
+.Sh LOADER TUNABLES
+Tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel or stored in
+.Xr loader.conf 5 .
+.Bl -tag -width hw.tws.use_32bit_sgls
+.It Va hw.tws.cam_depth
+The maximium queued CAM SIM requests for one controller.
+The default value is 256.
+.It Va hw.tws.enable_msi
+This tunable enables MSI support on the controller if set to a non-zero value.
+The default value is 0.
+.It Va hw.tws.queue_depth
+The maximium queued requests for one controller.
+.It Va hw.tws.use_32bit_sgls
+Limit the driver to use only 32-bit SG elements regardless whether the 
operating
+system is running in 

svn commit: r226027 - head/share/mk

2011-10-04 Thread Jilles Tjoelker
Author: jilles
Date: Tue Oct  4 22:23:00 2011
New Revision: 226027
URL: http://svn.freebsd.org/changeset/base/226027

Log:
  Work around the autotools problem with the 10.0 version.
  
  With this, I can build various ports on a 10.0-CURRENT system without
  hacking or hiding the version number.
  
  This commit should be reverted when there is a cleaner fix in autotools
  and/or ports/Mk/bsd.port.mk.
  
  The original patch is from Ed Schouten but needed some additions.

Modified:
  head/share/mk/bsd.port.mk

Modified: head/share/mk/bsd.port.mk
==
--- head/share/mk/bsd.port.mk   Tue Oct  4 21:40:25 2011(r226026)
+++ head/share/mk/bsd.port.mk   Tue Oct  4 22:23:00 2011(r226027)
@@ -14,3 +14,15 @@ _WITHOUT_SRCCONF=
 
 .include bsd.own.mk
 .include ${BSDPORTMK}
+
+.if !defined(BEFOREPORTMK)  !defined(INOPTIONSMK)
+# Work around an issue where FreeBSD 10.0 is detected as FreeBSD 1.x.
+run-autotools-fixup:
+   find ${WRKSRC} -type f \( -name config.libpath -o \
+   -name config.rpath -o -name configure -o -name libtool.m4 \) \
+   -exec sed -i '' -e 's/freebsd1\*)/SHOULDNOTMATCHANYTHING1)/' \
+   -e 's/freebsd\[123\]\*)/SHOULDNOTMATCHANYTHING2)/' {} +
+
+.ORDER: run-autotools run-autotools-fixup do-configure
+do-configure: run-autotools-fixup
+.endif
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r226028 - head/usr.sbin/portsnap/portsnap

2011-10-04 Thread Jilles Tjoelker
Author: jilles
Date: Tue Oct  4 22:28:06 2011
New Revision: 226028
URL: http://svn.freebsd.org/changeset/base/226028

Log:
  portsnap: Detect error immediately if we can't fetch the snapshot metadata.
  
  Also add some quotes around command substitution where useful and possible.
  
  Reviewed by:  cperciva
  MFC after:1 week

Modified:
  head/usr.sbin/portsnap/portsnap/portsnap.sh

Modified: head/usr.sbin/portsnap/portsnap/portsnap.sh
==
--- head/usr.sbin/portsnap/portsnap/portsnap.sh Tue Oct  4 22:23:00 2011
(r226027)
+++ head/usr.sbin/portsnap/portsnap/portsnap.sh Tue Oct  4 22:28:06 2011
(r226028)
@@ -536,9 +536,9 @@ fetch_metadata() {
rm -f ${SNAPSHOTHASH} tINDEX.new
 
echo ${NDEBUG} Fetching snapshot metadata... 
-   fetch ${QUIETFLAG} http://${SERVERNAME}/t/${SNAPSHOTHASH}
+   fetch ${QUIETFLAG} http://${SERVERNAME}/t/${SNAPSHOTHASH} \
2${QUIETREDIR} || return
-   if [ `${SHA256} -q ${SNAPSHOTHASH}` != ${SNAPSHOTHASH} ]; then
+   if [ `${SHA256} -q ${SNAPSHOTHASH}` != ${SNAPSHOTHASH} ]; then
echo snapshot metadata corrupt.
return 1
fi
@@ -606,7 +606,7 @@ fetch_index_sanity() {
 # Verify a list of files
 fetch_snapshot_verify() {
while read F; do
-   if [ `gunzip -c snap/${F} | ${SHA256} -q` != ${F} ]; then
+   if [ `gunzip -c snap/${F} | ${SHA256} -q` != ${F} ]; then
echo snapshot corrupt.
return 1
fi
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r226029 - in head/sys: conf libkern sys

2011-10-04 Thread Jung-uk Kim
Author: jkim
Date: Tue Oct  4 23:53:47 2011
New Revision: 226029
URL: http://svn.freebsd.org/changeset/base/226029

Log:
  Add strnlen() to libkern.

Added:
  head/sys/libkern/strnlen.c
 - copied, changed from r225884, head/lib/libc/string/strnlen.c
Modified:
  head/sys/conf/files
  head/sys/sys/libkern.h

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue Oct  4 22:28:06 2011(r226028)
+++ head/sys/conf/files Tue Oct  4 23:53:47 2011(r226029)
@@ -2553,6 +2553,7 @@ libkern/strlcpy.c standard
 libkern/strlen.c   standard
 libkern/strncmp.c  standard
 libkern/strncpy.c  standard
+libkern/strnlen.c  standard
 libkern/strsep.c   standard
 libkern/strspn.c   standard
 libkern/strstr.c   standard

Copied and modified: head/sys/libkern/strnlen.c (from r225884, 
head/lib/libc/string/strnlen.c)
==
--- head/lib/libc/string/strnlen.c  Fri Sep 30 08:05:58 2011
(r225884, copy source)
+++ head/sys/libkern/strnlen.c  Tue Oct  4 23:53:47 2011(r226029)
@@ -27,7 +27,7 @@
 #include sys/cdefs.h
 __FBSDID($FreeBSD$);
 
-#include string.h
+#include sys/libkern.h
 
 size_t
 strnlen(const char *s, size_t maxlen)

Modified: head/sys/sys/libkern.h
==
--- head/sys/sys/libkern.h  Tue Oct  4 22:28:06 2011(r226028)
+++ head/sys/sys/libkern.h  Tue Oct  4 23:53:47 2011(r226029)
@@ -116,6 +116,7 @@ size_t   strlen(const char *);
 int strncasecmp(const char *, const char *, size_t);
 int strncmp(const char *, const char *, size_t);
 char   *strncpy(char * __restrict, const char * __restrict, size_t);
+size_t  strnlen(const char *, size_t);
 char   *strsep(char **, const char *delim);
 size_t  strspn(const char *, const char *);
 char   *strstr(const char *, const char *);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r225937 - in head: . release release/amd64 release/i386 release/ia64 release/pc98 release/powerpc release/scripts release/sparc64 usr.sbin usr.sbin/sysinstall

2011-10-04 Thread Craig Rodrigues
Nathan,

I took at look at this page:

http://wiki.pcbsd.org/index.php/Creating_an_Automated_Installation_with_pc-sysinstall

and compared it to the man page for sysinstall:

http://www.freebsd.org/cgi/man.cgi?query=sysinstallapropos=0sektion=0manpath=FreeBSD+8.2-RELEASEarch=defaultformat=html


pc-sysinstall pretty much does all of the same stuff as sysinstall,
and even many of the variable names are the same.  pc-sysinstall
seems far superior to sysinstall.

In the timeframe before 10.0, do you think it is worth doing the following:

(1)  import pc-sysinstall into FreeBSD
(2)  make pc-sysinstall compatible with all the variables from the

*or* if it is not worth doing (2)

(3)  provide a document somewhere that guides users in migrating their
  old install.cfg syntax to pc-sysinstall (or bsdinstall).

bsdinstall and pc-sysinstall are really good improvements!
-- 
Craig Rodrigues
rodr...@crodrigues.org
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org