svn commit: r215661 - stable/8/sys/compat/linux

2010-11-22 Thread Alexander Leidinger
Author: netchild
Date: Mon Nov 22 08:21:58 2010
New Revision: 215661
URL: http://svn.freebsd.org/changeset/base/215661

Log:
  MFC r215338:
- print out the PID and program name of the program trying to use an
  unsupported futex operation
- for those futex operations which are known to be not supported,
  print out which futex operation it is
- shortcut the error return of the unsupported FUTEX_CLOCK_REALTIME in
  some cases:
FUTEX_CLOCK_REALTIME can be used to tell linux to use
CLOCK_REALTIME instead of CLOCK_MONOTONIC. FUTEX_CLOCK_REALTIME
however must only be set, if either FUTEX_WAIT_BITSET or
FUTEX_WAIT_REQUEUE_PI are set too. If that's not the case
we can die with ENOSYS right at the beginning.
  
Submitted by:   arundel
Reviewed by:rdivacky (earlier iteration of the patch)
MFC after:  1 week

Modified:
  stable/8/sys/compat/linux/linux_futex.c
  stable/8/sys/compat/linux/linux_futex.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/compat/linux/linux_futex.c
==
--- stable/8/sys/compat/linux/linux_futex.c Mon Nov 22 08:19:18 2010
(r215660)
+++ stable/8/sys/compat/linux/linux_futex.c Mon Nov 22 08:21:58 2010
(r215661)
@@ -428,7 +428,7 @@ futex_atomic_op(struct thread *td, int e
 int
 linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
 {
-   int op_ret, val, ret, nrwake;
+   int clockrt, nrwake, op_ret, ret, val;
struct linux_emuldata *em;
struct waiting_proc *wp;
struct futex *f, *f2;
@@ -441,7 +441,19 @@ linux_sys_futex(struct thread *td, struc
 * in most cases (ie. when futexes are not shared on file descriptor
 * or between different processes.).
 */
-   args-op = (args-op  ~LINUX_FUTEX_PRIVATE_FLAG);
+   args-op = args-op  ~LINUX_FUTEX_PRIVATE_FLAG;
+
+   /*
+* Currently support for switching between CLOCK_MONOTONIC and
+* CLOCK_REALTIME is not present. However Linux forbids the use of
+* FUTEX_CLOCK_REALTIME with any op except FUTEX_WAIT_BITSET and
+* FUTEX_WAIT_REQUEUE_PI.
+*/
+   clockrt = args-op  LINUX_FUTEX_CLOCK_REALTIME;
+   args-op = args-op  ~LINUX_FUTEX_CLOCK_REALTIME;
+   if (clockrt  args-op != LINUX_FUTEX_WAIT_BITSET 
+   args-op != LINUX_FUTEX_WAIT_REQUEUE_PI)
+   return (ENOSYS);
 
switch (args-op) {
case LINUX_FUTEX_WAIT:
@@ -624,14 +636,23 @@ linux_sys_futex(struct thread *td, struc
 
case LINUX_FUTEX_LOCK_PI:
/* not yet implemented */
+   linux_msg(td,
+ linux_sys_futex: 
+ op LINUX_FUTEX_LOCK_PI not implemented.\n);
return (ENOSYS);
 
case LINUX_FUTEX_UNLOCK_PI:
/* not yet implemented */
+   linux_msg(td,
+ linux_sys_futex: 
+ op LINUX_FUTEX_UNLOCK_PI not implemented.\n);
return (ENOSYS);
 
case LINUX_FUTEX_TRYLOCK_PI:
/* not yet implemented */
+   linux_msg(td,
+ linux_sys_futex: 
+ op LINUX_FUTEX_TRYLOCK_PI not implemented.\n);
return (ENOSYS);
 
case LINUX_FUTEX_REQUEUE:
@@ -644,15 +665,30 @@ linux_sys_futex(struct thread *td, struc
 */
em = em_find(td-td_proc, EMUL_DONTLOCK);
if (em-used_requeue == 0) {
-   printf(linux(%s (%d)) sys_futex: 
-   unsupported futex_requeue op\n,
-   td-td_proc-p_comm, td-td_proc-p_pid);
+   linux_msg(td,
+ linux_sys_futex: 
+ unsupported futex_requeue op\n);
em-used_requeue = 1;
}
return (EINVAL);
 
+   case LINUX_FUTEX_WAIT_BITSET:
+   /* not yet implemented */
+   linux_msg(td,
+ linux_sys_futex: 
+ op FUTEX_WAIT_BITSET not implemented.\n);
+   return (ENOSYS);
+
+   case LINUX_FUTEX_WAIT_REQUEUE_PI:
+   /* not yet implemented */
+   linux_msg(td,
+ linux_sys_futex: 
+ op FUTEX_WAIT_REQUEUE_PI not implemented.\n);
+   return (ENOSYS);
+
default:
-   printf(linux_sys_futex: unknown op %d\n, args-op);
+   linux_msg(td,
+  

svn commit: r215662 - stable/8/sys/compat/linux

2010-11-22 Thread Alexander Leidinger
Author: netchild
Date: Mon Nov 22 08:35:06 2010
New Revision: 215662
URL: http://svn.freebsd.org/changeset/base/215662

Log:
  MFC r215339:
Some style(9) fixes.
  
Submitted by:   arundel

Modified:
  stable/8/sys/compat/linux/linux_futex.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/compat/linux/linux_futex.c
==
--- stable/8/sys/compat/linux/linux_futex.c Mon Nov 22 08:21:58 2010
(r215661)
+++ stable/8/sys/compat/linux/linux_futex.c Mon Nov 22 08:35:06 2010
(r215662)
@@ -668,7 +668,7 @@ linux_sys_futex(struct thread *td, struc
linux_msg(td,
  linux_sys_futex: 
  unsupported futex_requeue op\n);
-   em-used_requeue = 1;
+   em-used_requeue = 1;
}
return (EINVAL);
 
@@ -713,7 +713,7 @@ linux_set_robust_list(struct thread *td,
em-robust_futexes = args-head;
EMUL_UNLOCK(emul_lock);
 
-   return (0); 
+   return (0);
 }
 
 int
@@ -731,7 +731,7 @@ linux_get_robust_list(struct thread *td,
 
if (!args-pid) {
em = em_find(td-td_proc, EMUL_DONTLOCK);
-   head = em-robust_futexes;  
+   head = em-robust_futexes;
} else {
struct proc *p;
 
@@ -741,14 +741,14 @@ linux_get_robust_list(struct thread *td,
 
em = em_find(p, EMUL_DONTLOCK);
/* XXX: ptrace? */
-   if (priv_check(td, PRIV_CRED_SETUID) || 
+   if (priv_check(td, PRIV_CRED_SETUID) ||
priv_check(td, PRIV_CRED_SETEUID) ||
p_candebug(td, p)) {
PROC_UNLOCK(p);
return (EPERM);
}
head = em-robust_futexes;
-   
+
PROC_UNLOCK(p);
}
 
___
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-unsubscr...@freebsd.org


svn commit: r215663 - head/sys/i386/xen

2010-11-22 Thread Colin Percival
Author: cperciva
Date: Mon Nov 22 09:04:29 2010
New Revision: 215663
URL: http://svn.freebsd.org/changeset/base/215663

Log:
  In xen_get_timecount, return the full ns-precision time rather than
  rounding to 1/HZ precision.
  
  I have no idea why the rounding was introduced in the first place, but
  it makes FreeBSD unhappy.

Modified:
  head/sys/i386/xen/clock.c

Modified: head/sys/i386/xen/clock.c
==
--- head/sys/i386/xen/clock.c   Mon Nov 22 08:35:06 2010(r215662)
+++ head/sys/i386/xen/clock.c   Mon Nov 22 09:04:29 2010(r215663)
@@ -829,7 +829,7 @@ xen_get_timecount(struct timecounter *tc

 clk = shadow-system_timestamp + get_nsec_offset(shadow);
 
-   return (uint32_t)((clk / NS_PER_TICK) * NS_PER_TICK);
+   return (uint32_t)(clk);
 
 }
 
___
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-unsubscr...@freebsd.org


svn commit: r215664 - in head/sys: compat/linux kern

2010-11-22 Thread Alexander Leidinger
Author: netchild
Date: Mon Nov 22 09:06:59 2010
New Revision: 215664
URL: http://svn.freebsd.org/changeset/base/215664

Log:
  By using the 32-bit Linux version of Sun's Java Development Kit 1.6
  on FreeBSD (amd64), invocations of javac (or java) eventually
  end with the output of Killed and exit code 137.
  
  This is caused by:
  1. After calling exec() in multithreaded linux program threads are not
 destroyed and continue running. They get killed after program being
 executed finishes.
  
  2. linux_exit_group doesn't return correct exit code when called not
 from group leader. Which happens regularly using sun jvm.
  
  The submitters fix this in a similar way to how NetBSD handles this.
  
  I took the PRs away from dchagin, who seems to be out of touch of
  this since a while (no response from him).
  
  The patches committed here are from [2], with some little modifications
  from me to the style.
  
  PR:   141439 [1], 144194 [2]
  Submitted by: Stefan Schmidt stefan.schm...@stadtbuch.de, gk
  Reviewed by:  rdivacky (in april 2010)
  MFC after:5 days

Modified:
  head/sys/compat/linux/linux_emul.c
  head/sys/compat/linux/linux_emul.h
  head/sys/compat/linux/linux_misc.c
  head/sys/kern/kern_exit.c

Modified: head/sys/compat/linux/linux_emul.c
==
--- head/sys/compat/linux/linux_emul.c  Mon Nov 22 09:04:29 2010
(r215663)
+++ head/sys/compat/linux/linux_emul.c  Mon Nov 22 09:06:59 2010
(r215664)
@@ -155,7 +155,7 @@ void
 linux_proc_exit(void *arg __unused, struct proc *p)
 {
struct linux_emuldata *em;
-   int error;
+   int error, shared_flags, shared_xstat;
struct thread *td = FIRST_THREAD_IN_PROC(p);
int *child_clear_tid;
struct proc *q, *nq;
@@ -187,6 +187,8 @@ linux_proc_exit(void *arg __unused, stru
}
 
EMUL_SHARED_WLOCK(emul_shared_lock);
+   shared_flags = em-shared-flags;
+   shared_xstat = em-shared-xstat;
LIST_REMOVE(em, threads);
 
em-shared-refs--;
@@ -196,6 +198,12 @@ linux_proc_exit(void *arg __unused, stru
} else  
EMUL_SHARED_WUNLOCK(emul_shared_lock);
 
+   if ((shared_flags  EMUL_SHARED_HASXSTAT) != 0) {
+   PROC_LOCK(p);
+   p-p_xstat = shared_xstat;
+   PROC_UNLOCK(p);
+   }
+
if (child_clear_tid != NULL) {
struct linux_sys_futex_args cup;
int null = 0;
@@ -257,6 +265,9 @@ linux_proc_exec(void *arg __unused, stru
if (__predict_false(imgp-sysent == elf_linux_sysvec
 p-p_sysent != elf_linux_sysvec))
linux_proc_init(FIRST_THREAD_IN_PROC(p), p-p_pid, 0);
+   if (__predict_false(p-p_sysent == elf_linux_sysvec))
+   /* Kill threads regardless of imgp-sysent value */
+   linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL);
if (__predict_false(imgp-sysent != elf_linux_sysvec
 p-p_sysent == elf_linux_sysvec)) {
struct linux_emuldata *em;
@@ -334,3 +345,29 @@ linux_set_tid_address(struct thread *td,
EMUL_UNLOCK(emul_lock);
return 0;
 }
+
+void
+linux_kill_threads(struct thread *td, int sig)
+{
+   struct linux_emuldata *em, *td_em, *tmp_em;
+   struct proc *sp;
+
+   td_em = em_find(td-td_proc, EMUL_DONTLOCK);
+
+   KASSERT(td_em != NULL, (linux_kill_threads: emuldata not found.\n));
+
+   EMUL_SHARED_RLOCK(emul_shared_lock);
+   LIST_FOREACH_SAFE(em, td_em-shared-threads, threads, tmp_em) {
+   if (em-pid == td_em-pid)
+   continue;
+
+   sp = pfind(em-pid);
+   if ((sp-p_flag  P_WEXIT) == 0)
+   psignal(sp, sig);
+   PROC_UNLOCK(sp);
+#ifdef DEBUG
+   printf(LMSG(linux_kill_threads: kill PID %d\n), em-pid);
+#endif
+   }
+   EMUL_SHARED_RUNLOCK(emul_shared_lock);
+}

Modified: head/sys/compat/linux/linux_emul.h
==
--- head/sys/compat/linux/linux_emul.h  Mon Nov 22 09:04:29 2010
(r215663)
+++ head/sys/compat/linux/linux_emul.h  Mon Nov 22 09:06:59 2010
(r215664)
@@ -31,8 +31,12 @@
 #ifndef _LINUX_EMUL_H_
 #define_LINUX_EMUL_H_
 
+#define EMUL_SHARED_HASXSTAT   0x01
+
 struct linux_emuldata_shared {
int refs;
+   int flags;
+   int xstat;
pid_t   group_pid;
 
LIST_HEAD(, linux_emuldata) threads; /* head of list of linux threads */
@@ -76,6 +80,7 @@ int   linux_proc_init(struct thread *, pid
 void   linux_proc_exit(void *, struct proc *);
 void   linux_schedtail(void *, struct proc *);
 void   linux_proc_exec(void *, struct proc *, struct image_params *);
+void   linux_kill_threads(struct thread *, int);
 
 extern struct sx   emul_shared_lock;
 extern struct mtx  emul_lock;

Modified: 

svn commit: r215665 - head/sys/kern

2010-11-22 Thread Colin Percival
Author: cperciva
Date: Mon Nov 22 09:13:25 2010
New Revision: 215665
URL: http://svn.freebsd.org/changeset/base/215665

Log:
  In tc_windup, handle the case where the previous call to tc_windup was
  more than 1s earlier.  Prior to this commit, the computation of
  th_scale * delta (which produces a 64-bit value equal to the time since
  the last tc_windup call in units of 2^(-64) seconds) would overflow and
  any complete seconds would be lost.
  
  We fix this by repeatedly converting tc_frequency units of timecounter
  to one seconds; this is not exactly correct, since it loses the NTP
  adjustment, but if we find ourselves going more than 1s at a time between
  clock interrupts, losing a few seconds worth of NTP adjustments is the
  least of our problems...

Modified:
  head/sys/kern/kern_tc.c

Modified: head/sys/kern/kern_tc.c
==
--- head/sys/kern/kern_tc.c Mon Nov 22 09:06:59 2010(r215664)
+++ head/sys/kern/kern_tc.c Mon Nov 22 09:13:25 2010(r215665)
@@ -442,6 +442,16 @@ tc_windup(void)
ncount = 0;
th-th_offset_count += delta;
th-th_offset_count = th-th_counter-tc_counter_mask;
+   while (delta  th-th_counter-tc_frequency) {
+   /* Eat complete unadjusted seconds. */
+   delta -= th-th_counter-tc_frequency;
+   th-th_offset.sec++;
+   }
+   if ((delta  th-th_counter-tc_frequency / 2) 
+   (th-th_scale * delta  (uint64_t)1  63)) {
+   /* The product th_scale * delta just barely overflows. */
+   th-th_offset.sec++;
+   }
bintime_addx(th-th_offset, th-th_scale * delta);
 
/*
___
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-unsubscr...@freebsd.org


svn commit: r215666 - head/sys/compat/linux

2010-11-22 Thread Alexander Leidinger
Author: netchild
Date: Mon Nov 22 09:25:32 2010
New Revision: 215666
URL: http://svn.freebsd.org/changeset/base/215666

Log:
  Remove trailing dot from the unimplemented futex messages to make
  them consistent with the syscall and ipc messages.
  
  Submitted by: arundel
  MFC after:3 days

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

Modified: head/sys/compat/linux/linux_futex.c
==
--- head/sys/compat/linux/linux_futex.c Mon Nov 22 09:13:25 2010
(r215665)
+++ head/sys/compat/linux/linux_futex.c Mon Nov 22 09:25:32 2010
(r215666)
@@ -626,21 +626,21 @@ linux_sys_futex(struct thread *td, struc
/* not yet implemented */
linux_msg(td,
  linux_sys_futex: 
- op LINUX_FUTEX_LOCK_PI not implemented.\n);
+ op LINUX_FUTEX_LOCK_PI not implemented\n);
return (ENOSYS);
 
case LINUX_FUTEX_UNLOCK_PI:
/* not yet implemented */
linux_msg(td,
  linux_sys_futex: 
- op LINUX_FUTEX_UNLOCK_PI not implemented.\n);
+ op LINUX_FUTEX_UNLOCK_PI not implemented\n);
return (ENOSYS);
 
case LINUX_FUTEX_TRYLOCK_PI:
/* not yet implemented */
linux_msg(td,
  linux_sys_futex: 
- op LINUX_FUTEX_TRYLOCK_PI not implemented.\n);
+ op LINUX_FUTEX_TRYLOCK_PI not implemented\n);
return (ENOSYS);
 
case LINUX_FUTEX_REQUEUE:
@@ -664,14 +664,14 @@ linux_sys_futex(struct thread *td, struc
/* not yet implemented */
linux_msg(td,
  linux_sys_futex: 
- op FUTEX_WAIT_BITSET not implemented.\n);
+ op FUTEX_WAIT_BITSET not implemented\n);
return (ENOSYS);
 
case LINUX_FUTEX_WAIT_REQUEUE_PI:
/* not yet implemented */
linux_msg(td,
  linux_sys_futex: 
- op FUTEX_WAIT_REQUEUE_PI not implemented.\n);
+ op FUTEX_WAIT_REQUEUE_PI not implemented\n);
return (ENOSYS);
 
default:
___
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-unsubscr...@freebsd.org


Re: svn commit: r215664 - in head/sys: compat/linux kern

2010-11-22 Thread Kostik Belousov
On Mon, Nov 22, 2010 at 09:07:00AM +, Alexander Leidinger wrote:
 Author: netchild
 Date: Mon Nov 22 09:06:59 2010
 New Revision: 215664
 URL: http://svn.freebsd.org/changeset/base/215664
 
 Log:
   By using the 32-bit Linux version of Sun's Java Development Kit 1.6
   on FreeBSD (amd64), invocations of javac (or java) eventually
   end with the output of Killed and exit code 137.
   
   This is caused by:
   1. After calling exec() in multithreaded linux program threads are not
  destroyed and continue running. They get killed after program being
  executed finishes.
   
   2. linux_exit_group doesn't return correct exit code when called not
  from group leader. Which happens regularly using sun jvm.
   
   The submitters fix this in a similar way to how NetBSD handles this.
   
   I took the PRs away from dchagin, who seems to be out of touch of
   this since a while (no response from him).
   
   The patches committed here are from [2], with some little modifications
   from me to the style.
   
   PR: 141439 [1], 144194 [2]
   Submitted by:   Stefan Schmidt stefan.schm...@stadtbuch.de, gk
   Reviewed by:rdivacky (in april 2010)
   MFC after:  5 days
 
 Modified:
   head/sys/compat/linux/linux_emul.c
   head/sys/compat/linux/linux_emul.h
   head/sys/compat/linux/linux_misc.c
   head/sys/kern/kern_exit.c
 
 Modified: head/sys/compat/linux/linux_emul.c
 ==
 --- head/sys/compat/linux/linux_emul.cMon Nov 22 09:04:29 2010
 (r215663)
 +++ head/sys/compat/linux/linux_emul.cMon Nov 22 09:06:59 2010
 (r215664)
 @@ -155,7 +155,7 @@ void
  linux_proc_exit(void *arg __unused, struct proc *p)
  {
   struct linux_emuldata *em;
 - int error;
 + int error, shared_flags, shared_xstat;
   struct thread *td = FIRST_THREAD_IN_PROC(p);
   int *child_clear_tid;
   struct proc *q, *nq;
 @@ -187,6 +187,8 @@ linux_proc_exit(void *arg __unused, stru
   }
  
   EMUL_SHARED_WLOCK(emul_shared_lock);
 + shared_flags = em-shared-flags;
 + shared_xstat = em-shared-xstat;
   LIST_REMOVE(em, threads);
  
   em-shared-refs--;
 @@ -196,6 +198,12 @@ linux_proc_exit(void *arg __unused, stru
   } else  
   EMUL_SHARED_WUNLOCK(emul_shared_lock);
  
 + if ((shared_flags  EMUL_SHARED_HASXSTAT) != 0) {
 + PROC_LOCK(p);
 + p-p_xstat = shared_xstat;
 + PROC_UNLOCK(p);
 + }
Why is process lock taken there ? The assignment to u_short inside the
properly aligned structure is atomic on all supported architectures, and
the thread that should see side-effect of assignment is the same thread
that does assignment.

 +
   if (child_clear_tid != NULL) {
   struct linux_sys_futex_args cup;
   int null = 0;
 @@ -257,6 +265,9 @@ linux_proc_exec(void *arg __unused, stru
   if (__predict_false(imgp-sysent == elf_linux_sysvec
p-p_sysent != elf_linux_sysvec))
   linux_proc_init(FIRST_THREAD_IN_PROC(p), p-p_pid, 0);
 + if (__predict_false(p-p_sysent == elf_linux_sysvec))
 + /* Kill threads regardless of imgp-sysent value */
 + linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL);
This is better expressed by
if ((p-p_sysent-sv_flags  SV_ABI_MASK) == SV_ABI_LINUX)

Regardless of this mostly cosmetic issue, this is racy. Other
linux thread in the same process might do an execve(3).
More, if execve(3) call fails, then you return into the process
that lacks all threads except the one that called execve(3).

   if (__predict_false(imgp-sysent != elf_linux_sysvec
p-p_sysent == elf_linux_sysvec)) {
   struct linux_emuldata *em;
 @@ -334,3 +345,29 @@ linux_set_tid_address(struct thread *td,
   EMUL_UNLOCK(emul_lock);
   return 0;
  }
 +
 +void
 +linux_kill_threads(struct thread *td, int sig)
 +{
 + struct linux_emuldata *em, *td_em, *tmp_em;
 + struct proc *sp;
 +
 + td_em = em_find(td-td_proc, EMUL_DONTLOCK);
 +
 + KASSERT(td_em != NULL, (linux_kill_threads: emuldata not found.\n));
 +
 + EMUL_SHARED_RLOCK(emul_shared_lock);
 + LIST_FOREACH_SAFE(em, td_em-shared-threads, threads, tmp_em) {
 + if (em-pid == td_em-pid)
 + continue;
 +
 + sp = pfind(em-pid);
 + if ((sp-p_flag  P_WEXIT) == 0)
 + psignal(sp, sig);
 + PROC_UNLOCK(sp);
 +#ifdef DEBUG
 + printf(LMSG(linux_kill_threads: kill PID %d\n), em-pid);
 +#endif
 + }
 + EMUL_SHARED_RUNLOCK(emul_shared_lock);
 +}
 
 Modified: head/sys/compat/linux/linux_emul.h
 ==
 --- head/sys/compat/linux/linux_emul.hMon Nov 22 09:04:29 2010
 (r215663)
 +++ head/sys/compat/linux/linux_emul.hMon Nov 22 09:06:59 2010
 (r215664)
 @@ 

svn commit: r215667 - stable/8/sbin/fdisk

2010-11-22 Thread Brian Somers
Author: brian
Date: Mon Nov 22 09:32:54 2010
New Revision: 215667
URL: http://svn.freebsd.org/changeset/base/215667

Log:
  MFC r212247  r212724 from head:
  Handle geli-encrypted root disk devices.
  Add support for identifying a journaled root filesystem.
  Fix support for identifying the given /dev/vinum/root example.

Modified:
  stable/8/sbin/fdisk/fdisk.c
Directory Properties:
  stable/8/sbin/fdisk/   (props changed)

Modified: stable/8/sbin/fdisk/fdisk.c
==
--- stable/8/sbin/fdisk/fdisk.c Mon Nov 22 09:25:32 2010(r215666)
+++ stable/8/sbin/fdisk/fdisk.c Mon Nov 22 09:32:54 2010(r215667)
@@ -1461,6 +1461,8 @@ sanitize_partition(struct dos_partition 
  *   /dev/ad0s1a = /dev/ad0
  *   /dev/da0a   = /dev/da0
  *   /dev/vinum/root = /dev/vinum/root
+ * A .eli part is removed if it exists (see geli(8)).
+ * A .journal ending is removed if it exists (see gjournal(8)).
  */
 static char *
 get_rootdisk(void)
@@ -1469,16 +1471,20 @@ get_rootdisk(void)
regex_t re;
 #define NMATCHES 2
regmatch_t rm[NMATCHES];
-   char *s;
+   char dev[PATH_MAX], *s;
int rv;
 
if (statfs(/, rootfs) == -1)
err(1, statfs(\/\));
 
-   if ((rv = regcomp(re, ^(/dev/[a-z/]+[0-9]+)([sp][0-9]+)?[a-h]?$,
+   if ((rv = regcomp(re, 
^(/dev/[a-z/]+[0-9]*)([sp][0-9]+)?[a-h]?(\\.journal)?$,
REG_EXTENDED)) != 0)
errx(1, regcomp() failed (%d), rv);
-   if ((rv = regexec(re, rootfs.f_mntfromname, NMATCHES, rm, 0)) != 0)
+   strlcpy(dev, rootfs.f_mntfromname, sizeof (dev));
+   if ((s = strstr(dev, .eli)) != NULL)
+   memmove(s, s+4, strlen(s + 4) + 1);
+
+   if ((rv = regexec(re, dev, NMATCHES, rm, 0)) != 0)
errx(1,
 mounted root fs resource doesn't match expectations (regexec returned %d),
rv);
___
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-unsubscr...@freebsd.org


svn commit: r215668 - stable/7/sbin/fdisk

2010-11-22 Thread Brian Somers
Author: brian
Date: Mon Nov 22 09:34:38 2010
New Revision: 215668
URL: http://svn.freebsd.org/changeset/base/215668

Log:
  MFC r212247  r212724 from head:
  Handle geli-encrypted root disk devices.
  Add support for identifying a journaled root filesystem.
  Fix support for identifying the given /dev/vinum/root example.

Modified:
  stable/7/sbin/fdisk/fdisk.c
Directory Properties:
  stable/7/sbin/fdisk/   (props changed)

Modified: stable/7/sbin/fdisk/fdisk.c
==
--- stable/7/sbin/fdisk/fdisk.c Mon Nov 22 09:32:54 2010(r215667)
+++ stable/7/sbin/fdisk/fdisk.c Mon Nov 22 09:34:38 2010(r215668)
@@ -1492,6 +1492,8 @@ sanitize_partition(struct dos_partition 
  *   /dev/ad0s1a = /dev/ad0
  *   /dev/da0a   = /dev/da0
  *   /dev/vinum/root = /dev/vinum/root
+ * A .eli part is removed if it exists (see geli(8)).
+ * A .journal ending is removed if it exists (see gjournal(8)).
  */
 static char *
 get_rootdisk(void)
@@ -1500,16 +1502,20 @@ get_rootdisk(void)
regex_t re;
 #define NMATCHES 2
regmatch_t rm[NMATCHES];
-   char *s;
+   char dev[PATH_MAX], *s;
int rv;
 
if (statfs(/, rootfs) == -1)
err(1, statfs(\/\));
 
-   if ((rv = regcomp(re, ^(/dev/[a-z/]+[0-9]+)([sp][0-9]+)?[a-h]?$,
+   if ((rv = regcomp(re, 
^(/dev/[a-z/]+[0-9]*)([sp][0-9]+)?[a-h]?(\\.journal)?$,
REG_EXTENDED)) != 0)
errx(1, regcomp() failed (%d), rv);
-   if ((rv = regexec(re, rootfs.f_mntfromname, NMATCHES, rm, 0)) != 0)
+   strlcpy(dev, rootfs.f_mntfromname, sizeof (dev));
+   if ((s = strstr(dev, .eli)) != NULL)
+   memmove(s, s+4, strlen(s + 4) + 1);
+
+   if ((rv = regexec(re, dev, NMATCHES, rm, 0)) != 0)
errx(1,
 mounted root fs resource doesn't match expectations (regexec returned %d),
rv);
___
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-unsubscr...@freebsd.org


svn commit: r215669 - head

2010-11-22 Thread Alexander Leidinger
Author: netchild
Date: Mon Nov 22 09:37:52 2010
New Revision: 215669
URL: http://svn.freebsd.org/changeset/base/215669

Log:
  1) Add a hint to check for duplicates with optional files. The committed
 text is a little bit modified to what was submitted.
 The code example to automate a part of this was proposed by
 Dmitry Morozovsky.
  2) Remove trailing whitespace.
  
  Submitted by: arundel

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Mon Nov 22 09:34:38 2010(r215668)
+++ head/ObsoleteFiles.inc  Mon Nov 22 09:37:52 2010(r215669)
@@ -13,6 +13,15 @@
 #
 # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last.
 #
+# Before you commit changes to this file please check if any entries in
+# tools/build/mk/OptionalObsoleteFiles.inc can be removed. The following
+# command tells which files are listed more than once regardless of some
+# architecture specific conditionals, so you can not blindly trust the
+# output:
+# ( grep '+=' /usr/src/ObsoleteFiles.inc | sort -u ; \
+# grep '+=' /usr/src/tools/build/mk/OptionalObsoleteFiles.inc | sort -u) | \
+# sort | uniq -d
+#
 
 # 20101112: vgonel(9) has gone to private API a while ago
 OLD_FILES+=usr/share/man/man9/vgonel.9.gz
@@ -1634,7 +1643,7 @@ OLD_DIRS+=usr/include/c++/3.4
 OLD_FILES+=usr/sbin/zfs
 OLD_FILES+=usr/sbin/zpool
 # 20070423: rc.bluetooth (examples) removed
-OLD_FILES+=usr/share/examples/netgraph/bluetooth/rc.bluetooth 
+OLD_FILES+=usr/share/examples/netgraph/bluetooth/rc.bluetooth
 # 20070421: worm.4 removed
 OLD_FILES+=usr/share/man/man4/worm.4.gz
 # 20070417: trunk(4) renamed to lagg(4)
___
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-unsubscr...@freebsd.org


svn commit: r215670 - svnadmin/conf

2010-11-22 Thread Alexander Motin
Author: mav
Date: Mon Nov 22 09:59:10 2010
New Revision: 215670
URL: http://svn.freebsd.org/changeset/base/215670

Log:
  Release ae@ from mentorship. He is now ready wear his own pointy hats.
  Congratulations!
  
  Reviewed by:  kib@

Modified:
  svnadmin/conf/mentors

Modified: svnadmin/conf/mentors
==
--- svnadmin/conf/mentors   Mon Nov 22 09:37:52 2010(r215669)
+++ svnadmin/conf/mentors   Mon Nov 22 09:59:10 2010(r215670)
@@ -10,7 +10,6 @@
 # Sort by mentee login name.
 
 # Mentee   Mentor  Optional comment
-ae mav Co-mentor: kib
 anchie bz
 andreast   nwhitehorn
 andrew imp
___
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-unsubscr...@freebsd.org


svn commit: r215671 - head/sbin/geom/class/part

2010-11-22 Thread Andrey V. Elsukov
Author: ae
Date: Mon Nov 22 10:08:33 2010
New Revision: 215671
URL: http://svn.freebsd.org/changeset/base/215671

Log:
  Always dump partition labels with `gpart backup`, but `gpart restore`
  does restore them only when -l option is specified [1]. Make number of
  entries field in backup format optional. Document -l and -r options of
  `gpart show` action.
  
  Suggested by: pjd [1]
  MFC after:1 week

Modified:
  head/sbin/geom/class/part/geom_part.c
  head/sbin/geom/class/part/gpart.8

Modified: head/sbin/geom/class/part/geom_part.c
==
--- head/sbin/geom/class/part/geom_part.c   Mon Nov 22 09:59:10 2010
(r215670)
+++ head/sbin/geom/class/part/geom_part.c   Mon Nov 22 10:08:33 2010
(r215671)
@@ -100,10 +100,8 @@ struct g_command PUBSYM(class_commands)[
G_OPT_SENTINEL },
[-b start] [-s size] -t type [-i index] [-l label] [-f flags] geom
},
-   { backup, 0, gpart_backup, {
-   { 'l', backup_labels, NULL, G_TYPE_BOOL},
-   G_OPT_SENTINEL },
-   [-l] geom
+   { backup, 0, gpart_backup, G_NULL_OPTS,
+   geom
},
{ bootcode, 0, gpart_bootcode, {
{ 'b', GPART_PARAM_BOOTCODE, G_VAL_OPTIONAL, G_TYPE_STRING },
@@ -175,9 +173,10 @@ struct g_command PUBSYM(class_commands)[
},
{ restore, 0, gpart_restore, {
{ 'F', force, NULL, G_TYPE_BOOL },
+   { 'l', restore_labels, NULL, G_TYPE_BOOL },
{ 'f', flags, GPART_FLAGS, G_TYPE_STRING },
G_OPT_SENTINEL },
-   [-F] [-f flags] provider [...]
+   [-lF] [-f flags] provider [...]
},
{ recover, 0, gpart_issue, {
{ 'f', flags, GPART_FLAGS, G_TYPE_STRING },
@@ -678,7 +677,7 @@ gpart_backup(struct gctl_req *req, unsig
const char *s, *scheme;
off_t sector, end;
off_t length, secsz;
-   int error, labels, i, windex, wblocks, wtype;
+   int error, i, windex, wblocks, wtype;
 
if (gctl_get_int(req, nargs) != 1)
errx(EXIT_FAILURE, Invalid number of arguments.);
@@ -696,7 +695,6 @@ gpart_backup(struct gctl_req *req, unsig
s = gctl_get_ascii(req, arg0);
if (s == NULL)
abort();
-   labels = gctl_get_int(req, backup_labels);
gp = find_geom(classp, s);
if (gp == NULL)
errx(EXIT_FAILURE, No such geom: %s., s);
@@ -734,14 +732,12 @@ gpart_backup(struct gctl_req *req, unsig
length = end - sector + 1;
}
s = find_provcfg(pp, label);
-   printf(%-*s %*s %*jd %*jd,
+   printf(%-*s %*s %*jd %*jd %s %s\n,
windex, find_provcfg(pp, index),
wtype, find_provcfg(pp, type),
wblocks, (intmax_t)sector,
-   wblocks, (intmax_t)length);
-   if (labels  s != NULL)
-   printf( %s, s);
-   printf( %s\n, fmtattrib(pp));
+   wblocks, (intmax_t)length,
+   (s != NULL) ? s: , fmtattrib(pp));
}
geom_deletetree(mesh);
 }
@@ -769,7 +765,7 @@ gpart_restore(struct gctl_req *req, unsi
struct ggeom *gp;
const char *s, *flags, *errstr, *label;
char **ap, *argv[6], line[BUFSIZ], *pline;
-   int error, forced, i, l, nargs, created;
+   int error, forced, i, l, nargs, created, rl;
intmax_t n;
 
nargs = gctl_get_int(req, nargs);
@@ -778,6 +774,7 @@ gpart_restore(struct gctl_req *req, unsi
 
forced = gctl_get_int(req, force);
flags = gctl_get_ascii(req, flags);
+   rl = gctl_get_int(req, restore_labels);
s = gctl_get_ascii(req, class);
if (s == NULL)
abort();
@@ -829,19 +826,21 @@ gpart_restore(struct gctl_req *req, unsi
break;
l = ap - argv[0];
label = pline = NULL;
-   if (l == 2) { /* create table */
+   if (l == 1 || l == 2) { /* create table */
if (created)
errx(EXIT_FAILURE, Incorrect backup format.);
-   n = atoi(argv[1]);
+   if (l == 2)
+   n = strtoimax(argv[1], NULL, 0);
for (i = 0; i  nargs; i++) {
s = gctl_get_ascii(req, arg%d, i);
r = gctl_get_handle();
-   n = strtoimax(argv[1], NULL, 0);
gctl_ro_param(r, class, -1,
classp-lg_name);
gctl_ro_param(r, verb, -1, create);
gctl_ro_param(r, scheme, -1, argv[0]);
-   gctl_ro_param(r, entries, 

Re: svn commit: r215664 - in head/sys: compat/linux kern

2010-11-22 Thread Alexander Leidinger
Quoting Kostik Belousov kostik...@gmail.com (from Mon, 22 Nov 2010  
11:31:34 +0200):



On Mon, Nov 22, 2010 at 09:07:00AM +, Alexander Leidinger wrote:

Author: netchild
Date: Mon Nov 22 09:06:59 2010
New Revision: 215664
URL: http://svn.freebsd.org/changeset/base/215664

Log:
  By using the 32-bit Linux version of Sun's Java Development Kit 1.6
  on FreeBSD (amd64), invocations of javac (or java) eventually
  end with the output of Killed and exit code 137.




@@ -196,6 +198,12 @@ linux_proc_exit(void *arg __unused, stru
} else
EMUL_SHARED_WUNLOCK(emul_shared_lock);

+   if ((shared_flags  EMUL_SHARED_HASXSTAT) != 0) {
+   PROC_LOCK(p);
+   p-p_xstat = shared_xstat;
+   PROC_UNLOCK(p);
+   }

Why is process lock taken there ? The assignment to u_short inside the
properly aligned structure is atomic on all supported architectures, and
the thread that should see side-effect of assignment is the same thread
that does assignment.


Change below.


+
if (child_clear_tid != NULL) {
struct linux_sys_futex_args cup;
int null = 0;
@@ -257,6 +265,9 @@ linux_proc_exec(void *arg __unused, stru
if (__predict_false(imgp-sysent == elf_linux_sysvec
 p-p_sysent != elf_linux_sysvec))
linux_proc_init(FIRST_THREAD_IN_PROC(p), p-p_pid, 0);
+   if (__predict_false(p-p_sysent == elf_linux_sysvec))
+   /* Kill threads regardless of imgp-sysent value */
+   linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL);

This is better expressed by
if ((p-p_sysent-sv_flags  SV_ABI_MASK) == SV_ABI_LINUX)


Is this OK for you?
---snip---
Index: compat/linux/linux_emul.c
===
--- compat/linux/linux_emul.c   (Revision 215664)
+++ compat/linux/linux_emul.c   (Arbeitskopie)
@@ -198,11 +198,8 @@
} else
EMUL_SHARED_WUNLOCK(emul_shared_lock);

-   if ((shared_flags  EMUL_SHARED_HASXSTAT) != 0) {
-   PROC_LOCK(p);
+   if ((shared_flags  EMUL_SHARED_HASXSTAT) != 0)
p-p_xstat = shared_xstat;
-   PROC_UNLOCK(p);
-   }

if (child_clear_tid != NULL) {
struct linux_sys_futex_args cup;
@@ -265,7 +262,8 @@
if (__predict_false(imgp-sysent == elf_linux_sysvec
 p-p_sysent != elf_linux_sysvec))
linux_proc_init(FIRST_THREAD_IN_PROC(p), p-p_pid, 0);
-   if (__predict_false(p-p_sysent == elf_linux_sysvec))
+   if (__predict_false((p-p_sysent-sv_flags  SV_ABI_MASK) ==
+   SV_ABI_LINUX))
/* Kill threads regardless of imgp-sysent value */
linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL);
if (__predict_false(imgp-sysent != elf_linux_sysvec
---snip---


Regardless of this mostly cosmetic issue, this is racy. Other
linux thread in the same process might do an execve(3).
More, if execve(3) call fails, then you return into the process
that lacks all threads except the one that called execve(3).


How critical is this in your opinion (relative to the issue this patch  
is fixing)? Do you prefer a backout or do you think the probability  
that the someone wins the race is low enough?


Do you see a solution for the race?

Bye,
Alexander.

--
http://www.Leidinger.net  Alexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org netchild @ FreeBSD.org  : PGP ID = 72077137
This generation doesn't have emotional baggage.
We have emotional moving vans.
-- Bruce Feirstein

___
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-unsubscr...@freebsd.org


Re: svn commit: r215664 - in head/sys: compat/linux kern

2010-11-22 Thread Kostik Belousov
On Mon, Nov 22, 2010 at 11:13:06AM +0100, Alexander Leidinger wrote:
 Quoting Kostik Belousov kostik...@gmail.com (from Mon, 22 Nov 2010  
 11:31:34 +0200):
 
 On Mon, Nov 22, 2010 at 09:07:00AM +, Alexander Leidinger wrote:
 Author: netchild
 Date: Mon Nov 22 09:06:59 2010
 New Revision: 215664
 URL: http://svn.freebsd.org/changeset/base/215664
 
 Log:
   By using the 32-bit Linux version of Sun's Java Development Kit 1.6
   on FreeBSD (amd64), invocations of javac (or java) eventually
   end with the output of Killed and exit code 137.
 
 
 @@ -196,6 +198,12 @@ linux_proc_exit(void *arg __unused, stru
 } else
 EMUL_SHARED_WUNLOCK(emul_shared_lock);
 
 +   if ((shared_flags  EMUL_SHARED_HASXSTAT) != 0) {
 +   PROC_LOCK(p);
 +   p-p_xstat = shared_xstat;
 +   PROC_UNLOCK(p);
 +   }
 Why is process lock taken there ? The assignment to u_short inside the
 properly aligned structure is atomic on all supported architectures, and
 the thread that should see side-effect of assignment is the same thread
 that does assignment.
 
 Change below.
 
 +
 if (child_clear_tid != NULL) {
 struct linux_sys_futex_args cup;
 int null = 0;
 @@ -257,6 +265,9 @@ linux_proc_exec(void *arg __unused, stru
 if (__predict_false(imgp-sysent == elf_linux_sysvec
  p-p_sysent != elf_linux_sysvec))
 linux_proc_init(FIRST_THREAD_IN_PROC(p), p-p_pid, 0);
 +   if (__predict_false(p-p_sysent == elf_linux_sysvec))
 +   /* Kill threads regardless of imgp-sysent value */
 +   linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL);
 This is better expressed by
  if ((p-p_sysent-sv_flags  SV_ABI_MASK) == SV_ABI_LINUX)
 
 Is this OK for you?
 ---snip---
 Index: compat/linux/linux_emul.c
 ===
 --- compat/linux/linux_emul.c   (Revision 215664)
 +++ compat/linux/linux_emul.c   (Arbeitskopie)
 @@ -198,11 +198,8 @@
 } else
 EMUL_SHARED_WUNLOCK(emul_shared_lock);
 
 -   if ((shared_flags  EMUL_SHARED_HASXSTAT) != 0) {
 -   PROC_LOCK(p);
 +   if ((shared_flags  EMUL_SHARED_HASXSTAT) != 0)
 p-p_xstat = shared_xstat;
 -   PROC_UNLOCK(p);
 -   }
 
 if (child_clear_tid != NULL) {
 struct linux_sys_futex_args cup;
 @@ -265,7 +262,8 @@
 if (__predict_false(imgp-sysent == elf_linux_sysvec
  p-p_sysent != elf_linux_sysvec))
 linux_proc_init(FIRST_THREAD_IN_PROC(p), p-p_pid, 0);
 -   if (__predict_false(p-p_sysent == elf_linux_sysvec))
 +   if (__predict_false((p-p_sysent-sv_flags  SV_ABI_MASK) ==
 +   SV_ABI_LINUX))
 /* Kill threads regardless of imgp-sysent value */
 linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL);
 if (__predict_false(imgp-sysent != elf_linux_sysvec
 ---snip---
Yes.

 
 Regardless of this mostly cosmetic issue, this is racy. Other
 linux thread in the same process might do an execve(3).
 More, if execve(3) call fails, then you return into the process
 that lacks all threads except the one that called execve(3).
 
 How critical is this in your opinion (relative to the issue this patch  
 is fixing)? Do you prefer a backout or do you think the probability  
 that the someone wins the race is low enough?
 
 Do you see a solution for the race?
I did not asked for backout, nor I am asking now.

Most likely, the semantic of linux thread groups cannot be implemented
by only using event handlers that linux.ko hooks now. How linux handles
single-threading when doing execve(2) from multithreaded process ?


pgp33400VCDnC.pgp
Description: PGP signature


Re: svn commit: r215664 - in head/sys: compat/linux kern

2010-11-22 Thread Gleb Kurtsou
On (22/11/2010 11:31), Kostik Belousov wrote:
 On Mon, Nov 22, 2010 at 09:07:00AM +, Alexander Leidinger wrote:
  Author: netchild
  Date: Mon Nov 22 09:06:59 2010
  New Revision: 215664
  URL: http://svn.freebsd.org/changeset/base/215664
  
  Log:
By using the 32-bit Linux version of Sun's Java Development Kit 1.6
on FreeBSD (amd64), invocations of javac (or java) eventually
end with the output of Killed and exit code 137.

This is caused by:
1. After calling exec() in multithreaded linux program threads are not
   destroyed and continue running. They get killed after program being
   executed finishes.

2. linux_exit_group doesn't return correct exit code when called not
   from group leader. Which happens regularly using sun jvm.

The submitters fix this in a similar way to how NetBSD handles this.

I took the PRs away from dchagin, who seems to be out of touch of
this since a while (no response from him).

The patches committed here are from [2], with some little modifications
from me to the style.

PR:   141439 [1], 144194 [2]
Submitted by: Stefan Schmidt stefan.schm...@stadtbuch.de, gk
Reviewed by:  rdivacky (in april 2010)
MFC after:5 days
  
  Modified:
head/sys/compat/linux/linux_emul.c
head/sys/compat/linux/linux_emul.h
head/sys/compat/linux/linux_misc.c
head/sys/kern/kern_exit.c
  
  Modified: head/sys/compat/linux/linux_emul.c
  ==
  --- head/sys/compat/linux/linux_emul.c  Mon Nov 22 09:04:29 2010
  (r215663)
  +++ head/sys/compat/linux/linux_emul.c  Mon Nov 22 09:06:59 2010
  (r215664)
  @@ -155,7 +155,7 @@ void
   linux_proc_exit(void *arg __unused, struct proc *p)
   {
  struct linux_emuldata *em;
  -   int error;
  +   int error, shared_flags, shared_xstat;
  struct thread *td = FIRST_THREAD_IN_PROC(p);
  int *child_clear_tid;
  struct proc *q, *nq;
  @@ -187,6 +187,8 @@ linux_proc_exit(void *arg __unused, stru
  }
   
  EMUL_SHARED_WLOCK(emul_shared_lock);
  +   shared_flags = em-shared-flags;
  +   shared_xstat = em-shared-xstat;
  LIST_REMOVE(em, threads);
   
  em-shared-refs--;
  @@ -196,6 +198,12 @@ linux_proc_exit(void *arg __unused, stru
  } else  
  EMUL_SHARED_WUNLOCK(emul_shared_lock);
   
  +   if ((shared_flags  EMUL_SHARED_HASXSTAT) != 0) {
  +   PROC_LOCK(p);
  +   p-p_xstat = shared_xstat;
  +   PROC_UNLOCK(p);
  +   }
 Why is process lock taken there ? The assignment to u_short inside the
 properly aligned structure is atomic on all supported architectures, and
 the thread that should see side-effect of assignment is the same thread
 that does assignment.
 
  +
  if (child_clear_tid != NULL) {
  struct linux_sys_futex_args cup;
  int null = 0;
  @@ -257,6 +265,9 @@ linux_proc_exec(void *arg __unused, stru
  if (__predict_false(imgp-sysent == elf_linux_sysvec
   p-p_sysent != elf_linux_sysvec))
  linux_proc_init(FIRST_THREAD_IN_PROC(p), p-p_pid, 0);
  +   if (__predict_false(p-p_sysent == elf_linux_sysvec))
  +   /* Kill threads regardless of imgp-sysent value */
  +   linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL);
 This is better expressed by
   if ((p-p_sysent-sv_flags  SV_ABI_MASK) == SV_ABI_LINUX)
 
 Regardless of this mostly cosmetic issue, this is racy. Other
 linux thread in the same process might do an execve(3).
 More, if execve(3) call fails, then you return into the process
 that lacks all threads except the one that called execve(3).

execve(3) races in linuxulator are known, and that's not the only case:
http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/142082

But fixing it is not easy, as you've noted in other email current hook
mechanism is not good enough for it.
___
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-unsubscr...@freebsd.org


svn commit: r215672 - head/sbin/geom/class/part

2010-11-22 Thread Andrey V. Elsukov
Author: ae
Date: Mon Nov 22 11:24:11 2010
New Revision: 215672
URL: http://svn.freebsd.org/changeset/base/215672

Log:
  Add SIGINT handler to `gpart restore` action.
  
  MFC after:1 week

Modified:
  head/sbin/geom/class/part/geom_part.c

Modified: head/sbin/geom/class/part/geom_part.c
==
--- head/sbin/geom/class/part/geom_part.c   Mon Nov 22 10:08:33 2010
(r215671)
+++ head/sbin/geom/class/part/geom_part.c   Mon Nov 22 11:24:11 2010
(r215672)
@@ -38,6 +38,7 @@ __FBSDID($FreeBSD$);
 #include libgeom.h
 #include libutil.h
 #include paths.h
+#include signal.h
 #include stdint.h
 #include stdio.h
 #include stdlib.h
@@ -61,6 +62,7 @@ uint32_t PUBSYM(version) = 0;
 
 static char sstart[32];
 static char ssize[32];
+volatile sig_atomic_t undo_restore;
 
 #defineGPART_AUTOFILL  *
 #defineGPART_FLAGS C
@@ -757,12 +759,19 @@ skip_line(const char *p)
 }
 
 static void
+gpart_sighndl(int sig __unused)
+{
+   undo_restore = 1;
+}
+
+static void
 gpart_restore(struct gctl_req *req, unsigned int fl __unused)
 {
struct gmesh mesh;
struct gclass *classp;
struct gctl_req *r;
struct ggeom *gp;
+   struct sigaction si_sa;
const char *s, *flags, *errstr, *label;
char **ap, *argv[6], line[BUFSIZ], *pline;
int error, forced, i, l, nargs, created, rl;
@@ -786,6 +795,13 @@ gpart_restore(struct gctl_req *req, unsi
geom_deletetree(mesh);
errx(EXIT_FAILURE, Class %s not found., s);
}
+
+   sigemptyset(si_sa.sa_mask);
+   si_sa.sa_flags = 0;
+   si_sa.sa_handler = gpart_sighndl;
+   if (sigaction(SIGINT, si_sa, 0) == -1)
+   err(EXIT_FAILURE, sigaction SIGINT);
+
if (forced) {
/* destroy existent partition table before restore */
for (i = 0; i  nargs; i++) {
@@ -811,7 +827,8 @@ gpart_restore(struct gctl_req *req, unsi
}
}
created = 0;
-   while (fgets(line, sizeof(line) - 1, stdin)) {
+   while (undo_restore == 0 
+   fgets(line, sizeof(line) - 1, stdin) != NULL) {
/* Format of backup entries:
 * scheme name number of entries
 * index type start size [label] ['['attrib[,attrib]']']
@@ -920,6 +937,8 @@ gpart_restore(struct gctl_req *req, unsi
}
}
}
+   if (undo_restore)
+   goto backout;
/* commit changes if needed */
if (strchr(flags, 'C') != NULL) {
for (i = 0; i  nargs; i++) {
___
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-unsubscr...@freebsd.org


svn commit: r215673 - head/sys/netgraph

2010-11-22 Thread Marko Zec
Author: zec
Date: Mon Nov 22 12:32:19 2010
New Revision: 215673
URL: http://svn.freebsd.org/changeset/base/215673

Log:
  Allow for MTU sizes of up to ETHER_MAX_LEN_JUMBO (i.e. 9018) bytes to be
  configured on ng_eiface ifnets.  The default MTU remains unchanged at
  1500 bytes.
  
  Mark ng_eiface ifnets as IFCAP_VLAN_MTU capable, so that the associated
  vlan(4) ifnets may use full-sized Ethernet MTUs (1500 bytes).
  
  MFC after:3 days

Modified:
  head/sys/netgraph/ng_eiface.c
  head/sys/netgraph/ng_eiface.h

Modified: head/sys/netgraph/ng_eiface.c
==
--- head/sys/netgraph/ng_eiface.c   Mon Nov 22 11:24:11 2010
(r215672)
+++ head/sys/netgraph/ng_eiface.c   Mon Nov 22 12:32:19 2010
(r215673)
@@ -371,6 +371,8 @@ ng_eiface_constructor(node_p node)
ifp-if_ioctl = ng_eiface_ioctl;
ifp-if_snd.ifq_maxlen = ifqmaxlen;
ifp-if_flags = (IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST);
+   ifp-if_capabilities = IFCAP_VLAN_MTU | IFCAP_JUMBO_MTU;
+   ifp-if_capenable = IFCAP_VLAN_MTU | IFCAP_JUMBO_MTU;
 
/* Give this node the same name as the interface (if possible) */
if (ng_name_node(node, ifp-if_xname) != 0)

Modified: head/sys/netgraph/ng_eiface.h
==
--- head/sys/netgraph/ng_eiface.h   Mon Nov 22 11:24:11 2010
(r215672)
+++ head/sys/netgraph/ng_eiface.h   Mon Nov 22 12:32:19 2010
(r215673)
@@ -46,7 +46,7 @@
 
 /* MTU bounds */
 #define NG_EIFACE_MTU_MIN  72
-#define NG_EIFACE_MTU_MAX  2312
+#define NG_EIFACE_MTU_MAX  ETHER_MAX_LEN_JUMBO
 #define NG_EIFACE_MTU_DEFAULT  1500
 
 /* Netgraph commands */
___
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-unsubscr...@freebsd.org


svn commit: r215674 - head/sbin/devd

2010-11-22 Thread Bruce Cran
Author: brucec
Date: Mon Nov 22 12:33:48 2010
New Revision: 215674
URL: http://svn.freebsd.org/changeset/base/215674

Log:
  Don't generate input() since it's not used.

Modified:
  head/sbin/devd/token.l

Modified: head/sbin/devd/token.l
==
--- head/sbin/devd/token.l  Mon Nov 22 12:32:19 2010(r215673)
+++ head/sbin/devd/token.l  Mon Nov 22 12:33:48 2010(r215674)
@@ -38,6 +38,7 @@
 
 int lineno = 1;
 #define YY_NO_UNPUT
+#define YY_NO_INPUT
 
 static void
 update_lineno(const char *cp)
___
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-unsubscr...@freebsd.org


svn commit: r215675 - head/sys/compat/linux

2010-11-22 Thread Alexander Leidinger
Author: netchild
Date: Mon Nov 22 12:42:32 2010
New Revision: 215675
URL: http://svn.freebsd.org/changeset/base/215675

Log:
  Do not take the process lock. The assignment to u_short inside the
  properly aligned structure is atomic on all supported architectures, and
  the thread that should see side-effect of assignment is the same thread
  that does assignment.
  
  Use a more appropriate conditional to detect the linux ABI.
  
  Suggested by: kib
  X-MFC:together with r215664

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

Modified: head/sys/compat/linux/linux_emul.c
==
--- head/sys/compat/linux/linux_emul.c  Mon Nov 22 12:33:48 2010
(r215674)
+++ head/sys/compat/linux/linux_emul.c  Mon Nov 22 12:42:32 2010
(r215675)
@@ -198,11 +198,8 @@ linux_proc_exit(void *arg __unused, stru
} else  
EMUL_SHARED_WUNLOCK(emul_shared_lock);
 
-   if ((shared_flags  EMUL_SHARED_HASXSTAT) != 0) {
-   PROC_LOCK(p);
+   if ((shared_flags  EMUL_SHARED_HASXSTAT) != 0)
p-p_xstat = shared_xstat;
-   PROC_UNLOCK(p);
-   }
 
if (child_clear_tid != NULL) {
struct linux_sys_futex_args cup;
@@ -265,7 +262,8 @@ linux_proc_exec(void *arg __unused, stru
if (__predict_false(imgp-sysent == elf_linux_sysvec
 p-p_sysent != elf_linux_sysvec))
linux_proc_init(FIRST_THREAD_IN_PROC(p), p-p_pid, 0);
-   if (__predict_false(p-p_sysent == elf_linux_sysvec))
+   if (__predict_false((p-p_sysent-sv_flags  SV_ABI_MASK) ==
+   SV_ABI_LINUX))
/* Kill threads regardless of imgp-sysent value */
linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL);
if (__predict_false(imgp-sysent != elf_linux_sysvec
___
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-unsubscr...@freebsd.org


Re: svn commit: r215675 - head/sys/compat/linux

2010-11-22 Thread Kostik Belousov
On Mon, Nov 22, 2010 at 12:42:32PM +, Alexander Leidinger wrote:
 Author: netchild
 Date: Mon Nov 22 12:42:32 2010
 New Revision: 215675
 URL: http://svn.freebsd.org/changeset/base/215675
 
 Log:
   Do not take the process lock. The assignment to u_short inside the
   properly aligned structure is atomic on all supported architectures, and
   the thread that should see side-effect of assignment is the same thread
   that does assignment.
   
   Use a more appropriate conditional to detect the linux ABI.
   
   Suggested by:   kib
   X-MFC:  together with r215664
 
 Modified:
   head/sys/compat/linux/linux_emul.c
 
 Modified: head/sys/compat/linux/linux_emul.c
 ==
 --- head/sys/compat/linux/linux_emul.cMon Nov 22 12:33:48 2010
 (r215674)
 +++ head/sys/compat/linux/linux_emul.cMon Nov 22 12:42:32 2010
 (r215675)
 @@ -265,7 +262,8 @@ linux_proc_exec(void *arg __unused, stru
   if (__predict_false(imgp-sysent == elf_linux_sysvec
p-p_sysent != elf_linux_sysvec))
   linux_proc_init(FIRST_THREAD_IN_PROC(p), p-p_pid, 0);
 - if (__predict_false(p-p_sysent == elf_linux_sysvec))
 + if (__predict_false((p-p_sysent-sv_flags  SV_ABI_MASK) ==
 + SV_ABI_LINUX))
   /* Kill threads regardless of imgp-sysent value */
   linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL);
   if (__predict_false(imgp-sysent != elf_linux_sysvec
There are several similar comparisons around the patched one.

I am still quite curious for the reason of all __predict() obfuscations
that are countless in the linuxolator. We are not oblidged to emulate
this aspect of Linux.


pgpIeifMMWQZN.pgp
Description: PGP signature


svn commit: r215676 - in head: sbin/hastd usr.bin/colldef usr.sbin/apmd usr.sbin/bluetooth/bthidd usr.sbin/bluetooth/hcsecd usr.sbin/config usr.sbin/kbdcontrol

2010-11-22 Thread Bruce Cran
Author: brucec
Date: Mon Nov 22 14:16:22 2010
New Revision: 215676
URL: http://svn.freebsd.org/changeset/base/215676

Log:
  Don't generate input() since it's not used.

Modified:
  head/sbin/hastd/Makefile
  head/usr.bin/colldef/Makefile
  head/usr.sbin/apmd/apmdlex.l
  head/usr.sbin/bluetooth/bthidd/lexer.l
  head/usr.sbin/bluetooth/hcsecd/lexer.l
  head/usr.sbin/config/lang.l
  head/usr.sbin/kbdcontrol/lex.l

Modified: head/sbin/hastd/Makefile
==
--- head/sbin/hastd/MakefileMon Nov 22 12:42:32 2010(r215675)
+++ head/sbin/hastd/MakefileMon Nov 22 14:16:22 2010(r215676)
@@ -25,6 +25,7 @@ CFLAGS+=-DINET6
 .endif
 # This is needed to have WARNS  1.
 CFLAGS+=-DYY_NO_UNPUT
+CFLAGS+=-DYY_NO_INPUT
 
 DPADD= ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF} ${LIBL} ${LIBPTHREAD} ${LIBUTIL}
 LDADD= -lgeom -lbsdxml -lsbuf -ll -lpthread -lutil

Modified: head/usr.bin/colldef/Makefile
==
--- head/usr.bin/colldef/Makefile   Mon Nov 22 12:42:32 2010
(r215675)
+++ head/usr.bin/colldef/Makefile   Mon Nov 22 14:16:22 2010
(r215676)
@@ -4,7 +4,7 @@ PROG=   colldef
 SRCS=  parse.y scan.l y.tab.h
 LFLAGS=-8 -i
 CFLAGS+=-I. -I${.CURDIR} -I${.CURDIR}/../../lib/libc/locale
-CFLAGS+=-DCOLLATE_DEBUG -DYY_NO_UNPUT
+CFLAGS+=-DCOLLATE_DEBUG -DYY_NO_UNPUT -DYY_NO_INPUT
 LDADD= -ll
 DPADD= ${LIBL}
 

Modified: head/usr.sbin/apmd/apmdlex.l
==
--- head/usr.sbin/apmd/apmdlex.lMon Nov 22 12:42:32 2010
(r215675)
+++ head/usr.sbin/apmd/apmdlex.lMon Nov 22 14:16:22 2010
(r215676)
@@ -38,6 +38,7 @@
 
 /* We don't need it, avoid the warning. */
 #define YY_NO_UNPUT
+#define YY_NO_INPUT
 
 int lineno;
 int first_time;

Modified: head/usr.sbin/bluetooth/bthidd/lexer.l
==
--- head/usr.sbin/bluetooth/bthidd/lexer.l  Mon Nov 22 12:42:32 2010
(r215675)
+++ head/usr.sbin/bluetooth/bthidd/lexer.l  Mon Nov 22 14:16:22 2010
(r215676)
@@ -39,7 +39,7 @@
int yylex   (void);
 %}
 
-%option yylineno noyywrap nounput
+%option yylineno noyywrap nounput noinput
 
 delim  [ \t\n]
 ws {delim}+

Modified: head/usr.sbin/bluetooth/hcsecd/lexer.l
==
--- head/usr.sbin/bluetooth/hcsecd/lexer.l  Mon Nov 22 12:42:32 2010
(r215675)
+++ head/usr.sbin/bluetooth/hcsecd/lexer.l  Mon Nov 22 14:16:22 2010
(r215676)
@@ -34,7 +34,7 @@
 #include parser.h
 %}
 
-%option yylineno noyywrap nounput
+%option yylineno noyywrap nounput noinput
 
 delim  [ \t\n]
 ws {delim}+

Modified: head/usr.sbin/config/lang.l
==
--- head/usr.sbin/config/lang.l Mon Nov 22 12:42:32 2010(r215675)
+++ head/usr.sbin/config/lang.l Mon Nov 22 14:16:22 2010(r215676)
@@ -39,6 +39,7 @@
 #include config.h
 
 #define YY_NO_UNPUT
+#define YY_NO_INPUT
 
 /*
  * Data for returning to previous files from include files.

Modified: head/usr.sbin/kbdcontrol/lex.l
==
--- head/usr.sbin/kbdcontrol/lex.l  Mon Nov 22 12:42:32 2010
(r215675)
+++ head/usr.sbin/kbdcontrol/lex.l  Mon Nov 22 14:16:22 2010
(r215676)
@@ -32,6 +32,7 @@
 
 #include lex.h
 #define YY_NO_UNPUT
+#define YY_NO_INPUT
 
 %}
 
___
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-unsubscr...@freebsd.org


svn commit: r215677 - head/sys/netinet

2010-11-22 Thread Marko Zec
Author: zec
Date: Mon Nov 22 14:16:23 2010
New Revision: 215677
URL: http://svn.freebsd.org/changeset/base/215677

Log:
  Remove an apparently redundant CURVNET_SET() / CURVNET_RESTORE() pair.
  
  MFC after:3 days

Modified:
  head/sys/netinet/if_ether.c

Modified: head/sys/netinet/if_ether.c
==
--- head/sys/netinet/if_ether.c Mon Nov 22 14:16:22 2010(r215676)
+++ head/sys/netinet/if_ether.c Mon Nov 22 14:16:23 2010(r215677)
@@ -154,12 +154,10 @@ arp_ifscrub(struct ifnet *ifp, uint32_t 
addr4.sin_len= sizeof(addr4);
addr4.sin_family = AF_INET;
addr4.sin_addr.s_addr = addr;
-   CURVNET_SET(ifp-if_vnet);
IF_AFDATA_LOCK(ifp);
lla_lookup(LLTABLE(ifp), (LLE_DELETE | LLE_IFADDR),
(struct sockaddr *)addr4);
IF_AFDATA_UNLOCK(ifp);
-   CURVNET_RESTORE();
 }
 #endif
 
___
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-unsubscr...@freebsd.org


svn commit: r215678 - head/usr.sbin/mptutil

2010-11-22 Thread John Baldwin
Author: jhb
Date: Mon Nov 22 14:36:04 2010
New Revision: 215678
URL: http://svn.freebsd.org/changeset/base/215678

Log:
  Similar to mfiutil, drop local definition of powerof2() and use version
  from sys/param.h instead.

Modified:
  head/usr.sbin/mptutil/mpt_config.c

Modified: head/usr.sbin/mptutil/mpt_config.c
==
--- head/usr.sbin/mptutil/mpt_config.c  Mon Nov 22 14:16:23 2010
(r215677)
+++ head/usr.sbin/mptutil/mpt_config.c  Mon Nov 22 14:36:04 2010
(r215678)
@@ -50,8 +50,6 @@ __RCSID($FreeBSD$);
 static voiddump_config(CONFIG_PAGE_RAID_VOL_0 *vol);
 #endif
 
-#define powerof2(x)x)-1)(x))==0)
-
 static long
 dehumanize(const char *value)
 {
___
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-unsubscr...@freebsd.org


svn commit: r215679 - in head: contrib/binutils/bfd contrib/binutils/binutils contrib/binutils/include/elf contrib/file contrib/gdb/gdb gnu/usr.bin/gdb/libgdb sys/compat/freebsd32 sys/kern sys/sys ...

2010-11-22 Thread Attilio Rao
Author: attilio
Date: Mon Nov 22 14:42:13 2010
New Revision: 215679
URL: http://svn.freebsd.org/changeset/base/215679

Log:
  Add the ability for GDB to printout the thread name along with other
  thread specific informations.
  
  In order to do that, and in order to avoid KBI breakage with existing
  infrastructure the following semantic is implemented:
  - For live programs, a new member to the PT_LWPINFO is added (pl_tdname)
  - For cores, a new ELF note is added (NT_THRMISC) that can be used for
storing thread specific, miscellaneous, informations. Right now it is
just popluated with a thread name.
  
  GDB, then, retrieves the correct informations from the corefile via the
  BFD interface, as it groks the ELF notes and create appropriate
  pseudo-sections.
  
  Sponsored by: Sandvine Incorporated
  Tested by:gianni
  Discussed with:   dim, kan, kib
  MFC after:2 weeks

Modified:
  head/contrib/binutils/bfd/elf-bfd.h
  head/contrib/binutils/bfd/elf.c
  head/contrib/binutils/binutils/readelf.c
  head/contrib/binutils/include/elf/common.h
  head/contrib/file/readelf.h
  head/contrib/gdb/gdb/fbsd-proc.c
  head/gnu/usr.bin/gdb/libgdb/fbsd-threads.c
  head/sys/compat/freebsd32/freebsd32.h
  head/sys/kern/imgact_elf.c
  head/sys/kern/sys_process.c
  head/sys/sys/elf_common.h
  head/sys/sys/procfs.h
  head/sys/sys/ptrace.h
  head/usr.bin/gcore/elfcore.c

Modified: head/contrib/binutils/bfd/elf-bfd.h
==
--- head/contrib/binutils/bfd/elf-bfd.h Mon Nov 22 14:36:04 2010
(r215678)
+++ head/contrib/binutils/bfd/elf-bfd.h Mon Nov 22 14:42:13 2010
(r215679)
@@ -1673,6 +1673,8 @@ extern char * elfcore_write_pstatus
   (bfd *, char *, int *, long, int, const void *);
 extern char *elfcore_write_prfpreg
   (bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_thrmisc
+  (bfd *, char *, int *, const char *, int);
 extern char *elfcore_write_prxfpreg
   (bfd *, char *, int *, const void *, int);
 extern char *elfcore_write_lwpstatus

Modified: head/contrib/binutils/bfd/elf.c
==
--- head/contrib/binutils/bfd/elf.c Mon Nov 22 14:36:04 2010
(r215678)
+++ head/contrib/binutils/bfd/elf.c Mon Nov 22 14:42:13 2010
(r215679)
@@ -6316,6 +6316,12 @@ _bfd_elf_rel_vtable_reloc_fn
 
 #ifdef HAVE_SYS_PROCFS_H
 # include sys/procfs.h
+
+/* Define HAVE_THRMISC_T for consistency with other similar GNU-type stubs. */
+#undef HAVE_THRMISC_T
+#if defined (THRMISC_VERSION)
+#defineHAVE_THRMISC_T  1
+#endif
 #endif
 
 /* FIXME: this is kinda wrong, but it's what gdb wants.  */
@@ -6497,6 +6503,16 @@ elfcore_grok_prxfpreg (bfd *abfd, Elf_In
   return elfcore_make_note_pseudosection (abfd, .reg-xfp, note);
 }
 
+#if defined (HAVE_THRMISC_T)
+
+static bfd_boolean
+elfcore_grok_thrmisc (bfd *abfd, Elf_Internal_Note *note)
+{
+  return elfcore_make_note_pseudosection (abfd, .tname, note);
+}
+
+#endif /* defined (HAVE_THRMISC_T) */
+
 #if defined (HAVE_PRPSINFO_T)
 typedef prpsinfo_t   elfcore_psinfo_t;
 #if defined (HAVE_PRPSINFO32_T)/* Sparc64 cross Sparc32 */
@@ -6863,6 +6879,12 @@ elfcore_grok_note (bfd *abfd, Elf_Intern
 
return TRUE;
   }
+
+#if defined (HAVE_THRMISC_T)
+case NT_THRMISC:
+  return elfcore_grok_thrmisc (abfd, note);
+#endif
+
 }
 }
 
@@ -7245,6 +7267,22 @@ elfcore_write_prfpreg (bfd *abfd,
 }
 
 char *
+elfcore_write_thrmisc (bfd *abfd,
+  char *buf,
+  int *bufsiz,
+  const char *tname,
+  int size)
+{
+#if defined (HAVE_THRMISC_T)
+  char *note_name = CORE;
+  return elfcore_write_note (abfd, buf, bufsiz,
+note_name, NT_THRMISC, tname, size);
+#else
+  return buf;
+#endif
+}
+
+char *
 elfcore_write_prxfpreg (bfd *abfd,
char *buf,
int *bufsiz,

Modified: head/contrib/binutils/binutils/readelf.c
==
--- head/contrib/binutils/binutils/readelf.cMon Nov 22 14:36:04 2010
(r215678)
+++ head/contrib/binutils/binutils/readelf.cMon Nov 22 14:42:13 2010
(r215679)
@@ -9908,6 +9908,7 @@ get_note_type (unsigned e_type)
 case NT_PSTATUS:   return _(NT_PSTATUS (pstatus structure));
 case NT_FPREGS:return _(NT_FPREGS (floating point registers));
 case NT_PSINFO:return _(NT_PSINFO (psinfo structure));
+case NT_THRMISC:   return _(NT_THRMISC (thrmisc structure));
 case NT_LWPSTATUS: return _(NT_LWPSTATUS (lwpstatus_t structure));
 case NT_LWPSINFO:  return _(NT_LWPSINFO (lwpsinfo_t structure));
 case NT_WIN32PSTATUS: return _(NT_WIN32PSTATUS (win32_pstatus 
structure));

Modified: head/contrib/binutils/include/elf/common.h

svn commit: r215680 - head/lib/libpam/modules/pam_unix

2010-11-22 Thread Dag-Erling Smorgrav
Author: des
Date: Mon Nov 22 14:45:16 2010
New Revision: 215680
URL: http://svn.freebsd.org/changeset/base/215680

Log:
  Add time.h for ctime(), which we accidentally picked up through
  sys/time.h.
  
  Submitted by: Garrett Cooper yaneg...@gmail.com
  MFC after:3 days

Modified:
  head/lib/libpam/modules/pam_unix/pam_unix.c

Modified: head/lib/libpam/modules/pam_unix/pam_unix.c
==
--- head/lib/libpam/modules/pam_unix/pam_unix.c Mon Nov 22 14:42:13 2010
(r215679)
+++ head/lib/libpam/modules/pam_unix/pam_unix.c Mon Nov 22 14:45:16 2010
(r215680)
@@ -50,6 +50,7 @@ __FBSDID($FreeBSD$);
 #include string.h
 #include stdio.h
 #include syslog.h
+#include time.h
 #include unistd.h
 
 #include libutil.h
___
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-unsubscr...@freebsd.org


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

2010-11-22 Thread John Baldwin
On Friday, November 19, 2010 5:41:00 pm Attilio Rao wrote:
 2010/11/19 John Baldwin j...@freebsd.org:
  On Friday, November 19, 2010 5:03:25 pm Jung-uk Kim wrote:
  On Friday 19 November 2010 04:46 pm, John Baldwin wrote:
   On Friday, November 19, 2010 4:31:44 pm Attilio Rao wrote:
2010/11/19 John Baldwin j...@freebsd.org:
 On Friday, November 19, 2010 4:09:28 pm Jung-uk Kim wrote:
 On Friday 19 November 2010 02:43 pm, Attilio Rao wrote:
  Author: attilio
  Date: Fri Nov 19 19:43:56 2010
  New Revision: 215544
  URL: http://svn.freebsd.org/changeset/base/215544
 
  Log:
Scan the list in reverse order for the shutdown handlers
  of loaded modules. This way, when there is a dependency
  between two modules, the handler of the latter probed runs
  first.
 
This is a similar approach as the modules are unloaded in
  the same linkerfile.
 
Sponsored by: Sandvine Incorporated
Submitted by: Nima Misaghian nmisaghian at sandvine
  dot com MFC after:1 week

 Hmm...  It is not directly related but I was thinking about
 doing similar things for sys/kern/subr_bus.c.  What do you
 think about the attached patch?

 Hmm, the patches for suspend and resume that I had for this
 took the opposite order, they did suspend in forward order, but
 resume in backwards order. Like so:

 --- //depot/vendor/freebsd/src/sys/kern/subr_bus.c
 2010-11-17 22:30:24.0  +++
 //depot/user/jhb/acpipci/kern/subr_bus.c2010-11-19
 17:19:02.0 00 @@ -3426,9 +3429,9 @@
TAILQ_FOREACH(child, dev-children, link) {
error = DEVICE_SUSPEND(child);
if (error) {
 -   for (child2 =
 TAILQ_FIRST(dev-children); -
 child2  child2 != child; -child2
 = TAILQ_NEXT(child2, link)) +   for (child2
 = TAILQ_PREV(child, device_list, link); +
  child2 != NULL;
 +child2 = TAILQ_PREV(child2,
 device_list, link)) DEVICE_RESUME(child2);
return (error);
}
 @@ -3447,7 +3450,7 @@
  {
device_tchild;

 -   TAILQ_FOREACH(child, dev-children, link) {
 +   TAILQ_FOREACH_REVERSE(child, dev-children,
 device_list, link) { DEVICE_RESUME(child);
/* if resume fails, there's nothing we can
 usefully do... */ }

 (Likely mangled whitespace.)

 I couldn't convince myself which order was more correct for
 suspend and resume.
   
Considering loading in starting point, I think suspend should go
in reverse logic and resume in the same module load logic.
So that dependent modules are suspended first and resumed after.
Don't you agree?
  
   These are devices, and the ordering here is the order of sibling
   devices on a given bus.  That is, if you have a PCI bus with two em
   interfaces, does it really matter if em0 suspends before em1 vs
   after em1?  I think it actually doesn't matter.  The passes from
   the multipass boot probe might make some sense to order on.
   However, I don't think the order of siblings on a bus is meaningful
   for suspend and resume (which is why I've never committed the above
   patches).
  
   Specifically, there is no dependency relationship between siblings
   on a bus. Certain buses may in fact have a dependency order of
   sorts (vgapci0 comes to mind), but those buses should manage that.
   There is no generic dependency between siblings that should be
   encoded into subr_bus.c
 
  Generally siblings don't interact with each other directly, no.
  However, some modern chipsets *do* have strong relationship.  For
  example, some chipsets reference SMB controller to get current
  configuration, e.g., function A depends on function B on the same
  chip.
 
  That may be true, but that is not generic to all buses and devices.
  That isn't even really generic to PCI.  If there are specific instances
  where there are dependencies, the drivers for that hardware should
  manage that.  If specific buses have specific orders, then they can
  manage that order explicitly in their own suspend and resume routines.
  However, I don't see a valid reason for enforcing a particular order
  among siblings for all devices.  We certainly do enforce some orders
  with respect to children and parents (parents attach first and resume
  first, children detach first and suspend first, PCI even mandates this
  for powering down a bus), but the same is not true for siblings.
 
 However, it would be good if any ordering is maintained between
 devices linked via MODDEPEND stuff.
 It happens they may also be sibillings, and not havign parent-child
 relationship in some cases, but I'm also wondering if maybe they
 should ensure consistency in their code itself 

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

2010-11-22 Thread John Baldwin
On Friday, November 19, 2010 5:32:00 pm Attilio Rao wrote:
 2010/11/19 John Baldwin j...@freebsd.org:
  On Friday, November 19, 2010 4:27:27 pm Attilio Rao wrote:
  2010/11/19 John Baldwin j...@freebsd.org:
   On Friday, November 19, 2010 2:43:57 pm Attilio Rao wrote:
   Author: attilio
   Date: Fri Nov 19 19:43:56 2010
   New Revision: 215544
   URL: http://svn.freebsd.org/changeset/base/215544
  
   Log:
 Scan the list in reverse order for the shutdown handlers of loaded 
   modules.
 This way, when there is a dependency between two modules, the handler 
   of the
 latter probed runs first.
  
 This is a similar approach as the modules are unloaded in the same
 linkerfile.
  
 Sponsored by:   Sandvine Incorporated
 Submitted by:   Nima Misaghian nmisaghian at sandvine dot com
 MFC after:  1 week
  
   Modified:
 head/sys/kern/kern_module.c
  
   Modified: head/sys/kern/kern_module.c
   ==
   --- head/sys/kern/kern_module.c   Fri Nov 19 18:59:35 2010
   (r215543)
   +++ head/sys/kern/kern_module.c   Fri Nov 19 19:43:56 2010
   (r215544)
   @@ -46,7 +46,7 @@ __FBSDID($FreeBSD$);
  
static MALLOC_DEFINE(M_MODULE, module, module data structures);
  
   -typedef TAILQ_HEAD(, module) modulelist_t;
   +typedef TAILQ_HEAD(modulelst, module) modulelist_t;
  
   Is modulelist already taken?  If not, we should probably just retire
   'modulelist_t' and replace it with 'struct modulelist'.
 
  Note that I used modulelst, not modulelist.
  Probabilly, if you think the name may be still confusing, we can
  pickup one another further.
 
  Yes, I'd much prefer 'modulelist' with the extra 'i' as it is more readable.
  If you go that route, I think you can drop modulelist_t since style(9)
  discourages foo_t types unless they are required by a standard.
 
 I think that this patch should make it?

Works for me, thanks.

-- 
John Baldwin
___
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-unsubscr...@freebsd.org


svn commit: r215681 - in head/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/x86emu dev/xen/xenpci

2010-11-22 Thread John Baldwin
Author: jhb
Date: Mon Nov 22 15:15:11 2010
New Revision: 215681
URL: http://svn.freebsd.org/changeset/base/215681

Log:
  Remove some bogus, self-referential mergeinfo.

Modified:
Directory Properties:
  head/sys/   (props changed)
  head/sys/amd64/include/xen/   (props changed)
  head/sys/cddl/contrib/opensolaris/   (props changed)
  head/sys/contrib/x86emu/   (props changed)
  head/sys/dev/xen/xenpci/   (props changed)
___
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-unsubscr...@freebsd.org


svn commit: r215682 - head/sys/dev/xen/xenpci

2010-11-22 Thread John Baldwin
Author: jhb
Date: Mon Nov 22 15:26:47 2010
New Revision: 215682
URL: http://svn.freebsd.org/changeset/base/215682

Log:
  Purge mergeinfo on sys/dev/xen/xenpci.  The only unique mergeinfo compared
  to head was not useful (it came in with the merge from /user/dfr/xenhvm/7
  and that mergeinfo is still present at sys/) and not worth keeping an extra
  set of mergeinfo around in the kernel.

Modified:
Directory Properties:
  head/sys/dev/xen/xenpci/   (props changed)
___
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-unsubscr...@freebsd.org


svn commit: r215683 - head/sys/kern

2010-11-22 Thread Attilio Rao
Author: attilio
Date: Mon Nov 22 15:28:54 2010
New Revision: 215683
URL: http://svn.freebsd.org/changeset/base/215683

Log:
  Style fix.
  
  Sponsored by: Sandvine Incorporated
  Requested by: jhb
  Reviewed by:  jhb
  MFC after:1 week
  X-MFC:215544

Modified:
  head/sys/kern/kern_module.c

Modified: head/sys/kern/kern_module.c
==
--- head/sys/kern/kern_module.c Mon Nov 22 15:26:47 2010(r215682)
+++ head/sys/kern/kern_module.c Mon Nov 22 15:28:54 2010(r215683)
@@ -46,7 +46,6 @@ __FBSDID($FreeBSD$);
 
 static MALLOC_DEFINE(M_MODULE, module, module data structures);
 
-typedef TAILQ_HEAD(modulelst, module) modulelist_t;
 struct module {
TAILQ_ENTRY(module) link;   /* chain together all modules */
TAILQ_ENTRY(module) flink;  /* all modules in a file */
@@ -61,7 +60,7 @@ struct module {
 
 #define MOD_EVENT(mod, type)   (mod)-handler((mod), (type), (mod)-arg)
 
-static modulelist_t modules;
+static TAILQ_HEAD(modulelist, module) modules;
 struct sx modules_sx;
 static int nextid = 1;
 static void module_shutdown(void *, int);
@@ -101,7 +100,7 @@ module_shutdown(void *arg1, int arg2)
return;
mtx_lock(Giant);
MOD_SLOCK;
-   TAILQ_FOREACH_REVERSE(mod, modules, modulelst, link)
+   TAILQ_FOREACH_REVERSE(mod, modules, modulelist, link)
MOD_EVENT(mod, MOD_SHUTDOWN);
MOD_SUNLOCK;
mtx_unlock(Giant);
___
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-unsubscr...@freebsd.org


Re: svn commit: r215675 - head/sys/compat/linux

2010-11-22 Thread John Baldwin
On Monday, November 22, 2010 7:51:06 am Kostik Belousov wrote:
 On Mon, Nov 22, 2010 at 12:42:32PM +, Alexander Leidinger wrote:
  Author: netchild
  Date: Mon Nov 22 12:42:32 2010
  New Revision: 215675
  URL: http://svn.freebsd.org/changeset/base/215675
  
  Log:
Do not take the process lock. The assignment to u_short inside the
properly aligned structure is atomic on all supported architectures, and
the thread that should see side-effect of assignment is the same thread
that does assignment.

Use a more appropriate conditional to detect the linux ABI.

Suggested by: kib
X-MFC:together with r215664
  
  Modified:
head/sys/compat/linux/linux_emul.c
  
  Modified: head/sys/compat/linux/linux_emul.c
  ==
  --- head/sys/compat/linux/linux_emul.c  Mon Nov 22 12:33:48 2010
  (r215674)
  +++ head/sys/compat/linux/linux_emul.c  Mon Nov 22 12:42:32 2010
  (r215675)
  @@ -265,7 +262,8 @@ linux_proc_exec(void *arg __unused, stru
  if (__predict_false(imgp-sysent == elf_linux_sysvec
   p-p_sysent != elf_linux_sysvec))
  linux_proc_init(FIRST_THREAD_IN_PROC(p), p-p_pid, 0);
  -   if (__predict_false(p-p_sysent == elf_linux_sysvec))
  +   if (__predict_false((p-p_sysent-sv_flags  SV_ABI_MASK) ==
  +   SV_ABI_LINUX))
  /* Kill threads regardless of imgp-sysent value */
  linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL);
  if (__predict_false(imgp-sysent != elf_linux_sysvec
 There are several similar comparisons around the patched one.
 
 I am still quite curious for the reason of all __predict() obfuscations
 that are countless in the linuxolator. We are not oblidged to emulate
 this aspect of Linux.

I think we should only have __predict() obfuscation if there is a benchmark
showing an indisputable performance gain.  Otherwise it is just cruft making
the code hard to read.  I suspect that a Linux app calling execve() is not a
sufficient critical path to warrant any of these.

-- 
John Baldwin
___
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-unsubscr...@freebsd.org


svn commit: r215684 - stable/8/sys/conf

2010-11-22 Thread Ken Smith
Author: kensmith
Date: Mon Nov 22 16:09:57 2010
New Revision: 215684
URL: http://svn.freebsd.org/changeset/base/215684

Log:
  We're a bit under a week from Code Freeze for the upcoming 8.2-RELEASE
  cycle.  Warn people tracking stable/8 that the branch may be more
  active than usual.

Modified:
  stable/8/sys/conf/newvers.sh

Modified: stable/8/sys/conf/newvers.sh
==
--- stable/8/sys/conf/newvers.shMon Nov 22 15:28:54 2010
(r215683)
+++ stable/8/sys/conf/newvers.shMon Nov 22 16:09:57 2010
(r215684)
@@ -31,8 +31,8 @@
 # $FreeBSD$
 
 TYPE=FreeBSD
-REVISION=8.1
-BRANCH=STABLE
+REVISION=8.2
+BRANCH=PRERELEASE
 if [ X${BRANCH_OVERRIDE} != X ]; then
BRANCH=${BRANCH_OVERRIDE}
 fi
___
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-unsubscr...@freebsd.org


svn commit: r215685 - stable/7/sys/conf

2010-11-22 Thread Ken Smith
Author: kensmith
Date: Mon Nov 22 16:10:54 2010
New Revision: 215685
URL: http://svn.freebsd.org/changeset/base/215685

Log:
  We're a bit under a week from Code Freeze for the upcoming 7.4-RELEASE
  cycle.  Warn people tracking stable/7 that the branch may be more
  active than usual.

Modified:
  stable/7/sys/conf/newvers.sh

Modified: stable/7/sys/conf/newvers.sh
==
--- stable/7/sys/conf/newvers.shMon Nov 22 16:09:57 2010
(r215684)
+++ stable/7/sys/conf/newvers.shMon Nov 22 16:10:54 2010
(r215685)
@@ -31,8 +31,8 @@
 # $FreeBSD$
 
 TYPE=FreeBSD
-REVISION=7.3
-BRANCH=STABLE
+REVISION=7.4
+BRANCH=PRERELEASE
 if [ X${BRANCH_OVERRIDE} != X ]; then
BRANCH=${BRANCH_OVERRIDE}
 fi
___
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-unsubscr...@freebsd.org


svn commit: r215686 - head/sys/dev/mxge

2010-11-22 Thread Andrew Gallatin
Author: gallatin
Date: Mon Nov 22 16:43:05 2010
New Revision: 215686
URL: http://svn.freebsd.org/changeset/base/215686

Log:
  Fix a TSO checksum bug on mxge(4):
  
  The Myri10GE NIC will assume all TSO frames contain partial checksum,
  and will emit TSO segments with bad TCP checksums if a TSO frame
  contains a full checksum.  The mxge driver takes care to make sure
  that TSO is disabled when checksum offload is disabled for this
  reason.  However, modules that modify packet contents (like pf) may
  end up completing a checksum on a TSO frame, leading to the NIC emitting
  TSO segments with bad checksums.
  
  To workaround this, restore the partial checksum in the mxge driver
  when we're fed a TSO frame with a full checksum.
  
  Reported by: Bob Healey
  
  MFC after:3 days

Modified:
  head/sys/dev/mxge/if_mxge.c

Modified: head/sys/dev/mxge/if_mxge.c
==
--- head/sys/dev/mxge/if_mxge.c Mon Nov 22 16:10:54 2010(r215685)
+++ head/sys/dev/mxge/if_mxge.c Mon Nov 22 16:43:05 2010(r215686)
@@ -1855,9 +1855,20 @@ mxge_encap_tso(struct mxge_slice_state *
 
tcp = (struct tcphdr *)((char *)ip + (ip-ip_hl  2));
cum_len = -(ip_off + ((ip-ip_hl + tcp-th_off)  2));
+   cksum_offset = ip_off + (ip-ip_hl  2);
 
/* TSO implies checksum offload on this hardware */
-   cksum_offset = ip_off + (ip-ip_hl  2);
+   if (__predict_false((m-m_pkthdr.csum_flags  (CSUM_TCP)) == 0)) {
+   /*
+* If packet has full TCP csum, replace it with pseudo hdr
+* sum that the NIC expects, otherwise the NIC will emit
+* packets with bad TCP checksums.
+*/
+   m-m_pkthdr.csum_flags = CSUM_TCP;
+   m-m_pkthdr.csum_data = offsetof(struct tcphdr, th_sum);
+   tcp-th_sum = in_pseudo(ip-ip_src.s_addr, ip-ip_dst.s_addr,
+   htons(IPPROTO_TCP + (m-m_pkthdr.len - cksum_offset))); 

+   }
flags = MXGEFW_FLAGS_TSO_HDR | MXGEFW_FLAGS_FIRST;
 

___
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-unsubscr...@freebsd.org


svn commit: r215687 - head/sys/geom

2010-11-22 Thread Jaakko Heinonen
Author: jh
Date: Mon Nov 22 16:47:53 2010
New Revision: 215687
URL: http://svn.freebsd.org/changeset/base/215687

Log:
  Use g_eventlock to protect against losing wakeups in the g_event process
  and replace tsleep(9) with msleep(9) which doesn't use a timeout. The
  previously used timeout caused the event process to wake up ten times
  per second on an idle system.
  
  one_event() is now called with the topology lock held and it returns
  with both the topology and event locks held when there are no more
  events in the queue.
  
  Reported by:  mav, Marius Nünnerich
  Reviewed by:  freebsd-geom

Modified:
  head/sys/geom/geom_event.c
  head/sys/geom/geom_kern.c

Modified: head/sys/geom/geom_event.c
==
--- head/sys/geom/geom_event.c  Mon Nov 22 16:43:05 2010(r215686)
+++ head/sys/geom/geom_event.c  Mon Nov 22 16:47:53 2010(r215687)
@@ -183,33 +183,27 @@ one_event(void)
struct g_event *ep;
struct g_provider *pp;
 
-   g_topology_lock();
-   for (;;) {
-   mtx_lock(g_eventlock);
-   TAILQ_FOREACH(pp, g_doorstep, orphan) {
-   if (pp-nstart == pp-nend)
-   break;
-   }
-   if (pp != NULL) {
-   G_VALID_PROVIDER(pp);
-   TAILQ_REMOVE(g_doorstep, pp, orphan);
-   }
-   mtx_unlock(g_eventlock);
-   if (pp == NULL)
+   g_topology_assert();
+   mtx_lock(g_eventlock);
+   TAILQ_FOREACH(pp, g_doorstep, orphan) {
+   if (pp-nstart == pp-nend)
break;
+   }
+   if (pp != NULL) {
+   G_VALID_PROVIDER(pp);
+   TAILQ_REMOVE(g_doorstep, pp, orphan);
+   mtx_unlock(g_eventlock);
g_orphan_register(pp);
+   return (1);
}
-   mtx_lock(g_eventlock);
+
ep = TAILQ_FIRST(g_events);
if (ep == NULL) {
wakeup(g_pending_events);
-   mtx_unlock(g_eventlock);
-   g_topology_unlock();
return (0);
}
if (ep-flag  EV_INPROGRESS) {
mtx_unlock(g_eventlock);
-   g_topology_unlock();
return (1);
}
ep-flag |= EV_INPROGRESS;
@@ -228,7 +222,6 @@ one_event(void)
mtx_unlock(g_eventlock);
g_free(ep);
}
-   g_topology_unlock();
return (1);
 }
 
@@ -237,16 +230,27 @@ g_run_events()
 {
int i;
 
-   while (one_event())
-   ;
-   g_topology_lock();
-   i = g_wither_work;
-   while (i) {
-   i = g_wither_washer();
-   g_wither_work = i  1;
-   i = 2;
+   for (;;) {
+   g_topology_lock();
+   while (one_event())
+   ;
+   mtx_assert(g_eventlock, MA_OWNED);
+   i = g_wither_work;
+   if (i) {
+   mtx_unlock(g_eventlock);
+   while (i) {
+   i = g_wither_washer();
+   g_wither_work = i  1;
+   i = 2;
+   }
+   g_topology_unlock();
+   } else {
+   g_topology_unlock();
+   msleep(g_wait_event, g_eventlock, PRIBIO | PDROP,
+   -, 0);
+   }
}
-   g_topology_unlock();
+   /* NOTREACHED */
 }
 
 void
@@ -338,9 +342,12 @@ g_post_event(g_event_t *func, void *arg,
 }
 
 void
-g_do_wither() {
+g_do_wither()
+{
 
+   mtx_lock(g_eventlock);
g_wither_work = 1;
+   mtx_unlock(g_eventlock);
wakeup(g_wait_event);
 }
 

Modified: head/sys/geom/geom_kern.c
==
--- head/sys/geom/geom_kern.c   Mon Nov 22 16:43:05 2010(r215686)
+++ head/sys/geom/geom_kern.c   Mon Nov 22 16:47:53 2010(r215687)
@@ -137,10 +137,8 @@ g_event_procbody(void)
thread_lock(tp);
sched_prio(tp, PRIBIO);
thread_unlock(tp);
-   for(;;) {
-   g_run_events();
-   tsleep(g_wait_event, PRIBIO, -, hz/10);
-   }
+   g_run_events();
+   /* NOTREACHED */
 }
 
 static struct kproc_desc g_event_kp = {
___
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-unsubscr...@freebsd.org


svn commit: r215688 - stable/8/sys/kern

2010-11-22 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Mon Nov 22 16:58:07 2010
New Revision: 215688
URL: http://svn.freebsd.org/changeset/base/215688

Log:
  MFC r213986:
  Fix an XXX comment by answering 'no'. OS X does not set the day-of-week
  counter on SMU-based systems, which causes FreeBSD to reject the RTC time
  when used in a dual-boot environment. Since we don't use the day-of-week
  counter anyway, solve this by just not checking that it matches.

Modified:
  stable/8/sys/kern/subr_clock.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/kern/subr_clock.c
==
--- stable/8/sys/kern/subr_clock.c  Mon Nov 22 16:47:53 2010
(r215687)
+++ stable/8/sys/kern/subr_clock.c  Mon Nov 22 16:58:07 2010
(r215688)
@@ -165,10 +165,6 @@ clock_ct_to_ts(struct clocktime *ct, str
days += days_in_month(year, i);
days += (ct-day - 1);
 
-   /* XXX Dow sanity check. Dow is not used, so should we check it? */
-   if (ct-dow != -1  ct-dow != day_of_week(days))
-   return (EINVAL);
-
/* Add hours, minutes, seconds. */
secs = ((days * 24 + ct-hour) * 60 + ct-min) * 60 + ct-sec;
 
___
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-unsubscr...@freebsd.org


svn commit: r215689 - stable/8/sys/powerpc/aim

2010-11-22 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Mon Nov 22 17:01:40 2010
New Revision: 215689
URL: http://svn.freebsd.org/changeset/base/215689

Log:
  MFC r214610:
  Map userland copyin/copyout segment no-execute while it is mapped into the
  kernel.

Modified:
  stable/8/sys/powerpc/aim/copyinout.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/powerpc/aim/copyinout.c
==
--- stable/8/sys/powerpc/aim/copyinout.cMon Nov 22 16:58:07 2010
(r215688)
+++ stable/8/sys/powerpc/aim/copyinout.cMon Nov 22 17:01:40 2010
(r215689)
@@ -76,6 +76,9 @@ static __inline void
 set_user_sr(register_t vsid)
 {
 
+   /* Mark segment no-execute */
+   vsid |= SR_N;
+
isync();
__asm __volatile (mtsr %0,%1 :: n(USER_SR), r(vsid));
isync();
___
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-unsubscr...@freebsd.org


svn commit: r215690 - stable/8/sys/powerpc/powermac

2010-11-22 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Mon Nov 22 17:03:09 2010
New Revision: 215690
URL: http://svn.freebsd.org/changeset/base/215690

Log:
  MFC r214575:
  Allow access to the HT I/O port space on the IBM CPC9X5 northbridge chips.

Modified:
  stable/8/sys/powerpc/powermac/cpcht.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/powerpc/powermac/cpcht.c
==
--- stable/8/sys/powerpc/powermac/cpcht.c   Mon Nov 22 17:01:40 2010
(r215689)
+++ stable/8/sys/powerpc/powermac/cpcht.c   Mon Nov 22 17:03:09 2010
(r215690)
@@ -142,6 +142,7 @@ struct cpcht_softc {
vm_offset_t sc_data;
uint64_tsc_populated_slots;
struct  rman sc_mem_rman;
+   struct  rman sc_io_rman;
 
struct cpcht_irqhtirq_map[128];
 };
@@ -156,6 +157,9 @@ static devclass_t   cpcht_devclass;
 
 DRIVER_MODULE(cpcht, nexus, cpcht_driver, cpcht_devclass, 0, 0);
 
+#define CPCHT_IOPORT_BASE  0xf400UL /* Hardwired */
+#define CPCHT_IOPORT_SIZE  0x0040UL
+
 #define HTAPIC_REQUEST_EOI 0x20
 #define HTAPIC_TRIGGER_LEVEL   0x02
 #define HTAPIC_MASK0x01
@@ -215,7 +219,14 @@ cpcht_attach(device_t dev)
sc-sc_mem_rman.rm_type = RMAN_ARRAY;
sc-sc_mem_rman.rm_descr = CPCHT Device Memory;
error = rman_init(sc-sc_mem_rman);
+   if (error) {
+   device_printf(dev, rman_init() failed. error = %d\n, error);
+   return (error);
+   }
 
+   sc-sc_io_rman.rm_type = RMAN_ARRAY;
+   sc-sc_io_rman.rm_descr = CPCHT I/O Memory;
+   error = rman_init(sc-sc_io_rman);
if (error) {
device_printf(dev, rman_init() failed. error = %d\n, error);
return (error);
@@ -227,6 +238,9 @@ cpcht_attach(device_t dev)
 * where we get the HT interrupts properties.
 */
 
+   /* I/O port mappings are usually not in the device tree */
+   rman_manage_region(sc-sc_io_rman, 0, CPCHT_IOPORT_SIZE - 1);
+
bzero(sc-htirq_map, sizeof(sc-htirq_map));
for (child = OF_child(node); child != 0; child = OF_peer(child))
cpcht_configure_htbridge(dev, child);
@@ -275,6 +289,9 @@ cpcht_configure_htbridge(device_t dev, p
case OFW_PCI_PHYS_HI_SPACE_CONFIG:
break;
case OFW_PCI_PHYS_HI_SPACE_IO:
+   rman_manage_region(sc-sc_io_rman, rp-pci_lo,
+   rp-pci_lo + rp-size_lo - 1);
+   break;
case OFW_PCI_PHYS_HI_SPACE_MEM32:
rman_manage_region(sc-sc_mem_rman, rp-pci_lo,
rp-pci_lo + rp-size_lo - 1);
@@ -482,8 +499,9 @@ cpcht_alloc_resource(device_t bus, devic
switch (type) {
case SYS_RES_IOPORT:
end = min(end, start + count);
+   rm = sc-sc_io_rman;
+   break;
 
-   /* FALLTHROUGH */
case SYS_RES_MEMORY:
rm = sc-sc_mem_rman;
break;
@@ -537,6 +555,9 @@ cpcht_activate_resource(device_t bus, de
 
start = (vm_offset_t)rman_get_start(res);
 
+   if (type == SYS_RES_IOPORT)
+   start += CPCHT_IOPORT_BASE;
+
if (bootverbose)
printf(cpcht mapdev: start %zx, len %ld\n, start,
rman_get_size(res));
___
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-unsubscr...@freebsd.org


svn commit: r215691 - stable/8/sys/powerpc/powerpc

2010-11-22 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Mon Nov 22 17:06:24 2010
New Revision: 215691
URL: http://svn.freebsd.org/changeset/base/215691

Log:
  MFC r204127,215101:
  Provide support for the DEEPNAP power-saving mode found on the 970MP.

Modified:
  stable/8/sys/powerpc/powerpc/cpu.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/powerpc/powerpc/cpu.c
==
--- stable/8/sys/powerpc/powerpc/cpu.c  Mon Nov 22 17:03:09 2010
(r215690)
+++ stable/8/sys/powerpc/powerpc/cpu.c  Mon Nov 22 17:06:24 2010
(r215691)
@@ -453,8 +453,16 @@ cpu_970_setup(int cpuid, uint16_t vers)
: =r (hid0_hi), =r (hid0_lo) : K (SPR_HID0));
 
/* Configure power-saving mode */
-   hid0_hi |= (HID0_NAP | HID0_DPM);
-   hid0_hi = ~(HID0_DOZE | HID0_DEEPNAP);
+   switch (vers) {
+   case IBM970MP:
+   hid0_hi |= (HID0_DEEPNAP | HID0_NAP | HID0_DPM);
+   hid0_hi = ~HID0_DOZE;
+   break;
+   default:
+   hid0_hi |= (HID0_NAP | HID0_DPM);
+   hid0_hi = ~(HID0_DOZE | HID0_DEEPNAP);
+   break;
+   }
powerpc_pow_enabled = 1;
 
__asm __volatile ( \
___
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-unsubscr...@freebsd.org


svn commit: r215692 - stable/8/sys/powerpc/powermac

2010-11-22 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Mon Nov 22 17:09:42 2010
New Revision: 215692
URL: http://svn.freebsd.org/changeset/base/215692

Log:
  MFC r215100:
  Disabling CPU NAP modes during SMU commands is a hack needed only on U3
  systems. Don't use it on non-U3 systems to allow cpu_idle() to work
  correctly.

Modified:
  stable/8/sys/powerpc/powermac/smu.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/powerpc/powermac/smu.c
==
--- stable/8/sys/powerpc/powermac/smu.c Mon Nov 22 17:06:24 2010
(r215691)
+++ stable/8/sys/powerpc/powermac/smu.c Mon Nov 22 17:09:42 2010
(r215692)
@@ -89,6 +89,7 @@ struct smu_softc {
 
struct resource *sc_memr;
int sc_memrid;
+   int sc_u3;
 
bus_dma_tag_t   sc_dmatag;
bus_space_tag_t sc_bt;
@@ -243,6 +244,10 @@ smu_attach(device_t dev)
sc-sc_cur_cmd = NULL;
sc-sc_doorbellirqid = -1;
 
+   sc-sc_u3 = 0;
+   if (OF_finddevice(/u3) != -1)
+   sc-sc_u3 = 1;
+
/*
 * Map the mailbox area. This should be determined from firmware,
 * but I have not found a simple way to do that.
@@ -361,7 +366,9 @@ smu_send_cmd(device_t dev, struct smu_cm
 
mtx_assert(sc-sc_mtx, MA_OWNED);
 
-   powerpc_pow_enabled = 0;/* SMU cannot work if we go to NAP */
+   if (sc-sc_u3)
+   powerpc_pow_enabled = 0; /* SMU cannot work if we go to NAP */
+
sc-sc_cur_cmd = cmd;
 
/* Copy the command to the mailbox */
@@ -408,7 +415,8 @@ smu_doorbell_intr(void *xdev)
sizeof(sc-sc_cmd-data));
wakeup(sc-sc_cur_cmd);
sc-sc_cur_cmd = NULL;
-   powerpc_pow_enabled = 1;
+   if (sc-sc_u3)
+   powerpc_pow_enabled = 1;
 
 done:
/* Queue next command if one is pending */
___
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-unsubscr...@freebsd.org


svn commit: r215693 - in stable/8/sys/powerpc: aim powermac

2010-11-22 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Mon Nov 22 17:13:04 2010
New Revision: 215693
URL: http://svn.freebsd.org/changeset/base/215693

Log:
  MFC r205506:
  Get nexus(4) out of the RTC business. The interface used by nexus(4)
  in Open Firmware was Apple-specific, and we have complete coverage of Apple
  system controllers, so move RTC responsibilities into the system controller
  drivers. This avoids interesting problems from manipulating these devices
  through Open Firmware behind the backs of their drivers.
  
  Obtained from:NetBSD

Modified:
  stable/8/sys/powerpc/aim/nexus.c
  stable/8/sys/powerpc/powermac/cuda.c
  stable/8/sys/powerpc/powermac/cudavar.h
  stable/8/sys/powerpc/powermac/pmu.c
  stable/8/sys/powerpc/powermac/smu.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/powerpc/aim/nexus.c
==
--- stable/8/sys/powerpc/aim/nexus.cMon Nov 22 17:09:42 2010
(r215692)
+++ stable/8/sys/powerpc/aim/nexus.cMon Nov 22 17:13:04 2010
(r215693)
@@ -60,7 +60,6 @@
 #include sys/systm.h
 #include sys/module.h
 #include sys/bus.h
-#include sys/clock.h
 #include sys/cons.h
 #include sys/kernel.h
 #include sys/malloc.h
@@ -74,7 +73,6 @@
 
 #include sys/rman.h
 
-#include clock_if.h
 #include ofw_bus_if.h
 #include pic_if.h
 
@@ -143,12 +141,6 @@ static const char  *nexus_ofw_get_type(de
 static const char  *nexus_ofw_get_compat(device_t, device_t);
 
 /*
- * Clock interface.
- */
-static int nexus_gettime(device_t, struct timespec *);
-static int nexus_settime(device_t, struct timespec *);
-
-/*
  * Local routines
  */
 static device_tnexus_device_from_node(device_t, phandle_t);
@@ -181,10 +173,6 @@ static device_method_t nexus_methods[] =
DEVMETHOD(ofw_bus_get_type, nexus_ofw_get_type),
DEVMETHOD(ofw_bus_get_compat, nexus_ofw_get_compat),
 
-   /* Clock interface */
-   DEVMETHOD(clock_gettime,nexus_gettime),
-   DEVMETHOD(clock_settime,nexus_settime),
-
{ 0, 0 }
 };
 
@@ -240,7 +228,6 @@ nexus_attach(device_t dev)
 
}
 
-   clock_register(dev, 1000);
return (bus_generic_attach(dev));
 }
 
@@ -512,50 +499,3 @@ nexus_ofw_get_compat(device_t bus, devic
return (dinfo-ndi_compatible);
 }
 
-#defineDIFF190419702082844800
-
-static int
-nexus_gettime(device_t dev, struct timespec *ts)
-{
-   char path[128];
-   ihandle_t ih;
-   phandle_t ph;
-   u_int rtc;
-
-   ph = OF_finddevice(rtc);
-   if (ph == -1)
-   return (ENOENT);
-
-   OF_package_to_path(ph, path, sizeof(path));
-   ih = OF_open(path);
-   if (ih == -1)
-   return (ENXIO);
-
-   if (OF_call_method(read-rtc, ih, 0, 1, rtc))
-   return (EIO);
-
-   ts-tv_sec = rtc - DIFF19041970;
-   ts-tv_nsec = 0;
-   return (0);
-}
-
-static int
-nexus_settime(device_t dev, struct timespec *ts)
-{
-   char path[128];
-   ihandle_t ih;
-   phandle_t ph; 
-   u_int rtc;
-
-   ph = OF_finddevice(rtc); 
-   if (ph == -1) 
-   return (ENOENT);
-
-   OF_package_to_path(ph, path, sizeof(path));   
-   ih = OF_open(path);
-   if (ih == -1)
-   return (ENXIO);
-
-   rtc = ts-tv_sec + DIFF19041970;
-   return ((OF_call_method(write-rtc, ih, 1, 0, rtc) != 0) ? EIO : 0);
-}

Modified: stable/8/sys/powerpc/powermac/cuda.c
==
--- stable/8/sys/powerpc/powermac/cuda.cMon Nov 22 17:09:42 2010
(r215692)
+++ stable/8/sys/powerpc/powermac/cuda.cMon Nov 22 17:13:04 2010
(r215693)
@@ -37,6 +37,7 @@ __FBSDID($FreeBSD$);
 #include sys/bus.h
 #include sys/conf.h
 #include sys/kernel.h
+#include sys/clock.h
 
 #include dev/ofw/ofw_bus.h
 #include dev/ofw/openfirm.h
@@ -54,6 +55,7 @@ __FBSDID($FreeBSD$);
 
 #include dev/adb/adb.h
 
+#include clock_if.h
 #include cudavar.h
 #include viareg.h
 
@@ -71,6 +73,12 @@ static u_int cuda_poll(device_t dev);
 static voidcuda_send_inbound(struct cuda_softc *sc);
 static voidcuda_send_outbound(struct cuda_softc *sc);
 
+/*
+ * Clock interface
+ */
+static int cuda_gettime(device_t dev, struct timespec *ts);
+static int cuda_settime(device_t dev, struct timespec *ts);
+
 static device_method_t  cuda_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, cuda_probe),
@@ -89,6 +97,10 @@ static device_method_t  cuda_methods[] =
DEVMETHOD(adb_hb_controller_poll,   cuda_poll),
DEVMETHOD(adb_hb_set_autopoll_mask, cuda_adb_autopoll),
 
+  

svn commit: r215694 - stable/8/sys/powerpc/powermac

2010-11-22 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Mon Nov 22 17:14:29 2010
New Revision: 215694
URL: http://svn.freebsd.org/changeset/base/215694

Log:
  MFC r208841:
  Add support for the I2C busses hanging off Apple system management chips.

Modified:
  stable/8/sys/powerpc/powermac/smu.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/powerpc/powermac/smu.c
==
--- stable/8/sys/powerpc/powermac/smu.c Mon Nov 22 17:13:04 2010
(r215693)
+++ stable/8/sys/powerpc/powermac/smu.c Mon Nov 22 17:14:29 2010
(r215694)
@@ -47,12 +47,16 @@ __FBSDID($FreeBSD$);
 #include machine/intr_machdep.h
 #include machine/md_var.h
 
+#include dev/iicbus/iicbus.h
+#include dev/iicbus/iiconf.h
 #include dev/led/led.h
 #include dev/ofw/openfirm.h
 #include dev/ofw/ofw_bus.h
+#include dev/ofw/ofw_bus_subr.h
 #include powerpc/powermac/macgpiovar.h
 
 #include clock_if.h
+#include iicbus_if.h
 
 struct smu_cmd {
volatile uint8_t cmd;
@@ -138,6 +142,8 @@ struct smu_softc {
 
 static int smu_probe(device_t);
 static int smu_attach(device_t);
+static const struct ofw_bus_devinfo *
+smu_get_devinfo(device_t bus, device_t dev);
 
 /* cpufreq notification hooks */
 
@@ -152,6 +158,7 @@ static int  smu_settime(device_t dev, str
 static int smu_run_cmd(device_t dev, struct smu_cmd *cmd, int wait);
 static int smu_get_datablock(device_t dev, int8_t id, uint8_t *buf,
size_t len);
+static voidsmu_attach_i2c(device_t dev, phandle_t i2croot);
 static voidsmu_attach_fans(device_t dev, phandle_t fanroot);
 static voidsmu_attach_sensors(device_t dev, phandle_t sensroot);
 static voidsmu_fan_management_proc(void *xdev);
@@ -172,6 +179,16 @@ static device_method_t  smu_methods[] = 
/* Clock interface */
DEVMETHOD(clock_gettime,smu_gettime),
DEVMETHOD(clock_settime,smu_settime),
+
+   /* ofw_bus interface */
+   DEVMETHOD(bus_child_pnpinfo_str,ofw_bus_gen_child_pnpinfo_str),
+   DEVMETHOD(ofw_bus_get_devinfo,  smu_get_devinfo),
+   DEVMETHOD(ofw_bus_get_compat,   ofw_bus_gen_get_compat),
+   DEVMETHOD(ofw_bus_get_model,ofw_bus_gen_get_model),
+   DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name),
+   DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node),
+   DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type),
+
{ 0, 0 },
 };
 
@@ -305,8 +322,14 @@ smu_attach(device_t dev)
 
if (strncmp(name, sensors, 8) == 0)
smu_attach_sensors(dev, child);
+
+   if (strncmp(name, smu-i2c-control, 15) == 0)
+   smu_attach_i2c(dev, child);
}
 
+   /* Some SMUs have the I2C children directly under the bus. */
+   smu_attach_i2c(dev, node);
+
/*
 * Collect calibration constants.
 */
@@ -373,7 +396,14 @@ smu_attach(device_t dev)
 */
clock_register(dev, 1000);
 
-   return (0);
+   return (bus_generic_attach(dev));
+}
+
+static const struct ofw_bus_devinfo *
+smu_get_devinfo(device_t bus, device_t dev)
+{
+
+   return (device_get_ivars(dev));
 }
 
 static void
@@ -795,8 +825,8 @@ smu_attach_fans(device_t dev, phandle_t 
CTLTYPE_INT | CTLFLAG_RD, fan-max_rpm, sizeof(cell_t),
Maximum allowed RPM);
SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, rpm,
-   CTLTYPE_INT | CTLFLAG_RW, dev, sc-sc_nfans,
-   smu_fanrpm_sysctl, I, Fan RPM);
+   CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, dev,
+   sc-sc_nfans, smu_fanrpm_sysctl, I, Fan RPM);
 
fan++;
sc-sc_nfans++;
@@ -959,8 +989,8 @@ smu_attach_sensors(device_t dev, phandle
sprintf(sysctl_desc,%s (%s), sens-location, units);
 
SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(sensroot_oid), OID_AUTO,
-   sysctl_name, CTLTYPE_INT | CTLFLAG_RD, dev, sc-sc_nsensors,
-   smu_sensor_sysctl, I, sysctl_desc);
+   sysctl_name, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE,
+   dev, sc-sc_nsensors, smu_sensor_sysctl, I, sysctl_desc);
 
sens++;
sc-sc_nsensors++;
@@ -996,13 +1026,6 @@ smu_manage_fans(device_t smu)
maxtemp = temp;
}
 
-   if (maxtemp  10) { /* Bail if no good sensors */
-   for (i = 0; i  sc-sc_nfans; i++) 
-   smu_fan_set_rpm(smu, sc-sc_fans[i],
-   sc-sc_fans[i].unmanaged_rpm);
-   return;
-   }
-
if (maxtemp  

svn commit: r215695 - in stable/8/sys: conf powerpc/powermac

2010-11-22 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Mon Nov 22 17:15:41 2010
New Revision: 215695
URL: http://svn.freebsd.org/changeset/base/215695

Log:
  MFC r208842:
  Add a driver for the CPU temperature sensors attached over I2C on the
  PowerMac 11,2.

Added:
  stable/8/sys/powerpc/powermac/smusat.c
 - copied unchanged from r208842, head/sys/powerpc/powermac/smusat.c
Modified:
  stable/8/sys/conf/files.powerpc
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/conf/files.powerpc
==
--- stable/8/sys/conf/files.powerpc Mon Nov 22 17:14:29 2010
(r215694)
+++ stable/8/sys/conf/files.powerpc Mon Nov 22 17:15:41 2010
(r215695)
@@ -140,6 +140,7 @@ powerpc/powermac/openpic_macio.c optiona
 powerpc/powermac/pswitch.c optionalpowermac pswitch
 powerpc/powermac/pmu.c optionalpowermac pmu 
 powerpc/powermac/smu.c optionalpowermac smu 
+powerpc/powermac/smusat.c  optionalpowermac smu
 powerpc/powermac/uninorth.coptionalpowermac
 powerpc/powermac/uninorthpci.c optionalpowermac pci
 powerpc/powermac/vcoregpio.c   optionalpowermac 

Copied: stable/8/sys/powerpc/powermac/smusat.c (from r208842, 
head/sys/powerpc/powermac/smusat.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/8/sys/powerpc/powermac/smusat.c  Mon Nov 22 17:15:41 2010
(r215695, copy of r208842, head/sys/powerpc/powermac/smusat.c)
@@ -0,0 +1,262 @@
+/*-
+ * Copyright (c) 2010 Nathan Whitehorn
+ * All rights reserved.
+ *
+ * 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 ``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 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.
+ *
+ */
+
+#include sys/cdefs.h
+__FBSDID($FreeBSD$);
+
+#include sys/param.h
+#include sys/systm.h
+#include sys/module.h
+#include sys/bus.h
+#include sys/conf.h
+#include sys/cpu.h
+#include sys/ctype.h
+#include sys/kernel.h
+#include sys/sysctl.h
+
+#include dev/iicbus/iicbus.h
+#include dev/iicbus/iiconf.h
+#include dev/ofw/ofw_bus.h
+#include dev/ofw/openfirm.h
+
+struct smu_sensor {
+   cell_t  reg;
+   charlocation[32];
+   enum {
+   SMU_CURRENT_SENSOR,
+   SMU_VOLTAGE_SENSOR,
+   SMU_POWER_SENSOR,
+   SMU_TEMP_SENSOR
+   } type;
+};
+
+static int smusat_probe(device_t);
+static int smusat_attach(device_t);
+static int smusat_sensor_sysctl(SYSCTL_HANDLER_ARGS);
+
+MALLOC_DEFINE(M_SMUSAT, smusat, SMU Sattelite Sensors);
+
+static device_method_t  smusat_methods[] = {
+   /* Device interface */
+   DEVMETHOD(device_probe, smusat_probe),
+   DEVMETHOD(device_attach,smusat_attach),
+   { 0, 0 },
+};
+
+struct smusat_softc {
+   struct smu_sensor *sc_sensors;
+   int sc_nsensors;
+
+   uint8_t sc_cache[16];
+   time_t  sc_last_update;
+};
+
+static driver_t smusat_driver = {
+   smusat,
+   smusat_methods,
+   sizeof(struct smusat_softc)
+};
+
+static devclass_t smusat_devclass;
+
+DRIVER_MODULE(smusat, iicbus, smusat_driver, smusat_devclass, 0, 0);
+
+static int
+smusat_probe(device_t dev)
+{
+   const char *compat = ofw_bus_get_compat(dev);
+
+   if (compat == NULL || strcmp(compat, smu-sat) != 0)
+   return (ENXIO);
+
+   device_set_desc(dev, SMU Satellite Sensors);
+   return (0);
+}
+
+static int
+smusat_attach(device_t dev)
+{
+   phandle_t 

svn commit: r215696 - in stable/8/sys: conf powerpc/aim powerpc/booke powerpc/include powerpc/mpc85xx powerpc/powermac powerpc/powerpc

2010-11-22 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Mon Nov 22 17:39:18 2010
New Revision: 215696
URL: http://svn.freebsd.org/changeset/base/215696

Log:
  MFC r212054:
  Restructure how reset and poweroff are handled on PowerPC systems, since
  the existing code was very platform specific, and broken for SMP systems
  trying to reboot from KDB.
  
  - Add a new PLATFORM_RESET() method to the platform KOBJ interface, and
migrate existing reset functions into platform modules.
  - Modify the OF_reboot() routine to submit the request by hand to avoid
the IPIs involved in the regular openfirmware() routine. This fixes
reboot from KDB on SMP machines.
  - Move non-KDB reset and poweroff functions on the Powermac platform
into the relevant power control drivers (cuda, pmu, smu), instead of
using them through the Open Firmware backdoor.
  - Rename platform_chrp to platform_powermac since it has become
increasingly Powermac specific. When we gain support for IBM systems,
we will grow a new platform_chrp.

Added:
  stable/8/sys/powerpc/powermac/platform_powermac.c
 - copied unchanged from r212054, 
head/sys/powerpc/powermac/platform_powermac.c
Modified:
  stable/8/sys/conf/files.powerpc
  stable/8/sys/powerpc/aim/machdep.c
  stable/8/sys/powerpc/aim/ofw_machdep.c
  stable/8/sys/powerpc/aim/vm_machdep.c
  stable/8/sys/powerpc/booke/platform_bare.c
  stable/8/sys/powerpc/include/ofw_machdep.h
  stable/8/sys/powerpc/mpc85xx/mpc85xx.c
  stable/8/sys/powerpc/powermac/cuda.c
  stable/8/sys/powerpc/powermac/pmu.c
  stable/8/sys/powerpc/powermac/smu.c
  stable/8/sys/powerpc/powerpc/platform.c
  stable/8/sys/powerpc/powerpc/platform_if.m
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/conf/files.powerpc
==
--- stable/8/sys/conf/files.powerpc Mon Nov 22 17:15:41 2010
(r215695)
+++ stable/8/sys/conf/files.powerpc Mon Nov 22 17:39:18 2010
(r215696)
@@ -82,7 +82,6 @@ powerpc/aim/mp_cpudep.c   optionalaim sm
 powerpc/aim/nexus.coptionalaim
 powerpc/aim/ofw_machdep.c  optionalaim
 powerpc/aim/ofwmagic.S optionalaim
-powerpc/aim/platform_chrp.coptionalaim
 powerpc/aim/swtch.Soptionalaim
 powerpc/aim/trap.c optionalaim
 powerpc/aim/uma_machdep.c  optionalaim
@@ -137,6 +136,7 @@ powerpc/powermac/kiic.c optionalpowerm
 powerpc/powermac/macgpio.c optionalpowermac pci 
 powerpc/powermac/macio.c   optionalpowermac pci
 powerpc/powermac/openpic_macio.c optional  powermac pci
+powerpc/powermac/platform_powermac.c optional  powermac
 powerpc/powermac/pswitch.c optionalpowermac pswitch
 powerpc/powermac/pmu.c optionalpowermac pmu 
 powerpc/powermac/smu.c optionalpowermac smu 

Modified: stable/8/sys/powerpc/aim/machdep.c
==
--- stable/8/sys/powerpc/aim/machdep.c  Mon Nov 22 17:15:41 2010
(r215695)
+++ stable/8/sys/powerpc/aim/machdep.c  Mon Nov 22 17:39:18 2010
(r215696)
@@ -167,15 +167,6 @@ struct bat battable[16];
 struct kva_md_info kmi;
 
 static void
-powerpc_ofw_shutdown(void *junk, int howto)
-{
-   if (howto  RB_HALT) {
-   OF_halt();
-   }
-   OF_reboot();
-}
-
-static void
 cpu_startup(void *dummy)
 {
 
@@ -227,9 +218,6 @@ cpu_startup(void *dummy)
 */
bufinit();
vm_pager_bufferinit();
-
-   EVENTHANDLER_REGISTER(shutdown_final, powerpc_ofw_shutdown, 0,
-   SHUTDOWN_PRI_LAST);
 }
 
 extern charkernel_text[], _end[];

Modified: stable/8/sys/powerpc/aim/ofw_machdep.c
==
--- stable/8/sys/powerpc/aim/ofw_machdep.c  Mon Nov 22 17:15:41 2010
(r215695)
+++ stable/8/sys/powerpc/aim/ofw_machdep.c  Mon Nov 22 17:39:18 2010
(r215696)
@@ -463,20 +463,21 @@ openfirmware(void *args)
 }
 
 void
-OF_halt()
-{
-   int retval; /* dummy, this may not be needed */
-
-   OF_interpret(shut-down, 1, retval);
-   for (;;);   /* just in case */
-}
-
-void
 OF_reboot()
 {
-   int retval; /* dummy, this may not be needed */
+   struct {
+   cell_t name;
+   cell_t nargs;
+   cell_t nreturns;
+   cell_t arg;
+   } args;
+
+   args.name = (cell_t)(uintptr_t)interpret;
+   args.nargs = 1;
+   args.nreturns = 0;
+   args.arg = (cell_t)(uintptr_t)reset-all;
+   openfirmware_core(args); /* Don't do 

Re: svn commit: r215679 - in head: contrib/binutils/bfd contrib/binutils/binutils contrib/binutils/include/elf contrib/file contrib/gdb/gdb gnu/usr.bin/gdb/libgdb sys/compat/freebsd32 sys/kern sys/sys

2010-11-22 Thread Ed Maste
On Mon, Nov 22, 2010 at 02:42:13PM +, Attilio Rao wrote:

 Author: attilio
 Date: Mon Nov 22 14:42:13 2010
 New Revision: 215679
 URL: http://svn.freebsd.org/changeset/base/215679
 
 Log:
   Add the ability for GDB to printout the thread name along with other
   thread specific informations.

This change is particularly useful if one has a heavily threaded app
that uses pthread_set_name_np() to set its thread names.

This is an example of the output you get with stock GDB:

(gdb) info threads
  12 Thread 2a4041c0 (LWP 100184)  0x29e91fe3 in memset ()
  11 Thread 2a404700 (LWP 100190)  0x29e2be33 in poll ()
  10 Thread 2a404c40 (LWP 100191)  0x29ed85e7 in _umtx_op_err ()

And with this change:

(gdb) info threads
  41 Thread 0x9d8 (LWP 100259/initial thread)  0x6a3f23ff in nanosleep ()
  40 Thread 0x9f48600 (LWP 100315/EventLoop)  0x6a38e427 in _umtx_op ()
  39 Thread 0x9f48800 (LWP 100321/ntfy)  0x6a38e427 in _umtx_op ()

-Ed
___
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-unsubscr...@freebsd.org


svn commit: r215697 - in head/crypto/openssl: . apps crypto crypto/aes crypto/aes/asm crypto/asn1 crypto/bio crypto/bn crypto/cms crypto/conf crypto/des crypto/dsa crypto/ec crypto/ecdh crypto/ecds...

2010-11-22 Thread Simon L. Nielsen
Author: simon
Date: Mon Nov 22 18:23:44 2010
New Revision: 215697
URL: http://svn.freebsd.org/changeset/base/215697

Log:
  Merge OpenSSL 0.9.8p into head.
  
  Security: CVE-2010-3864
  Security: http://www.openssl.org/news/secadv_20101116.txt

Modified:
  head/crypto/openssl/CHANGES
  head/crypto/openssl/Configure
  head/crypto/openssl/FAQ
  head/crypto/openssl/Makefile
  head/crypto/openssl/NEWS
  head/crypto/openssl/PROBLEMS
  head/crypto/openssl/README
  head/crypto/openssl/apps/apps.c
  head/crypto/openssl/apps/dh.c
  head/crypto/openssl/apps/dhparam.c
  head/crypto/openssl/apps/dsaparam.c
  head/crypto/openssl/apps/ec.c
  head/crypto/openssl/apps/ecparam.c
  head/crypto/openssl/apps/enc.c
  head/crypto/openssl/apps/gendh.c
  head/crypto/openssl/apps/gendsa.c
  head/crypto/openssl/apps/genrsa.c
  head/crypto/openssl/apps/pkcs7.c
  head/crypto/openssl/apps/rand.c
  head/crypto/openssl/apps/s_server.c
  head/crypto/openssl/apps/s_socket.c
  head/crypto/openssl/apps/speed.c
  head/crypto/openssl/apps/x509.c
  head/crypto/openssl/crypto/aes/aes_wrap.c
  head/crypto/openssl/crypto/aes/asm/aes-x86_64.pl
  head/crypto/openssl/crypto/asn1/a_int.c
  head/crypto/openssl/crypto/asn1/n_pkey.c
  head/crypto/openssl/crypto/asn1/t_crl.c
  head/crypto/openssl/crypto/asn1/tasn_dec.c
  head/crypto/openssl/crypto/asn1/x_x509.c
  head/crypto/openssl/crypto/bio/b_sock.c
  head/crypto/openssl/crypto/bio/bf_nbio.c
  head/crypto/openssl/crypto/bio/bio_lib.c
  head/crypto/openssl/crypto/bio/bss_acpt.c
  head/crypto/openssl/crypto/bio/bss_sock.c
  head/crypto/openssl/crypto/bn/bn_exp2.c
  head/crypto/openssl/crypto/bn/bn_mul.c
  head/crypto/openssl/crypto/cms/cms_asn1.c
  head/crypto/openssl/crypto/conf/conf_def.c
  head/crypto/openssl/crypto/des/rpc_des.h
  head/crypto/openssl/crypto/dsa/dsa_gen.c
  head/crypto/openssl/crypto/dsa/dsa_ossl.c
  head/crypto/openssl/crypto/ec/ec2_mult.c
  head/crypto/openssl/crypto/ec/ec_mult.c
  head/crypto/openssl/crypto/ecdh/ech_lib.c
  head/crypto/openssl/crypto/ecdsa/ecs_lib.c
  head/crypto/openssl/crypto/engine/eng_list.c
  head/crypto/openssl/crypto/err/err_prn.c
  head/crypto/openssl/crypto/evp/bio_b64.c
  head/crypto/openssl/crypto/evp/enc_min.c
  head/crypto/openssl/crypto/evp/encode.c
  head/crypto/openssl/crypto/evp/evp_pbe.c
  head/crypto/openssl/crypto/hmac/hmac.c
  head/crypto/openssl/crypto/md32_common.h
  head/crypto/openssl/crypto/o_init.c
  head/crypto/openssl/crypto/ocsp/ocsp_ht.c
  head/crypto/openssl/crypto/ocsp/ocsp_prn.c
  head/crypto/openssl/crypto/opensslv.h
  head/crypto/openssl/crypto/pem/pem_lib.c
  head/crypto/openssl/crypto/pkcs12/p12_key.c
  head/crypto/openssl/crypto/pkcs12/p12_npas.c
  head/crypto/openssl/crypto/pkcs7/pk7_doit.c
  head/crypto/openssl/crypto/pkcs7/pk7_lib.c
  head/crypto/openssl/crypto/pkcs7/pk7_mime.c
  head/crypto/openssl/crypto/pqueue/pqueue.c
  head/crypto/openssl/crypto/rand/rand_nw.c
  head/crypto/openssl/crypto/rand/randfile.c
  head/crypto/openssl/crypto/rsa/rsa_eay.c
  head/crypto/openssl/crypto/x509/x509.h
  head/crypto/openssl/crypto/x509/x509_vfy.c
  head/crypto/openssl/crypto/x509/x_all.c
  head/crypto/openssl/crypto/x509v3/v3_ncons.c
  head/crypto/openssl/crypto/x509v3/v3_pci.c
  head/crypto/openssl/doc/apps/smime.pod
  head/crypto/openssl/doc/crypto/ASN1_OBJECT_new.pod
  head/crypto/openssl/doc/crypto/ASN1_STRING_length.pod
  head/crypto/openssl/doc/crypto/ASN1_STRING_new.pod
  head/crypto/openssl/doc/crypto/ASN1_generate_nconf.pod
  head/crypto/openssl/doc/crypto/BIO_f_buffer.pod
  head/crypto/openssl/doc/crypto/BIO_should_retry.pod
  head/crypto/openssl/doc/crypto/CRYPTO_set_ex_data.pod
  head/crypto/openssl/doc/crypto/OBJ_nid2obj.pod
  head/crypto/openssl/doc/crypto/PKCS7_decrypt.pod
  head/crypto/openssl/doc/crypto/PKCS7_encrypt.pod
  head/crypto/openssl/doc/crypto/PKCS7_sign.pod
  head/crypto/openssl/doc/crypto/PKCS7_verify.pod
  head/crypto/openssl/doc/crypto/SMIME_read_PKCS7.pod
  head/crypto/openssl/doc/crypto/SMIME_write_PKCS7.pod
  head/crypto/openssl/doc/crypto/X509_NAME_ENTRY_get_object.pod
  head/crypto/openssl/doc/crypto/X509_NAME_add_entry_by_txt.pod
  head/crypto/openssl/doc/crypto/X509_NAME_get_index_by_NID.pod
  head/crypto/openssl/doc/crypto/X509_new.pod
  head/crypto/openssl/doc/crypto/bn_internal.pod
  head/crypto/openssl/doc/crypto/ui_compat.pod
  head/crypto/openssl/doc/ssl/SSL_library_init.pod
  head/crypto/openssl/e_os.h
  head/crypto/openssl/engines/e_chil.c
  head/crypto/openssl/engines/e_cswift.c
  head/crypto/openssl/engines/e_ubsec.c
  head/crypto/openssl/fips/mkfipsscr.pl
  head/crypto/openssl/openssl.spec
  head/crypto/openssl/ssl/d1_both.c
  head/crypto/openssl/ssl/d1_clnt.c
  head/crypto/openssl/ssl/d1_enc.c
  head/crypto/openssl/ssl/d1_lib.c
  head/crypto/openssl/ssl/d1_pkt.c
  head/crypto/openssl/ssl/dtls1.h
  head/crypto/openssl/ssl/s23_clnt.c
  head/crypto/openssl/ssl/s23_lib.c
  head/crypto/openssl/ssl/s2_srvr.c
  head/crypto/openssl/ssl/s3_both.c
  head/crypto/openssl/ssl/s3_clnt.c
  

svn commit: r215699 - head/sys/net80211

2010-11-22 Thread Bernhard Schmidt
Author: bschmidt
Date: Mon Nov 22 19:01:47 2010
New Revision: 215699
URL: http://svn.freebsd.org/changeset/base/215699

Log:
  The meshid element is memcpy()'ed into se_meshid if included in either
  beacon or probe-response frames. Fix the condition by checking for the
  the array's content instead of the always existing array itself.
  
  Reviewed by:  rpaulo, stefanf
  MFC after:3 days

Modified:
  head/sys/net80211/ieee80211_scan_sta.c

Modified: head/sys/net80211/ieee80211_scan_sta.c
==
--- head/sys/net80211/ieee80211_scan_sta.c  Mon Nov 22 18:29:00 2010
(r215698)
+++ head/sys/net80211/ieee80211_scan_sta.c  Mon Nov 22 19:01:47 2010
(r215699)
@@ -1013,7 +1013,7 @@ match_bss(struct ieee80211vap *vap,
 */
if (se-se_capinfo  
(IEEE80211_CAPINFO_IBSS|IEEE80211_CAPINFO_ESS))
fail |= MATCH_CAPINFO;
-   else if (se-se_meshid == NULL)
+   else if (se-se_meshid[0] != IEEE80211_ELEMID_MESHID)
fail |= MATCH_MESH_NOID;
else if (ms-ms_idlen != 0 
match_id(se-se_meshid, ms-ms_id, ms-ms_idlen))
___
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-unsubscr...@freebsd.org


svn commit: r215700 - in stable/8: sbin/iscontrol sys/dev/iscsi/initiator

2010-11-22 Thread Dag-Erling Smorgrav
Author: des
Date: Mon Nov 22 19:02:30 2010
New Revision: 215700
URL: http://svn.freebsd.org/changeset/base/215700

Log:
  MFC r209052, r210702, r211095, r211182, r212149: Fix a memory leak and
  some potential deadlocks, increase the target limit from 4 to 64, and
  numerous other scalability and stability improvements, including.
  
  Submitted by: Daniel Braniss da...@cs.huji.ac.il
  Sponsored by: Dansk Scanning A/S, Data Robotics Inc.

Deleted:
  stable/8/sbin/iscontrol/pdu.h
Modified:
  stable/8/sbin/iscontrol/Makefile
  stable/8/sbin/iscontrol/auth_subr.c
  stable/8/sbin/iscontrol/config.c
  stable/8/sbin/iscontrol/fsm.c
  stable/8/sbin/iscontrol/iscontrol.8
  stable/8/sbin/iscontrol/iscontrol.c
  stable/8/sbin/iscontrol/iscontrol.h
  stable/8/sbin/iscontrol/iscsi.conf.5
  stable/8/sbin/iscontrol/login.c
  stable/8/sbin/iscontrol/misc.c
  stable/8/sbin/iscontrol/pdu.c
  stable/8/sys/dev/iscsi/initiator/isc_cam.c
  stable/8/sys/dev/iscsi/initiator/isc_sm.c
  stable/8/sys/dev/iscsi/initiator/isc_soc.c
  stable/8/sys/dev/iscsi/initiator/isc_subr.c
  stable/8/sys/dev/iscsi/initiator/iscsi.c
  stable/8/sys/dev/iscsi/initiator/iscsi.h
  stable/8/sys/dev/iscsi/initiator/iscsi_subr.c
  stable/8/sys/dev/iscsi/initiator/iscsivar.h
Directory Properties:
  stable/8/sbin/iscontrol/   (props changed)

Modified: stable/8/sbin/iscontrol/Makefile
==
--- stable/8/sbin/iscontrol/MakefileMon Nov 22 19:01:47 2010
(r215699)
+++ stable/8/sbin/iscontrol/MakefileMon Nov 22 19:02:30 2010
(r215700)
@@ -4,8 +4,10 @@ SRCS= iscontrol.c pdu.c fsm.c config.c l
 PROG= iscontrol
 DPADD= ${LIBCAM} ${LIBMD}
 LDADD= -lcam -lmd
+S= ${.CURDIR}/../../sys
 
-CFLAGS += -I${.CURDIR}/../../sys/dev/iscsi/initiator
+WARNS?=3
+CFLAGS += -I$S
 #CFLAGS += -g -DDEBUG
 
 MAN= iscsi.conf.5 iscontrol.8

Modified: stable/8/sbin/iscontrol/auth_subr.c
==
--- stable/8/sbin/iscontrol/auth_subr.c Mon Nov 22 19:01:47 2010
(r215699)
+++ stable/8/sbin/iscontrol/auth_subr.c Mon Nov 22 19:02:30 2010
(r215700)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2005-2008 Daniel Braniss da...@cs.huji.ac.il
+ * Copyright (c) 2005-2010 Daniel Braniss da...@cs.huji.ac.il
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -52,7 +52,7 @@ __FBSDID($FreeBSD$);
 #include md5.h
 #include sha.h
 
-#include iscsi.h
+#include dev/iscsi/initiator/iscsi.h
 #include iscontrol.h
 
 static int
@@ -152,7 +152,7 @@ chapDigest(char *ap, char id, char *cp, 
 }
 
 char *
-genChapChallenge(char *encoding, int len)
+genChapChallenge(char *encoding, uint len)
 {
  int   fd;
  unsigned  char tmp[1024];

Modified: stable/8/sbin/iscontrol/config.c
==
--- stable/8/sbin/iscontrol/config.cMon Nov 22 19:01:47 2010
(r215699)
+++ stable/8/sbin/iscontrol/config.cMon Nov 22 19:02:30 2010
(r215700)
@@ -1,5 +1,5 @@
  /*-
- * Copyright (c) 2005-2008 Daniel Braniss da...@cs.huji.ac.il
+ * Copyright (c) 2005-2009 Daniel Braniss da...@cs.huji.ac.il
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,7 @@ __FBSDID($FreeBSD$);
 #include ctype.h
 #include camlib.h
 
-#include iscsi.h
+#include dev/iscsi/initiator/iscsi.h
 #include iscontrol.h
 
 /*
@@ -94,6 +94,11 @@ __FBSDID($FreeBSD$);
 #define OPT_iqn34
 #define OPT_sockbufsize35
 
+/*
+ | sentinel
+ */
+#define OPT_end0
+
 #define _OFF(v)((int)((isc_opt_t *)NULL)-v)
 #define _E(u, s, v) {.usage=u, .scope=s, .name=#v, .tokenID=OPT_##v}
 
@@ -145,7 +150,7 @@ textkey_t keyMap[] = {
  
  _E(U_LO, S_SW, sessionType),
 
- {0}
+ _E(0, 0, end)
 };
 
 #define _OPT_INT(w)strtol((char *)w, NULL, 0)
@@ -154,7 +159,7 @@ textkey_t keyMap[] = {
 static __inline  int
 _OPT_BOOL(char *w)
 {
- if(isalpha(*w))
+ if(isalpha((unsigned char)*w))
  return strcasecmp(w, TRUE) == 0;
  else
  return _OPT_INT(w);
@@ -244,13 +249,12 @@ getConfig(FILE *fd, char *key, char **Ar
  len = 0;
  state = 0;
  while((lp = getline(fd)) != NULL) {
- for(; isspace(*lp); lp++)
+ for(; isspace((unsigned char)*lp); lp++)
   ;
  switch(state) {
  case 0:
   if((p = strchr(lp, '{')) != NULL) {
-   n = 0;
-   while((--p  lp)  *p  isspace(*p));
+   while((--p  lp)  *p  isspace((unsigned char)*p));
n = p - lp;
if(len  strncmp(lp, key, MAX(n, len)) == 0)
 state = 2;
@@ -273,7 +277,7 @@ getConfig(FILE *fd, char *key, char **Ar
  }
 
  
- for(p = 

Re: svn commit: r215675 - head/sys/compat/linux

2010-11-22 Thread Erik Cederstrand

Den 22/11/2010 kl. 13.42 skrev Alexander Leidinger:

 Author: netchild
 Date: Mon Nov 22 12:42:32 2010
 New Revision: 215675
 URL: http://svn.freebsd.org/changeset/base/215675
 
 Log:
  Do not take the process lock. The assignment to u_short inside the
  properly aligned structure is atomic on all supported architectures, and
  the thread that should see side-effect of assignment is the same thread
  that does assignment.
 
  Use a more appropriate conditional to detect the linux ABI.
 
  Suggested by:kib
  X-MFC:   together with r215664
 
 Modified:
  head/sys/compat/linux/linux_emul.c
 
 Modified: head/sys/compat/linux/linux_emul.c
 ==
 --- head/sys/compat/linux/linux_emul.cMon Nov 22 12:33:48 2010
 (r215674)
 +++ head/sys/compat/linux/linux_emul.cMon Nov 22 12:42:32 2010
 (r215675)
 @@ -198,11 +198,8 @@ linux_proc_exit(void *arg __unused, stru
   } else  
   EMUL_SHARED_WUNLOCK(emul_shared_lock);
 
 - if ((shared_flags  EMUL_SHARED_HASXSTAT) != 0) {
 - PROC_LOCK(p);
 + if ((shared_flags  EMUL_SHARED_HASXSTAT) != 0)
   p-p_xstat = shared_xstat;
 - PROC_UNLOCK(p);
 - }
 
   if (child_clear_tid != NULL) {
   struct linux_sys_futex_args cup;
 @@ -265,7 +262,8 @@ linux_proc_exec(void *arg __unused, stru
   if (__predict_false(imgp-sysent == elf_linux_sysvec
p-p_sysent != elf_linux_sysvec))
   linux_proc_init(FIRST_THREAD_IN_PROC(p), p-p_pid, 0);
 - if (__predict_false(p-p_sysent == elf_linux_sysvec))
 + if (__predict_false((p-p_sysent-sv_flags  SV_ABI_MASK) ==
 + SV_ABI_LINUX))
   /* Kill threads regardless of imgp-sysent value */
   linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL);
   if (__predict_false(imgp-sysent != elf_linux_sysvec

This breaks make buildkernel for me (8.1 RELEASE host):

/usr/home/erik/freebsd/head/src/sys/modules/linux/../../compat/linux/linux_emul.c:
 In function 'linux_proc_exec':
/usr/home/erik/freebsd/head/src/sys/modules/linux/../../compat/linux/linux_emul.c:265:
 error: dereferencing pointer to incomplete type
/usr/home/erik/freebsd/head/src/sys/modules/linux/../../compat/linux/linux_emul.c:265:
 error: 'SV_ABI_MASK' undeclared (first use in this function)

Erik

svn commit: r215701 - in head/sys: kern mips/mips mips/rmi net netgraph netinet netinet/ipfw netinet6 netipsec powerpc/aim powerpc/booke sys

2010-11-22 Thread Dimitry Andric
Author: dim
Date: Mon Nov 22 19:32:54 2010
New Revision: 215701
URL: http://svn.freebsd.org/changeset/base/215701

Log:
  After some off-list discussion, revert a number of changes to the
  DPCPU_DEFINE and VNET_DEFINE macros, as these cause problems for various
  people working on the affected files.  A better long-term solution is
  still being considered.  This reversal may give some modules empty
  set_pcpu or set_vnet sections, but these are harmless.
  
  Changes reverted:
  
  
  r215318 | dim | 2010-11-14 21:40:55 +0100 (Sun, 14 Nov 2010) | 4 lines
  
  Instead of unconditionally emitting .globl's for the __start_set_xxx and
  __stop_set_xxx symbols, only emit them when the set_vnet or set_pcpu
  sections are actually defined.
  
  
  r215317 | dim | 2010-11-14 21:38:11 +0100 (Sun, 14 Nov 2010) | 3 lines
  
  Apply the STATIC_VNET_DEFINE and STATIC_DPCPU_DEFINE macros throughout
  the tree.
  
  
  r215316 | dim | 2010-11-14 21:23:02 +0100 (Sun, 14 Nov 2010) | 2 lines
  
  Add macros to define static instances of VNET_DEFINE and DPCPU_DEFINE.

Modified:
  head/sys/kern/kern_clock.c
  head/sys/kern/kern_clocksource.c
  head/sys/kern/sched_4bsd.c
  head/sys/kern/subr_pcpu.c
  head/sys/mips/mips/tick.c
  head/sys/mips/rmi/tick.c
  head/sys/net/flowtable.c
  head/sys/net/if.c
  head/sys/net/if_clone.c
  head/sys/net/if_ethersubr.c
  head/sys/net/if_gif.c
  head/sys/net/if_llatbl.c
  head/sys/net/if_loop.c
  head/sys/net/route.c
  head/sys/net/vnet.c
  head/sys/net/vnet.h
  head/sys/netgraph/ng_base.c
  head/sys/netgraph/ng_eiface.c
  head/sys/netgraph/ng_iface.c
  head/sys/netinet/if_ether.c
  head/sys/netinet/igmp.c
  head/sys/netinet/in.c
  head/sys/netinet/in_pcb.c
  head/sys/netinet/in_rmx.c
  head/sys/netinet/ip_divert.c
  head/sys/netinet/ip_fastfwd.c
  head/sys/netinet/ip_icmp.c
  head/sys/netinet/ip_input.c
  head/sys/netinet/ip_ipsec.c
  head/sys/netinet/ip_mroute.c
  head/sys/netinet/ipfw/ip_fw2.c
  head/sys/netinet/ipfw/ip_fw_dynamic.c
  head/sys/netinet/ipfw/ip_fw_nat.c
  head/sys/netinet/ipfw/ip_fw_pfil.c
  head/sys/netinet/siftr.c
  head/sys/netinet/tcp_hostcache.c
  head/sys/netinet/tcp_reass.c
  head/sys/netinet/tcp_subr.c
  head/sys/netinet/tcp_syncache.c
  head/sys/netinet/tcp_timewait.c
  head/sys/netinet/udp_usrreq.c
  head/sys/netinet6/frag6.c
  head/sys/netinet6/icmp6.c
  head/sys/netinet6/in6_rmx.c
  head/sys/netinet6/in6_src.c
  head/sys/netinet6/ip6_ipsec.c
  head/sys/netinet6/ip6_mroute.c
  head/sys/netinet6/mld6.c
  head/sys/netinet6/nd6.c
  head/sys/netinet6/nd6_nbr.c
  head/sys/netinet6/nd6_rtr.c
  head/sys/netinet6/scope6.c
  head/sys/netinet6/send.c
  head/sys/netipsec/key.c
  head/sys/netipsec/keysock.c
  head/sys/netipsec/xform_esp.c
  head/sys/powerpc/aim/clock.c
  head/sys/powerpc/booke/clock.c
  head/sys/sys/cdefs.h
  head/sys/sys/linker_set.h
  head/sys/sys/pcpu.h

Modified: head/sys/kern/kern_clock.c
==
--- head/sys/kern/kern_clock.c  Mon Nov 22 19:02:30 2010(r215700)
+++ head/sys/kern/kern_clock.c  Mon Nov 22 19:32:54 2010(r215701)
@@ -373,7 +373,7 @@ int profprocs;
 intticks;
 intpsratio;
 
-STATIC_DPCPU_DEFINE(int, pcputicks);   /* Per-CPU version of ticks. */
+static DPCPU_DEFINE(int, pcputicks);   /* Per-CPU version of ticks. */
 static int global_hardclock_run = 0;
 
 /*

Modified: head/sys/kern/kern_clocksource.c
==
--- head/sys/kern/kern_clocksource.cMon Nov 22 19:02:30 2010
(r215700)
+++ head/sys/kern/kern_clocksource.cMon Nov 22 19:32:54 2010
(r215701)
@@ -135,7 +135,7 @@ struct pcpu_state {
int idle;   /* This CPU is in idle mode. */
 };
 
-STATIC_DPCPU_DEFINE(struct pcpu_state, timerstate);
+static DPCPU_DEFINE(struct pcpu_state, timerstate);
 
 #define FREQ2BT(freq, bt)  \
 {  \

Modified: head/sys/kern/sched_4bsd.c
==
--- head/sys/kern/sched_4bsd.c  Mon Nov 22 19:02:30 2010(r215700)
+++ head/sys/kern/sched_4bsd.c  Mon Nov 22 19:32:54 2010(r215701)
@@ -161,7 +161,7 @@ struct pcpuidlestat {
u_int idlecalls;
u_int oldidlecalls;
 };
-STATIC_DPCPU_DEFINE(struct pcpuidlestat, idlestat);
+static DPCPU_DEFINE(struct pcpuidlestat, idlestat);
 
 static void
 setup_runqs(void)

Modified: head/sys/kern/subr_pcpu.c
==
--- head/sys/kern/subr_pcpu.c   Mon Nov 22 19:02:30 2010(r215700)
+++ head/sys/kern/subr_pcpu.c   Mon Nov 22 

svn commit: r215702 - head/sbin/routed

2010-11-22 Thread Bruce Cran
Author: brucec
Date: Mon Nov 22 19:40:27 2010
New Revision: 215702
URL: http://svn.freebsd.org/changeset/base/215702

Log:
  Fix use of AND operator: should be bitwise instead of logical.

Modified:
  head/sbin/routed/parms.c

Modified: head/sbin/routed/parms.c
==
--- head/sbin/routed/parms.cMon Nov 22 19:32:54 2010(r215701)
+++ head/sbin/routed/parms.cMon Nov 22 19:40:27 2010(r215702)
@@ -876,11 +876,11 @@ check_parms(struct parm *new)
if ((0 != (new-parm_int_state  GROUP_IS_SOL_OUT)
  0 != (parmp-parm_int_state  GROUP_IS_SOL_OUT)
  0 != ((new-parm_int_state ^ parmp-parm_int_state)
-  GROUP_IS_SOL_OUT))
+  GROUP_IS_SOL_OUT))
|| (0 != (new-parm_int_state  GROUP_IS_ADV_OUT)
 0 != (parmp-parm_int_state  GROUP_IS_ADV_OUT)
 0 != ((new-parm_int_state ^ parmp-parm_int_state)
- GROUP_IS_ADV_OUT))
+ GROUP_IS_ADV_OUT))
|| (new-parm_rdisc_pref != 0
 parmp-parm_rdisc_pref != 0
 new-parm_rdisc_pref != parmp-parm_rdisc_pref)
___
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-unsubscr...@freebsd.org


svn commit: r215703 - in head/sys: amd64/amd64 i386/i386

2010-11-22 Thread Jung-uk Kim
Author: jkim
Date: Mon Nov 22 19:52:44 2010
New Revision: 215703
URL: http://svn.freebsd.org/changeset/base/215703

Log:
  - Disable caches and flush caches/TLBs when we update PAT as we do for MTRR.
  Flushing TLBs is required to ensure cache coherency according to the AMD64
  architecture manual.  Flushing caches is only required when changing from a
  cacheable memory type (WB, WP, or WT) to an uncacheable type (WC, UC, or
  UC-).  Since this function is only used once per processor during startup,
  there is no need to take any shortcuts.
  - Leave PAT indices 0-3 at the default of WB, WT, UC-, and UC.  Program 5 as
  WP (from default WT) and 6 as WC (from default UC-).  Leave 4 and 7 at the
  default of WB and UC.  This is to avoid transition from a cacheable memory
  type to an uncacheable type to minimize possible cache incoherency.  Since
  we perform flushing caches and TLBs now, this change may not be necessary
  any more but we do not want to take any chances.
  - Remove Apple hardware specific quirks.  With the above changes, it seems
  this hack is no longer needed.
  - Improve pmap_cache_bits() with an array to map PAT memory type to index.
  This array is initialized early from pmap_init_pat(), so that we do not need
  to handle special cases in the function any more.  Now this function is
  identical on both amd64 and i386.
  
  Reviewed by:  jhb
  Tested by:RM (reuf_m at hotmail dot com)
Ryszard Czekaj (rychoo at freeshell dot net)
army.of.root (army dot of dot root at googlemail dot com)
  MFC after:3 days

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/i386/i386/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Mon Nov 22 19:40:27 2010(r215702)
+++ head/sys/amd64/amd64/pmap.c Mon Nov 22 19:52:44 2010(r215703)
@@ -180,14 +180,20 @@ static vm_paddr_t dmaplimit;
 vm_offset_t kernel_vm_end = VM_MIN_KERNEL_ADDRESS;
 pt_entry_t pg_nx;
 
-static int pat_works = 0;  /* Is page attribute table sane? */
-
 SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, VM/pmap parameters);
 
+static int pat_works = 1;
+TUNABLE_INT(vm.pmap.pat_works, pat_works);
+SYSCTL_INT(_vm_pmap, OID_AUTO, pat_works, CTLFLAG_RDTUN, pat_works, 1,
+Is page attribute table fully functional?);
+
 static int pg_ps_enabled = 1;
 SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RDTUN, pg_ps_enabled, 0,
 Are large page mappings enabled?);
 
+#definePAT_INDEX_SIZE  8
+static int pat_index[PAT_INDEX_SIZE];  /* cache mode to PAT index conversion */
+
 static u_int64_t   KPTphys;/* phys addr of kernel level 1 */
 static u_int64_t   KPDphys;/* phys addr of kernel level 2 */
 u_int64_t  KPDPphys;   /* phys addr of kernel level 3 */
@@ -608,31 +614,24 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
 void
 pmap_init_pat(void)
 {
+   int pat_table[PAT_INDEX_SIZE];
uint64_t pat_msr;
-   char *sysenv;
-   static int pat_tested = 0;
+   u_long cr0, cr4;
+   int i;
 
/* Bail if this CPU doesn't implement PAT. */
-   if (!(cpu_feature  CPUID_PAT))
+   if ((cpu_feature  CPUID_PAT) == 0)
panic(no PAT??);
 
-   /*
-* Some Apple Macs based on nVidia chipsets cannot enter ACPI mode
-* via SMI# when we use upper 4 PAT entries for unknown reason.
-*/
-   if (!pat_tested) {
-   pat_works = 1;
-   sysenv = getenv(smbios.system.product);
-   if (sysenv != NULL) {
-   if (strncmp(sysenv, MacBook5,1, 10) == 0 ||
-   strncmp(sysenv, MacBookPro5,5, 13) == 0 ||
-   strncmp(sysenv, Macmini3,1, 10) == 0 ||
-   strncmp(sysenv, iMac9,1, 7) == 0)
-   pat_works = 0;
-   freeenv(sysenv);
-   }
-   pat_tested = 1;
-   }
+   /* Set default PAT index table. */
+   for (i = 0; i  PAT_INDEX_SIZE; i++)
+   pat_table[i] = -1;
+   pat_table[PAT_WRITE_BACK] = 0;
+   pat_table[PAT_WRITE_THROUGH] = 1;
+   pat_table[PAT_UNCACHEABLE] = 3;
+   pat_table[PAT_WRITE_COMBINING] = 3;
+   pat_table[PAT_WRITE_PROTECTED] = 3;
+   pat_table[PAT_UNCACHED] = 3;
 
/* Initialize default PAT entries. */
pat_msr = PAT_VALUE(0, PAT_WRITE_BACK) |
@@ -647,20 +646,48 @@ pmap_init_pat(void)
if (pat_works) {
/*
 * Leave the indices 0-3 at the default of WB, WT, UC-, and UC.
-* Program 4 and 5 as WP and WC.
-* Leave 6 and 7 as UC- and UC.
+* Program 5 and 6 as WP and WC.
+* Leave 4 and 7 as WB and UC.
 */
-   pat_msr = ~(PAT_MASK(4) | PAT_MASK(5));
-   pat_msr |= PAT_VALUE(4, 

svn commit: r215704 - in head: bin/sh sbin/bsdlabel sbin/geom/class/eli sbin/geom/class/part sbin/geom/class/virstor sbin/growfs sbin/gvinum sbin/hastctl sbin/mknod usr.bin/ar usr.bin/bc

2010-11-22 Thread Bruce Cran
Author: brucec
Date: Mon Nov 22 20:10:48 2010
New Revision: 215704
URL: http://svn.freebsd.org/changeset/base/215704

Log:
  Fix some more warnings found by clang.

Modified:
  head/bin/sh/arith_lex.l
  head/sbin/bsdlabel/bsdlabel.c
  head/sbin/geom/class/eli/geom_eli.c
  head/sbin/geom/class/part/geom_part.c
  head/sbin/geom/class/virstor/geom_virstor.c
  head/sbin/growfs/debug.c
  head/sbin/gvinum/gvinum.c
  head/sbin/hastctl/Makefile
  head/sbin/mknod/mknod.c
  head/usr.bin/ar/acplex.l
  head/usr.bin/bc/scan.l

Modified: head/bin/sh/arith_lex.l
==
--- head/bin/sh/arith_lex.l Mon Nov 22 19:52:44 2010(r215703)
+++ head/bin/sh/arith_lex.l Mon Nov 22 20:10:48 2010(r215704)
@@ -55,6 +55,7 @@ int yylex(void);
 #define YY_INPUT(buf,result,max) \
result = (*buf = *arith_buf++) ? 1 : YY_NULL;
 #define YY_NO_UNPUT
+#define YY_NO_INPUT
 %}
 
 %%

Modified: head/sbin/bsdlabel/bsdlabel.c
==
--- head/sbin/bsdlabel/bsdlabel.c   Mon Nov 22 19:52:44 2010
(r215703)
+++ head/sbin/bsdlabel/bsdlabel.c   Mon Nov 22 20:10:48 2010
(r215704)
@@ -515,7 +515,7 @@ readlabel(int flag)
 
f = open(specname, O_RDONLY);
if (f  0)
-   err(1, specname);
+   err(1, %s, specname);
if (is_file)
get_file_parms(f);
else {

Modified: head/sbin/geom/class/eli/geom_eli.c
==
--- head/sbin/geom/class/eli/geom_eli.c Mon Nov 22 19:52:44 2010
(r215703)
+++ head/sbin/geom/class/eli/geom_eli.c Mon Nov 22 20:10:48 2010
(r215704)
@@ -374,7 +374,7 @@ eli_genkey_files(struct gctl_req *req, b
if (!gctl_has_param(req, argname))
return (i);
 
-   file = gctl_get_ascii(req, argname);
+   file = gctl_get_ascii(req, %s, argname);
assert(file != NULL);
 
if (strcmp(file, -) == 0)

Modified: head/sbin/geom/class/part/geom_part.c
==
--- head/sbin/geom/class/part/geom_part.c   Mon Nov 22 19:52:44 2010
(r215703)
+++ head/sbin/geom/class/part/geom_part.c   Mon Nov 22 20:10:48 2010
(r215704)
@@ -614,7 +614,7 @@ static int
 gpart_show_hasopt(struct gctl_req *req, const char *opt, const char *elt)
 {
 
-   if (!gctl_get_int(req, opt))
+   if (!gctl_get_int(req, %s, opt))
return (0);
 
if (elt != NULL)

Modified: head/sbin/geom/class/virstor/geom_virstor.c
==
--- head/sbin/geom/class/virstor/geom_virstor.c Mon Nov 22 19:52:44 2010
(r215703)
+++ head/sbin/geom/class/virstor/geom_virstor.c Mon Nov 22 20:10:48 2010
(r215704)
@@ -276,7 +276,7 @@ virstor_label(struct gctl_req *req)
msize = secsize = 0;
for (i = 1; i  (unsigned)nargs; i++) {
snprintf(param, sizeof(param), arg%u, i);
-   name = gctl_get_ascii(req, param);
+   name = gctl_get_ascii(req, %s, param);
ssize = g_get_sectorsize(name);
if (ssize == 0)
fprintf(stderr, %s for %s\n, strerror(errno), name);
@@ -336,7 +336,7 @@ virstor_label(struct gctl_req *req)
 
for (i = 1; i  (unsigned)nargs; i++) {
snprintf(param, sizeof(param), arg%u, i);
-   name = gctl_get_ascii(req, param);
+   name = gctl_get_ascii(req, %s, param);
 
if (verbose)
printf( %s, name);
@@ -417,7 +417,7 @@ virstor_label(struct gctl_req *req)
/* Ok, store metadata. */
for (i = 1; i  (unsigned)nargs; i++) {
snprintf(param, sizeof(param), arg%u, i);
-   name = gctl_get_ascii(req, param);
+   name = gctl_get_ascii(req, %s, param);
 
msize = g_get_mediasize(name);
ssize = g_get_sectorsize(name);
@@ -434,7 +434,7 @@ virstor_label(struct gctl_req *req)
if (verbose)
printf((%u chunks) , md.chunk_count);
/* Check to make sure last sector is unused */
-   if ((off_t)(md.chunk_count * md.md_chunk_size)  msize-ssize)
+   if ((off_t)(md.chunk_count * md.md_chunk_size)  
(off_t)(msize-ssize))
md.chunk_count--;
md.chunk_next = 0;
if (i != 1) {
@@ -499,7 +499,7 @@ virstor_clear(struct gctl_req *req)
}
for (i = 0; i  (unsigned)nargs; i++) {
snprintf(param, sizeof(param), arg%u, i);
-   name = gctl_get_ascii(req, param);
+   name = gctl_get_ascii(req, %s, param);
 
error = g_metadata_clear(name, 

svn commit: r215705 - head/usr.bin/ldd

2010-11-22 Thread Bruce Cran
Author: brucec
Date: Mon Nov 22 20:18:46 2010
New Revision: 215705
URL: http://svn.freebsd.org/changeset/base/215705

Log:
  hdr.elf.e_ident[EI_OSABI] is not a bitmask so '==' should been used.
  
  Reported by: Artem Belevich fbsdlist at src.cx

Modified:
  head/usr.bin/ldd/ldd.c

Modified: head/usr.bin/ldd/ldd.c
==
--- head/usr.bin/ldd/ldd.c  Mon Nov 22 20:10:48 2010(r215704)
+++ head/usr.bin/ldd/ldd.c  Mon Nov 22 20:18:46 2010(r215705)
@@ -331,7 +331,7 @@ is_executable(const char *fname, int fd,
return (0);
}
if (hdr.elf32.e_type == ET_DYN) {
-   if (hdr.elf32.e_ident[EI_OSABI]  ELFOSABI_FREEBSD) {
+   if (hdr.elf32.e_ident[EI_OSABI] == ELFOSABI_FREEBSD) {
*is_shlib = 1;
return (1);
}
@@ -373,7 +373,7 @@ is_executable(const char *fname, int fd,
return (0);
}
if (hdr.elf.e_type == ET_DYN) {
-   if (hdr.elf.e_ident[EI_OSABI]  ELFOSABI_FREEBSD) {
+   if (hdr.elf.e_ident[EI_OSABI] == ELFOSABI_FREEBSD) {
*is_shlib = 1;
return (1);
}
___
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-unsubscr...@freebsd.org


svn commit: r215706 - head/sys/compat/linux

2010-11-22 Thread Dimitry Andric
Author: dim
Date: Mon Nov 22 20:23:18 2010
New Revision: 215706
URL: http://svn.freebsd.org/changeset/base/215706

Log:
  Fix linux kernel module breakage introduced in r215675, by including
  sys/sysent.h.
  
  Noticed by:   many
  Pointy hat to:netchild

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

Modified: head/sys/compat/linux/linux_emul.c
==
--- head/sys/compat/linux/linux_emul.c  Mon Nov 22 20:18:46 2010
(r215705)
+++ head/sys/compat/linux/linux_emul.c  Mon Nov 22 20:23:18 2010
(r215706)
@@ -41,6 +41,7 @@ __FBSDID($FreeBSD$);
 #include sys/sx.h
 #include sys/proc.h
 #include sys/syscallsubr.h
+#include sys/sysent.h
 #include sys/sysproto.h
 #include sys/unistd.h
 
___
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-unsubscr...@freebsd.org


svn commit: r215707 - head/sys/compat/ndis

2010-11-22 Thread Bernhard Schmidt
Author: bschmidt
Date: Mon Nov 22 20:39:29 2010
New Revision: 215707
URL: http://svn.freebsd.org/changeset/base/215707

Log:
  Prefer pmap_extract() over pmap_kextract() as done in MmIsAddressValid().
  According to the comment for MmIsAddressValid() there are issues on PAE
  kernels using pmap_kextract().
  
  Submitted by: Paul B Mahol onemda at gmail.com

Modified:
  head/sys/compat/ndis/subr_ntoskrnl.c

Modified: head/sys/compat/ndis/subr_ntoskrnl.c
==
--- head/sys/compat/ndis/subr_ntoskrnl.cMon Nov 22 20:23:18 2010
(r215706)
+++ head/sys/compat/ndis/subr_ntoskrnl.cMon Nov 22 20:39:29 2010
(r215707)
@@ -2544,6 +2544,12 @@ MmUnmapLockedPages(vaddr, buf)
  * here, but it doesn't.
  */
 
+static uint64_t
+MmGetPhysicalAddress(void *base)
+{
+   return (pmap_extract(kernel_map-pmap, (vm_offset_t)base));
+}
+
 uint8_t
 MmIsAddressValid(vaddr)
void*vaddr;
@@ -4241,12 +4247,12 @@ image_patch_table ntoskrnl_functbl[] = {
IMPORT_SFUNC(MmAllocateContiguousMemorySpecifyCache, 5 + 3),
IMPORT_SFUNC(MmFreeContiguousMemory, 1),
IMPORT_SFUNC(MmFreeContiguousMemorySpecifyCache, 3),
-   IMPORT_SFUNC_MAP(MmGetPhysicalAddress, pmap_kextract, 1),
IMPORT_SFUNC(MmSizeOfMdl, 1),
IMPORT_SFUNC(MmMapLockedPages, 2),
IMPORT_SFUNC(MmMapLockedPagesSpecifyCache, 6),
IMPORT_SFUNC(MmUnmapLockedPages, 2),
IMPORT_SFUNC(MmBuildMdlForNonPagedPool, 1),
+   IMPORT_SFUNC(MmGetPhysicalAddress, 1),
IMPORT_SFUNC(MmIsAddressValid, 1),
IMPORT_SFUNC(MmMapIoSpace, 3 + 1),
IMPORT_SFUNC(MmUnmapIoSpace, 2),
___
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-unsubscr...@freebsd.org


svn commit: r215708 - head/sys/compat/ndis

2010-11-22 Thread Bernhard Schmidt
Author: bschmidt
Date: Mon Nov 22 20:46:38 2010
New Revision: 215708
URL: http://svn.freebsd.org/changeset/base/215708

Log:
  Resurrect amd64 support.
  - Many drivers on amd64 are picking system uptime, interrupt time and ticks
via global data structure instead of calling functions for performance
reasons. For now just patch such address so driver will not trigger page
fault when trying to access such data. In future, additional callout may
be added to update data in periodic intervals.
  - On amd64 we need to allocate shadow space on stack before calling any
function.
  
  Submitted by: Paul B Mahol onemda at gmail.com

Modified:
  head/sys/compat/ndis/kern_windrv.c
  head/sys/compat/ndis/ntoskrnl_var.h
  head/sys/compat/ndis/subr_ntoskrnl.c
  head/sys/compat/ndis/winx64_wrap.S

Modified: head/sys/compat/ndis/kern_windrv.c
==
--- head/sys/compat/ndis/kern_windrv.c  Mon Nov 22 20:39:29 2010
(r215707)
+++ head/sys/compat/ndis/kern_windrv.c  Mon Nov 22 20:46:38 2010
(r215708)
@@ -311,6 +311,24 @@ windrv_unload(mod, img, len)
 
 #define WINDRV_LOADED  htonl(0x42534F44)
 
+#ifdef __amd64__
+static void
+patch_user_shared_data_address(vm_offset_t img, size_t len)
+{
+   unsigned long i, n, max_addr, *addr;
+
+   n = len - sizeof(unsigned long);
+   max_addr = KI_USER_SHARED_DATA + sizeof(kuser_shared_data);
+   for (i = 0; i  n; i++) {
+   addr = (unsigned long *)(img + i);
+   if (*addr = KI_USER_SHARED_DATA  *addr  max_addr) {
+   *addr -= KI_USER_SHARED_DATA;
+   *addr += (unsigned long)kuser_shared_data;
+   }
+   }
+}
+#endif
+
 /*
  * Loader routine for actual Windows driver modules, ultimately
  * calls the driver's DriverEntry() routine.
@@ -363,6 +381,10 @@ windrv_load(mod, img, len, bustype, devl
return (ENOEXEC);
}
 
+#ifdef __amd64__
+   patch_user_shared_data_address(img, len);
+#endif
+
/* Dynamically link USBD.SYS -- optional */
if (pe_get_import_descriptor(img, imp_desc, USBD) == 0) {
if (pe_patch_imports(img, USBD, usbd_functbl))

Modified: head/sys/compat/ndis/ntoskrnl_var.h
==
--- head/sys/compat/ndis/ntoskrnl_var.h Mon Nov 22 20:39:29 2010
(r215707)
+++ head/sys/compat/ndis/ntoskrnl_var.h Mon Nov 22 20:46:38 2010
(r215708)
@@ -605,6 +605,65 @@ struct kinterrupt {
 
 typedef struct kinterrupt kinterrupt;
 
+struct ksystem_time {
+   uint32_tlow_part;
+   int32_t high1_time;
+   int32_t high2_time;
+};
+
+enum nt_product_type {
+   NT_PRODUCT_WIN_NT = 1,
+   NT_PRODUCT_LAN_MAN_NT,
+   NT_PRODUCT_SERVER
+};
+
+enum alt_arch_type {
+   STANDARD_DESIGN,
+   NEC98x86,
+   END_ALTERNATIVES
+};
+
+struct kuser_shared_data {
+   uint32_ttick_count;
+   uint32_ttick_count_multiplier;
+   volatile struct ksystem_time interrupt_time;
+   volatile struct ksystem_time system_time;
+   volatile struct ksystem_time time_zone_bias;
+   uint16_timage_number_low;
+   uint16_timage_number_high;
+   int16_t nt_system_root[260];
+   uint32_tmax_stack_trace_depth;
+   uint32_tcrypto_exponent;
+   uint32_ttime_zone_id;
+   uint32_tlarge_page_min;
+   uint32_treserved2[7];
+   enum nt_product_typent_product_type;
+   uint8_t product_type_is_valid;
+   uint32_tnt_major_version;
+   uint32_tnt_minor_version;
+   uint8_t processor_features[64];
+   uint32_treserved1;
+   uint32_treserved3;
+   volatile uint32_t   time_slip;
+   enum alt_arch_type  alt_arch_type;
+   int64_t system_expiration_date;
+   uint32_tsuite_mask;
+   uint8_t kdbg_enabled;
+   volatile uint32_t   active_console;
+   volatile uint32_t   dismount_count;
+   uint32_tcom_plus_package;
+   uint32_tlast_system_rit_event_tick_count;
+   uint32_tnum_phys_pages;
+   uint8_t safe_boot_mode;
+   uint32_ttrace_log;
+   uint64_tfill0;
+   uint64_tsys_call[4];
+   union {
+   volatile struct ksystem_timetick_count;
+   volatile uint64_t   tick_count_quad;
+   } tick;
+};
+
 /*
  * In Windows, there are Physical Device Objects (PDOs) and
  * Functional Device Objects (FDOs). Physical Device Objects 

svn commit: r215709 - stable/8/sys/vm

2010-11-22 Thread Max Laier
Author: mlaier
Date: Mon Nov 22 20:50:40 2010
New Revision: 215709
URL: http://svn.freebsd.org/changeset/base/215709

Log:
  MFH r215508:
Off by one page in vm_reserv_reclaim_contig(): reclaim reservations with
only a single free page as well.
  
Reviewed by:alc

Modified:
  stable/8/sys/vm/vm_reserv.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/vm/vm_reserv.c
==
--- stable/8/sys/vm/vm_reserv.c Mon Nov 22 20:46:38 2010(r215708)
+++ stable/8/sys/vm/vm_reserv.c Mon Nov 22 20:50:40 2010(r215709)
@@ -659,7 +659,8 @@ vm_reserv_reclaim_contig(vm_paddr_t size
((pa ^ (pa + size - 1)) 
~(boundary - 1)) != 0)
pa_length = 0;
-   } else if (pa_length = size) {
+   }
+   if (pa_length = size) {
vm_reserv_reclaim(rv);
return (TRUE);
}
___
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-unsubscr...@freebsd.org


svn commit: r215711 - head/sys/dev/mii

2010-11-22 Thread Marius Strobl
Author: marius
Date: Mon Nov 22 20:57:44 2010
New Revision: 215711
URL: http://svn.freebsd.org/changeset/base/215711

Log:
  Add missing newlines.
  
  MFC after:3 days

Modified:
  head/sys/dev/mii/mii.c

Modified: head/sys/dev/mii/mii.c
==
--- head/sys/dev/mii/mii.c  Mon Nov 22 20:52:18 2010(r215710)
+++ head/sys/dev/mii/mii.c  Mon Nov 22 20:57:44 2010(r215711)
@@ -137,7 +137,7 @@ miibus_attach(device_t dev)
free(children, M_TEMP);
}
if (nchildren == 0) {
-   device_printf(dev, cannot get children);
+   device_printf(dev, cannot get children\n);
return (ENXIO);
}
ivars = device_get_ivars(dev);
@@ -311,12 +311,12 @@ mii_attach(device_t dev, device_t *miibu
int bmsr, first, i, nchildren, offset, phymax, phymin, rv;
 
if (phyloc != MII_PHY_ANY  offloc != MII_OFFSET_ANY) {
-   printf(%s: phyloc and offloc specified, __func__);
+   printf(%s: phyloc and offloc specified\n, __func__);
return (EINVAL);
}
 
if (offloc != MII_OFFSET_ANY  (offloc  0 || offloc = MII_NPHY)) {
-   printf(%s: ivalid offloc %d, __func__, offloc);
+   printf(%s: ivalid offloc %d\n, __func__, offloc);
return (EINVAL);
}
 
@@ -325,7 +325,7 @@ mii_attach(device_t dev, device_t *miibu
phymax = MII_NPHY - 1;
} else {
if (phyloc  0 || phyloc = MII_NPHY) {
-   printf(%s: ivalid phyloc %d, __func__, phyloc);
+   printf(%s: ivalid phyloc %d\n, __func__, phyloc);
return (EINVAL);
}
phymin = phymax = phyloc;
@@ -352,7 +352,7 @@ mii_attach(device_t dev, device_t *miibu
if (ivars-ifp != ifp || ivars-ifmedia_upd != ifmedia_upd ||
ivars-ifmedia_sts != ifmedia_sts ||
ivars-mii_flags != flags) {
-   printf(%s: non-matching invariant, __func__);
+   printf(%s: non-matching invariant\n, __func__);
return (EINVAL);
}
/*
___
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-unsubscr...@freebsd.org


Re: svn commit: r215708 - head/sys/compat/ndis

2010-11-22 Thread Xin LI
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

On 11/22/10 12:46, Bernhard Schmidt wrote:
 Author: bschmidt
 Date: Mon Nov 22 20:46:38 2010
 New Revision: 215708
 URL: http://svn.freebsd.org/changeset/base/215708
 
 Log:
   Resurrect amd64 support.
   - Many drivers on amd64 are picking system uptime, interrupt time and ticks
 via global data structure instead of calling functions for performance
 reasons. For now just patch such address so driver will not trigger page
 fault when trying to access such data. In future, additional callout may
 be added to update data in periodic intervals.
   - On amd64 we need to allocate shadow space on stack before calling any
 function.
   
   Submitted by:   Paul B Mahol onemda at gmail.com

Will this be MFC'ed?

Cheers,
- -- 
Xin LI delp...@delphij.nethttp://www.delphij.net/
FreeBSD - The Power to Serve!  Live free or die
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.16 (FreeBSD)

iQEcBAEBCAAGBQJM6tuoAAoJEATO+BI/yjfByfcH/15/qNeim1VF5aUK9h6LWPM0
04dB6K3fu3oKEUNY8bD/w06lZZzTPUW/VNrm+bA6/8gKNxP4MgJunty69kmR6tEG
xH67RPz/lVmCMU7zNFByFTGltZVSvyyxrsceD6ZylBaSChBV5UoKBMdDE6cOuPbR
D5V/yVxlwJaJkhtoRN/GbKlEyZkDs6pGmhzSRKOptr0n4PZjpiHVlXAxhlZkpILB
qITYNGvPjyL/3a3nKMz+eBVMqUofjPsDkmCvvApLQumL7FFSCvLGGHnfqe3Pl5Zq
nG5ajDia1wnD2nWdbsFoADv69+T3YYhB8wHwvQ/yGV+h+5NExKjovz4l7AZyEjg=
=gImO
-END PGP SIGNATURE-
___
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-unsubscr...@freebsd.org


svn commit: r215712 - stable/8/sys/compat/x86bios

2010-11-22 Thread Jung-uk Kim
Author: jkim
Date: Mon Nov 22 21:12:20 2010
New Revision: 215712
URL: http://svn.freebsd.org/changeset/base/215712

Log:
  Remove a stale file.  It seems this file was mis-merged from current.

Deleted:
  stable/8/sys/compat/x86bios/x86bios_alloc.c
___
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-unsubscr...@freebsd.org


svn commit: r215713 - head/sys/dev/mii

2010-11-22 Thread Marius Strobl
Author: marius
Date: Mon Nov 22 21:13:42 2010
New Revision: 215713
URL: http://svn.freebsd.org/changeset/base/215713

Log:
  Given that unlike f.e. rgephy(4) this driver doesn't explicitly start an
  autonegotiation along with manual media selection and ukphy_status() also
  only reports flow control status when BMCR_AUTOEN is set (at least with
  gentbi(4) determining the flow control status results in false-positives
  when not set), use MIIF_NOMANPAUSE.

Modified:
  head/sys/dev/mii/ukphy.c

Modified: head/sys/dev/mii/ukphy.c
==
--- head/sys/dev/mii/ukphy.cMon Nov 22 21:12:20 2010(r215712)
+++ head/sys/dev/mii/ukphy.cMon Nov 22 21:13:42 2010(r215713)
@@ -136,6 +136,8 @@ ukphy_attach(device_t dev)
sc-mii_service = ukphy_service;
sc-mii_pdata = mii;
 
+   sc-mii_flags |= MIIF_NOMANPAUSE;
+
mii_phy_reset(sc);
 
sc-mii_capabilities = PHY_READ(sc, MII_BMSR)  ma-mii_capmask;
___
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-unsubscr...@freebsd.org


svn commit: r215714 - head/sys/dev/mii

2010-11-22 Thread Marius Strobl
Author: marius
Date: Mon Nov 22 21:20:11 2010
New Revision: 215714
URL: http://svn.freebsd.org/changeset/base/215714

Log:
  Given that unlike f.e. rgephy(4) these drivers doen't explicitly start an
  autonegotiation along with manual media selection and also only report flow
  control status when BMCR_AUTOEN is set (at least with gentbi(4) determining
  the flow control status results in false-positives when not set), use
  MIIF_NOMANPAUSE.

Modified:
  head/sys/dev/mii/gentbi.c
  head/sys/dev/mii/nsgphy.c

Modified: head/sys/dev/mii/gentbi.c
==
--- head/sys/dev/mii/gentbi.c   Mon Nov 22 21:13:42 2010(r215713)
+++ head/sys/dev/mii/gentbi.c   Mon Nov 22 21:20:11 2010(r215714)
@@ -172,6 +172,8 @@ gentbi_attach(device_t dev)
sc-mii_service = gentbi_service;
sc-mii_pdata = mii;
 
+   sc-mii_flags |= MIIF_NOMANPAUSE;
+
mii_phy_reset(sc);
 
/*

Modified: head/sys/dev/mii/nsgphy.c
==
--- head/sys/dev/mii/nsgphy.c   Mon Nov 22 21:13:42 2010(r215713)
+++ head/sys/dev/mii/nsgphy.c   Mon Nov 22 21:20:11 2010(r215714)
@@ -135,6 +135,8 @@ nsgphy_attach(device_t dev)
sc-mii_service = nsgphy_service;
sc-mii_pdata = mii;
 
+   sc-mii_flags |= MIIF_NOMANPAUSE;
+
mii_phy_reset(sc);
 
/*
___
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-unsubscr...@freebsd.org


svn commit: r215715 - stable/7/sys/vm

2010-11-22 Thread Max Laier
Author: mlaier
Date: Mon Nov 22 21:22:08 2010
New Revision: 215715
URL: http://svn.freebsd.org/changeset/base/215715

Log:
  MFH r215508:
Off by one page in vm_reserv_reclaim_contig(): reclaim reservations with
only a single free page as well.
  
Reviewed by:alc

Modified:
  stable/7/sys/vm/vm_reserv.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/vm/vm_reserv.c
==
--- stable/7/sys/vm/vm_reserv.c Mon Nov 22 21:20:11 2010(r215714)
+++ stable/7/sys/vm/vm_reserv.c Mon Nov 22 21:22:08 2010(r215715)
@@ -659,7 +659,8 @@ vm_reserv_reclaim_contig(vm_paddr_t size
((pa ^ (pa + size - 1)) 
~(boundary - 1)) != 0)
pa_length = 0;
-   } else if (pa_length = size) {
+   }
+   if (pa_length = size) {
vm_reserv_reclaim(rv);
return (TRUE);
}
___
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-unsubscr...@freebsd.org


svn commit: r215716 - head/sys/dev/mii

2010-11-22 Thread Marius Strobl
Author: marius
Date: Mon Nov 22 21:24:29 2010
New Revision: 215716
URL: http://svn.freebsd.org/changeset/base/215716

Log:
  Add support for flow control.
  
  Obtained from:NetBSD (partially)

Modified:
  head/sys/dev/mii/bmtphy.c
  head/sys/dev/mii/inphy.c
  head/sys/dev/mii/nsphyter.c

Modified: head/sys/dev/mii/bmtphy.c
==
--- head/sys/dev/mii/bmtphy.c   Mon Nov 22 21:22:08 2010(r215715)
+++ head/sys/dev/mii/bmtphy.c   Mon Nov 22 21:24:29 2010(r215716)
@@ -153,6 +153,8 @@ bmtphy_attach(device_t dev)
sc-mii_service = bmtphy_service;
sc-mii_pdata = mii;
 
+   sc-mii_flags |= MIIF_NOMANPAUSE;
+
mii_phy_reset(sc);
 
sc-mii_capabilities = PHY_READ(sc, MII_BMSR)  ma-mii_capmask;
@@ -243,7 +245,8 @@ bmtphy_status(struct mii_softc *sc)
else
mii-mii_media_active |= IFM_10_T;
if (aux_csr  AUX_CSR_FDX)
-   mii-mii_media_active |= IFM_FDX;
+   mii-mii_media_active |=
+   IFM_FDX | mii_phy_flowstatus(sc);
else
mii-mii_media_active |= IFM_HDX;
} else

Modified: head/sys/dev/mii/inphy.c
==
--- head/sys/dev/mii/inphy.cMon Nov 22 21:22:08 2010(r215715)
+++ head/sys/dev/mii/inphy.cMon Nov 22 21:24:29 2010(r215716)
@@ -113,6 +113,8 @@ inphy_attach(device_t dev)
sc-mii_service = inphy_service;
sc-mii_pdata = mii;
 
+   sc-mii_flags |= MIIF_NOMANPAUSE;
+
ifmedia_add(mii-mii_media,
IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc-mii_inst),
MII_MEDIA_100_TX, NULL);
@@ -197,7 +199,8 @@ inphy_status(struct mii_softc *sc)
else
mii-mii_media_active |= IFM_10_T;
if (scr  SCR_FDX)
-   mii-mii_media_active |= IFM_FDX;
+   mii-mii_media_active |=
+   IFM_FDX | mii_phy_flowstatus(sc);
else
mii-mii_media_active |= IFM_HDX;
} else

Modified: head/sys/dev/mii/nsphyter.c
==
--- head/sys/dev/mii/nsphyter.c Mon Nov 22 21:22:08 2010(r215715)
+++ head/sys/dev/mii/nsphyter.c Mon Nov 22 21:24:29 2010(r215716)
@@ -143,6 +143,8 @@ nsphyter_attach(device_t dev)
sc-mii_service = nsphyter_service;
sc-mii_pdata = mii;
 
+   sc-mii_flags |= MIIF_NOMANPAUSE;
+
 #if 1
 
 #defineADD(m, c)   ifmedia_add(mii-mii_media, (m), (c), NULL)
@@ -242,12 +244,8 @@ nsphyter_status(struct mii_softc *sc)
else
mii-mii_media_active |= IFM_100_TX;
if ((physts  PHYSTS_DUPLEX) != 0)
-#ifdef notyet
mii-mii_media_active |=
IFM_FDX | mii_phy_flowstatus(sc);
-#else
-   mii-mii_media_active |= IFM_FDX;
-#endif
else
mii-mii_media_active |= IFM_HDX;
} else
___
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-unsubscr...@freebsd.org


Re: svn commit: r215708 - head/sys/compat/ndis

2010-11-22 Thread Bernhard Schmidt
On Monday 22 November 2010 22:07:52 Xin LI wrote:
 On 11/22/10 12:46, Bernhard Schmidt wrote:
  Author: bschmidt
  Date: Mon Nov 22 20:46:38 2010
  New Revision: 215708
  URL: http://svn.freebsd.org/changeset/base/215708
 
  Log:
Resurrect amd64 support.
- Many drivers on amd64 are picking system uptime, interrupt time and
  ticks via global data structure instead of calling functions for
  performance reasons. For now just patch such address so driver will not
  trigger page fault when trying to access such data. In future, additional
  callout may be added to update data in periodic intervals.
- On amd64 we need to allocate shadow space on stack before calling
  any function.
 
Submitted by: Paul B Mahol onemda at gmail.com
 
 Will this be MFC'ed?

I hope I can squeeze it in before the freeze, so yes. Given the current state 
of ndis on amd64 it definitely won't make things worse.

-- 
Bernhard
___
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-unsubscr...@freebsd.org


svn commit: r215717 - head/usr.sbin/kernbb

2010-11-22 Thread Ulrich Spoerlein
Author: uqs
Date: Mon Nov 22 21:39:35 2010
New Revision: 215717
URL: http://svn.freebsd.org/changeset/base/215717

Log:
  Remove kernbb(8) from the source tree.
  
  It's been broken for several years and with all the binutils/toolchain
  changes in flight, it might make more sense to put efforts into dtrace and
  hwpmc instead.
  
  Discussed with:   phk
  PR:   bin/83558

Deleted:
  head/usr.sbin/kernbb/
___
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-unsubscr...@freebsd.org


svn commit: r215719 - head/sys/dev/pci

2010-11-22 Thread Jung-uk Kim
Author: jkim
Date: Mon Nov 22 21:58:00 2010
New Revision: 215719
URL: http://svn.freebsd.org/changeset/base/215719

Log:
  Resume critical PCI devices (and their children) first, then everything else
  later.  This give us better chance to catch device driver problems.

Modified:
  head/sys/dev/pci/pci.c

Modified: head/sys/dev/pci/pci.c
==
--- head/sys/dev/pci/pci.c  Mon Nov 22 21:43:45 2010(r215718)
+++ head/sys/dev/pci/pci.c  Mon Nov 22 21:58:00 2010(r215719)
@@ -3022,8 +3022,35 @@ pci_resume(device_t dev)
if (!device_is_attached(child))
pci_cfg_save(child, dinfo, 1);
}
+
+   /*
+* Resume critical devices first, then everything else later.
+*/
+   for (i = 0; i  numdevs; i++) {
+   child = devlist[i];
+   switch (pci_get_class(child)) {
+   case PCIC_DISPLAY:
+   case PCIC_MEMORY:
+   case PCIC_BRIDGE:
+   case PCIC_BASEPERIPH:
+   DEVICE_RESUME(child);
+   break;
+   }
+   }
+   for (i = 0; i  numdevs; i++) {
+   child = devlist[i];
+   switch (pci_get_class(child)) {
+   case PCIC_DISPLAY:
+   case PCIC_MEMORY:
+   case PCIC_BRIDGE:
+   case PCIC_BASEPERIPH:
+   break;
+   default:
+   DEVICE_RESUME(child);
+   }
+   }
free(devlist, M_TEMP);
-   return (bus_generic_resume(dev));
+   return (0);
 }
 
 static void
___
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-unsubscr...@freebsd.org


svn commit: r215720 - head/sys/dev/mii

2010-11-22 Thread Marius Strobl
Author: marius
Date: Mon Nov 22 22:03:11 2010
New Revision: 215720
URL: http://svn.freebsd.org/changeset/base/215720

Log:
  - Also probe BCM5214 and BCM5222.
  - Add some DSP init code for BCM5221. The values derived from Apple's GMAC
driver and the same init code also exists in Linux's sungem_phy driver.
  - Only read media status bits when they are valid.
  
  Obtained from:NetBSD, OpenBSD

Modified:
  head/sys/dev/mii/bmtphy.c
  head/sys/dev/mii/miidevs

Modified: head/sys/dev/mii/bmtphy.c
==
--- head/sys/dev/mii/bmtphy.c   Mon Nov 22 21:58:00 2010(r215719)
+++ head/sys/dev/mii/bmtphy.c   Mon Nov 22 22:03:11 2010(r215720)
@@ -85,6 +85,11 @@ __FBSDID($FreeBSD$);
 static int bmtphy_probe(device_t);
 static int bmtphy_attach(device_t);
 
+struct bmtphy_softc {
+   struct mii_softc mii_sc;
+   int mii_model;
+};
+
 static device_method_t bmtphy_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, bmtphy_probe),
@@ -100,18 +105,21 @@ static devclass_t bmtphy_devclass;
 static driver_tbmtphy_driver = {
bmtphy,
bmtphy_methods,
-   sizeof(struct mii_softc)
+   sizeof(struct bmtphy_softc)
 };
 
 DRIVER_MODULE(bmtphy, miibus, bmtphy_driver, bmtphy_devclass, 0, 0);
 
 static int bmtphy_service(struct mii_softc *, struct mii_data *, int);
 static voidbmtphy_status(struct mii_softc *);
+static voidbmtphy_reset(struct mii_softc *);
 
 static const struct mii_phydesc bmtphys_dp[] = {
MII_PHY_DESC(BROADCOM, BCM4401),
MII_PHY_DESC(BROADCOM, BCM5201),
+   MII_PHY_DESC(BROADCOM, BCM5214),
MII_PHY_DESC(BROADCOM, BCM5221),
+   MII_PHY_DESC(BROADCOM, BCM5222),
MII_PHY_END
 };
 
@@ -137,11 +145,13 @@ bmtphy_probe(device_t dev)
 static int
 bmtphy_attach(device_t dev)
 {
-   struct  mii_softc *sc;
-   struct  mii_attach_args *ma;
-   struct  mii_data *mii;
+   struct bmtphy_softc *bsc;
+   struct mii_softc *sc;
+   struct mii_attach_args *ma;
+   struct mii_data *mii;
 
-   sc = device_get_softc(dev);
+   bsc = device_get_softc(dev);
+   sc = bsc-mii_sc;
ma = device_get_ivars(dev);
sc-mii_dev = device_get_parent(dev);
mii = ma-mii_data;
@@ -155,7 +165,9 @@ bmtphy_attach(device_t dev)
 
sc-mii_flags |= MIIF_NOMANPAUSE;
 
-   mii_phy_reset(sc);
+   bsc-mii_model = MII_MODEL(ma-mii_id2);
+
+   bmtphy_reset(sc);
 
sc-mii_capabilities = PHY_READ(sc, MII_BMSR)  ma-mii_capmask;
device_printf(dev,  );
@@ -196,16 +208,15 @@ bmtphy_service(struct mii_softc *sc, str
 
/* Callback if something changed. */
mii_phy_update(sc, cmd);
-
return (0);
 }
 
 static void
 bmtphy_status(struct mii_softc *sc)
 {
-   struct  mii_data *mii;
-   struct  ifmedia_entry *ife;
-   int bmsr, bmcr, aux_csr;
+   struct mii_data *mii;
+   struct ifmedia_entry *ife;
+   int bmsr, bmcr, aux_csr;
 
mii = sc-mii_pdata;
ife = mii-mii_media.ifm_cur;
@@ -214,7 +225,6 @@ bmtphy_status(struct mii_softc *sc)
mii-mii_media_active = IFM_ETHER;
 
bmsr = PHY_READ(sc, MII_BMSR) | PHY_READ(sc, MII_BMSR);
-   aux_csr = PHY_READ(sc, MII_BMTPHY_AUX_CSR);
 
if (bmsr  BMSR_LINK)
mii-mii_media_status |= IFM_ACTIVE;
@@ -240,6 +250,7 @@ bmtphy_status(struct mii_softc *sc)
return;
}
 
+   aux_csr = PHY_READ(sc, MII_BMTPHY_AUX_CSR);
if (aux_csr  AUX_CSR_SPEED)
mii-mii_media_active |= IFM_100_TX;
else
@@ -252,3 +263,32 @@ bmtphy_status(struct mii_softc *sc)
} else
mii-mii_media_active = ife-ifm_media;
 }
+
+static void
+bmtphy_reset(struct mii_softc *sc)
+{
+   struct bmtphy_softc *bsc;
+   u_int16_t data;
+
+   bsc = (struct bmtphy_softc *)sc;
+
+   mii_phy_reset(sc);
+
+   if (bsc-mii_model == MII_MODEL_BROADCOM_BCM5221) {
+   /* Enable shadow register mode. */
+   data = PHY_READ(sc, 0x1f);
+   PHY_WRITE(sc, 0x1f, data | 0x0080);
+
+   /* Enable APD (Auto PowerDetect). */
+   data = PHY_READ(sc, MII_BMTPHY_AUX2);
+   PHY_WRITE(sc, MII_BMTPHY_AUX2, data | 0x0020);
+
+   /* Enable clocks across APD for Auto-MDIX functionality. */
+   data = PHY_READ(sc, MII_BMTPHY_INTR);
+   PHY_WRITE(sc, MII_BMTPHY_INTR, data | 0x0004);
+
+   /* Disable shadow register mode. */
+   data = PHY_READ(sc, 0x1f);
+   PHY_WRITE(sc, 0x1f, data  ~0x0080);
+   }
+}

Modified: head/sys/dev/mii/miidevs
==
--- head/sys/dev/mii/miidevsMon Nov 22 21:58:00 2010(r215719)
+++ 

Re: svn commit: r215717 - head/usr.sbin/kernbb

2010-11-22 Thread Alexander Best
On Mon Nov 22 10, Ulrich Spoerlein wrote:
 Author: uqs
 Date: Mon Nov 22 21:39:35 2010
 New Revision: 215717
 URL: http://svn.freebsd.org/changeset/base/215717
 
 Log:
   Remove kernbb(8) from the source tree.
   
   It's been broken for several years and with all the binutils/toolchain
   changes in flight, it might make more sense to put efforts into dtrace and
   hwpmc instead.

thanks. :)

what about the BB-profiling sections in
sys/{amd64,i386}/{amd64,i386}/support.S? do they need to stay?

cheers.
alex

   
   Discussed with: phk
   PR: bin/83558
 
 Deleted:
   head/usr.sbin/kernbb/

-- 
a13x
___
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-unsubscr...@freebsd.org


svn commit: r215721 - head/sys/dev/cas

2010-11-22 Thread Marius Strobl
Author: marius
Date: Mon Nov 22 22:06:30 2010
New Revision: 215721
URL: http://svn.freebsd.org/changeset/base/215721

Log:
  - Fix and enable support for flow control.
  - Fix compilation with CAS_DEBUG defined.

Modified:
  head/sys/dev/cas/if_cas.c

Modified: head/sys/dev/cas/if_cas.c
==
--- head/sys/dev/cas/if_cas.c   Mon Nov 22 22:03:11 2010(r215720)
+++ head/sys/dev/cas/if_cas.c   Mon Nov 22 22:06:30 2010(r215721)
@@ -346,7 +346,7 @@ cas_attach(struct cas_softc *sc)
}
error = mii_attach(sc-sc_dev, sc-sc_miibus, ifp,
cas_mediachange, cas_mediastatus, BMSR_DEFCAPMASK,
-   MII_PHY_ANY, MII_OFFSET_ANY, 0);
+   MII_PHY_ANY, MII_OFFSET_ANY, MIIF_DOPAUSE);
}
/*
 * Fall back on an internal PHY if no external PHY was found.
@@ -366,7 +366,7 @@ cas_attach(struct cas_softc *sc)
}
error = mii_attach(sc-sc_dev, sc-sc_miibus, ifp,
cas_mediachange, cas_mediastatus, BMSR_DEFCAPMASK,
-   MII_PHY_ANY, MII_OFFSET_ANY, 0);
+   MII_PHY_ANY, MII_OFFSET_ANY, MIIF_DOPAUSE);
}
} else {
/*
@@ -388,7 +388,7 @@ cas_attach(struct cas_softc *sc)
BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
error = mii_attach(sc-sc_dev, sc-sc_miibus, ifp,
cas_mediachange, cas_mediastatus, BMSR_DEFCAPMASK,
-   CAS_PHYAD_EXTERNAL, MII_OFFSET_ANY, 0);
+   CAS_PHYAD_EXTERNAL, MII_OFFSET_ANY, MIIF_DOPAUSE);
}
if (error != 0) {
device_printf(sc-sc_dev, attaching PHYs failed\n);
@@ -1093,8 +1093,7 @@ cas_init_locked(struct cas_softc *sc)
 
/* Set the PAUSE thresholds.  We use the maximum OFF threshold. */
CAS_WRITE_4(sc, CAS_RX_PTHRS,
-   ((111 * 64)  CAS_RX_PTHRS_XOFF_SHFT) |
-   ((15 * 64)  CAS_RX_PTHRS_XON_SHFT));
+   (111  CAS_RX_PTHRS_XOFF_SHFT) | (15  CAS_RX_PTHRS_XON_SHFT));
 
/* RX blanking */
CAS_WRITE_4(sc, CAS_RX_BLANK,
@@ -1339,7 +1338,7 @@ cas_init_regs(struct cas_softc *sc)
CAS_WRITE_4(sc, CAS_MAC_PREAMBLE_LEN, 0x7);
CAS_WRITE_4(sc, CAS_MAC_JAM_SIZE, 0x4);
CAS_WRITE_4(sc, CAS_MAC_ATTEMPT_LIMIT, 0x10);
-   CAS_WRITE_4(sc, CAS_MAC_CTRL_TYPE, 0x8088);
+   CAS_WRITE_4(sc, CAS_MAC_CTRL_TYPE, 0x8808);
 
/* random number seed */
CAS_WRITE_4(sc, CAS_MAC_RANDOM_SEED,
@@ -1572,11 +1571,11 @@ cas_tint(struct cas_softc *sc)
}
 
 #ifdef CAS_DEBUG
-   CTR4(KTR_CAS, %s: CAS_TX_STATE_MACHINE %x CAS_TX_DESC_BASE %llx 
+   CTR5(KTR_CAS, %s: CAS_TX_SM1 %x CAS_TX_SM2 %x CAS_TX_DESC_BASE %llx 
CAS_TX_COMP3 %x,
-   __func__, CAS_READ_4(sc, CAS_TX_STATE_MACHINE),
-   ((long long)CAS_READ_4(sc, CAS_TX_DESC_BASE_HI3)  32) |
-   CAS_READ_4(sc, CAS_TX_DESC_BASE_LO3),
+   __func__, CAS_READ_4(sc, CAS_TX_SM1), CAS_READ_4(sc, CAS_TX_SM2),
+   ((long long)CAS_READ_4(sc, CAS_TX_DESC3_BASE_HI)  32) |
+   CAS_READ_4(sc, CAS_TX_DESC3_BASE_LO),
CAS_READ_4(sc, CAS_TX_COMP3));
 #endif
 
@@ -1638,7 +1637,7 @@ cas_rint(struct cas_softc *sc)
rxhead = CAS_READ_4(sc, CAS_RX_COMP_HEAD);
 #ifdef CAS_DEBUG
CTR4(KTR_CAS, %s: sc-sc_rxcptr %d, sc-sc_rxdptr %d, head %d,
-   __func__, sc-rxcptr, sc-sc_rxdptr, rxhead);
+   __func__, sc-sc_rxcptr, sc-sc_rxdptr, rxhead);
 #endif
skip = 0;
CAS_CDSYNC(sc, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
@@ -1865,7 +1864,7 @@ cas_rint(struct cas_softc *sc)
 
 #ifdef CAS_DEBUG
CTR4(KTR_CAS, %s: done sc-sc_rxcptr %d, sc-sc_rxdptr %d, head %d,
-   __func__, sc-rxcptr, sc-sc_rxdptr,
+   __func__, sc-sc_rxcptr, sc-sc_rxdptr,
CAS_READ_4(sc, CAS_RX_COMP_HEAD));
 #endif
 }
@@ -1988,7 +1987,7 @@ cas_intr_task(void *arg, int pending __u
 #ifdef CAS_DEBUG
CTR4(KTR_CAS, %s: %s: cplt %x, status %x,
device_get_name(sc-sc_dev), __func__,
-   (status  CAS_STATUS_TX_COMP3_SHIFT), (u_int)status);
+   (status  CAS_STATUS_TX_COMP3_SHFT), (u_int)status);
 
/*
 * PCS interrupts must be cleared, otherwise no traffic is passed!
@@ -2100,15 +2099,15 @@ cas_watchdog(struct cas_softc *sc)
 
 #ifdef CAS_DEBUG
CTR4(KTR_CAS,
-   %s: CAS_RX_CONFIG %x CAS_MAC_RX_STATUS %x CAS_MAC_RX_CONFIG %x,
-   __func__, CAS_READ_4(sc, CAS_RX_CONFIG),
+   %s: CAS_RX_CONF %x CAS_MAC_RX_STATUS %x CAS_MAC_RX_CONF %x,
+   __func__, CAS_READ_4(sc, CAS_RX_CONF),
CAS_READ_4(sc, CAS_MAC_RX_STATUS),
-   CAS_READ_4(sc, 

svn commit: r215722 - head/sys/dev/gem

2010-11-22 Thread Marius Strobl
Author: marius
Date: Mon Nov 22 22:13:26 2010
New Revision: 215722
URL: http://svn.freebsd.org/changeset/base/215722

Log:
  - Fix and enable support for flow control.
  - Partially revert r172334; as it turns out the DELAYs in gem_reset_{r,t}x()
are actually necessary although bus space barriers and gem_bitwait() are
used, otherwise the controller may trigger an IOMMU errors on at least
sparc64. This is in line with what Linux and OpenSolaris do.

Modified:
  head/sys/dev/gem/if_gem.c

Modified: head/sys/dev/gem/if_gem.c
==
--- head/sys/dev/gem/if_gem.c   Mon Nov 22 22:06:30 2010(r215721)
+++ head/sys/dev/gem/if_gem.c   Mon Nov 22 22:13:26 2010(r215722)
@@ -302,7 +302,7 @@ gem_attach(struct gem_softc *sc)
}
error = mii_attach(sc-sc_dev, sc-sc_miibus, ifp,
gem_mediachange, gem_mediastatus, BMSR_DEFCAPMASK, phy,
-   MII_OFFSET_ANY, 0);
+   MII_OFFSET_ANY, MIIF_DOPAUSE);
}
 
/*
@@ -330,7 +330,7 @@ gem_attach(struct gem_softc *sc)
}
error = mii_attach(sc-sc_dev, sc-sc_miibus, ifp,
gem_mediachange, gem_mediastatus, BMSR_DEFCAPMASK, phy,
-   MII_OFFSET_ANY, 0);
+   MII_OFFSET_ANY, MIIF_DOPAUSE);
}
 
/*
@@ -352,7 +352,7 @@ gem_attach(struct gem_softc *sc)
sc-sc_flags |= GEM_SERDES;
error = mii_attach(sc-sc_dev, sc-sc_miibus, ifp,
gem_mediachange, gem_mediastatus, BMSR_DEFCAPMASK,
-   GEM_PHYAD_EXTERNAL, MII_OFFSET_ANY, 0);
+   GEM_PHYAD_EXTERNAL, MII_OFFSET_ANY, MIIF_DOPAUSE);
}
if (error != 0) {
device_printf(sc-sc_dev, attaching PHYs failed\n);
@@ -712,6 +712,9 @@ gem_reset_rx(struct gem_softc *sc)
if (!GEM_BANK1_BITWAIT(sc, GEM_RX_CONFIG, GEM_RX_CONFIG_RXDMA_EN, 0))
device_printf(sc-sc_dev, cannot disable RX DMA\n);
 
+   /* Wait 5ms extra. */
+   DELAY(5000);
+
/* Finally, reset the ERX. */
GEM_BANK2_WRITE_4(sc, GEM_RESET, GEM_RESET_RX);
GEM_BANK2_BARRIER(sc, GEM_RESET, 4,
@@ -784,6 +787,9 @@ gem_reset_tx(struct gem_softc *sc)
if (!GEM_BANK1_BITWAIT(sc, GEM_TX_CONFIG, GEM_TX_CONFIG_TXDMA_EN, 0))
device_printf(sc-sc_dev, cannot disable TX DMA\n);
 
+   /* Wait 5ms extra. */
+   DELAY(5000);
+
/* Finally, reset the ETX. */
GEM_BANK2_WRITE_4(sc, GEM_RESET, GEM_RESET_TX);
GEM_BANK2_BARRIER(sc, GEM_RESET, 4,
@@ -1239,7 +1245,7 @@ gem_init_regs(struct gem_softc *sc)
GEM_BANK1_WRITE_4(sc, GEM_MAC_PREAMBLE_LEN, 0x7);
GEM_BANK1_WRITE_4(sc, GEM_MAC_JAM_SIZE, 0x4);
GEM_BANK1_WRITE_4(sc, GEM_MAC_ATTEMPT_LIMIT, 0x10);
-   GEM_BANK1_WRITE_4(sc, GEM_MAC_CONTROL_TYPE, 0x8088);
+   GEM_BANK1_WRITE_4(sc, GEM_MAC_CONTROL_TYPE, 0x8808);
 
/* random number seed */
GEM_BANK1_WRITE_4(sc, GEM_MAC_RANDOM_SEED,
@@ -2039,14 +2045,12 @@ gem_mii_statchg(device_t dev)
 
v = GEM_BANK1_READ_4(sc, GEM_MAC_CONTROL_CONFIG) 
~(GEM_MAC_CC_RX_PAUSE | GEM_MAC_CC_TX_PAUSE);
-#ifdef notyet
if ((IFM_OPTIONS(sc-sc_mii-mii_media_active) 
IFM_ETH_RXPAUSE) != 0)
v |= GEM_MAC_CC_RX_PAUSE;
if ((IFM_OPTIONS(sc-sc_mii-mii_media_active) 
IFM_ETH_TXPAUSE) != 0)
v |= GEM_MAC_CC_TX_PAUSE;
-#endif
GEM_BANK1_WRITE_4(sc, GEM_MAC_CONTROL_CONFIG, v);
 
if ((IFM_OPTIONS(sc-sc_mii-mii_media_active)  IFM_FDX) == 0 
___
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-unsubscr...@freebsd.org


Re: svn commit: r215434 - in head: sys/netinet usr.bin/netstat

2010-11-22 Thread Bruce Cran
On Wed, 17 Nov 2010 18:55:13 + (UTC)
George V. Neville-Neil g...@freebsd.org wrote:

 Author: gnn
 Date: Wed Nov 17 18:55:12 2010
 New Revision: 215434
 URL: http://svn.freebsd.org/changeset/base/215434
 
 Log:
   Add new, per connection, statistics for TCP, including:
   Retransmitted Packets
   Zero Window Advertisements
   Out of Order Receives

I don't know if it was this checkin that broke it, but netstat now
fails to print a newline between the headers and the first line of
connection data.

-- 
Bruce Cran
___
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-unsubscr...@freebsd.org


svn commit: r215723 - stable/8/sys/netinet/libalias

2010-11-22 Thread Nick Hibma
Author: n_hibma
Date: Mon Nov 22 22:41:43 2010
New Revision: 215723
URL: http://svn.freebsd.org/changeset/base/215723

Log:
  MFC r214754:
  
  Don't spam the console with 'Loading alias module' messages.
  
  This cannot be hidden behind 'bootverbose' as this file is included from
  userland.

Modified:
  stable/8/sys/netinet/libalias/alias.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/netinet/libalias/alias.c
==
--- stable/8/sys/netinet/libalias/alias.c   Mon Nov 22 22:13:26 2010
(r215722)
+++ stable/8/sys/netinet/libalias/alias.c   Mon Nov 22 22:41:43 2010
(r215723)
@@ -1665,7 +1665,6 @@ LibAliasRefreshModules(void)
if (buf[i] == '#')
continue;
buf[len - 1] = '\0';
-   printf(Loading %s\n, buf);
LibAliasLoadModule(buf);
}
}
___
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-unsubscr...@freebsd.org


svn commit: r215724 - head/usr.bin/netstat

2010-11-22 Thread George V. Neville-Neil
Author: gnn
Date: Mon Nov 22 22:55:43 2010
New Revision: 215724
URL: http://svn.freebsd.org/changeset/base/215724

Log:
  Restore the (state) and \n printout when not using -T.
  
  Pointed out by:   brucec@
  MFC after:3 weeks

Modified:
  head/usr.bin/netstat/inet.c

Modified: head/usr.bin/netstat/inet.c
==
--- head/usr.bin/netstat/inet.c Mon Nov 22 22:41:43 2010(r215723)
+++ head/usr.bin/netstat/inet.c Mon Nov 22 22:55:43 2010(r215724)
@@ -428,13 +428,14 @@ protopr(u_long off, const char *name, in
   2msl, delack, rcvtime,
   (state));
}
-   if (!xflag  !Tflag) 
+   if (!xflag  !Tflag) {
printf((Aflag  !Wflag) ? 
   %-5.5s %-6.6s %-6.6s  %-18.18s 
%-18.18s :
   %-5.5s %-6.6s %-6.6s  %-22.22s 
%-22.22s,
   Proto, Recv-Q, Send-Q,
   Local Address, Foreign Address);
-
+   printf((state)\n);
+   }
first = 0;
}
if (Lflag  so-so_qlimit == 0)
___
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-unsubscr...@freebsd.org


svn commit: r215725 - head/sys/dev/ahci

2010-11-22 Thread Alexander Motin
Author: mav
Date: Mon Nov 22 23:04:25 2010
New Revision: 215725
URL: http://svn.freebsd.org/changeset/base/215725

Log:
  Fix small typo.
  
  Submitted by: Artem Belevich

Modified:
  head/sys/dev/ahci/ahci.c

Modified: head/sys/dev/ahci/ahci.c
==
--- head/sys/dev/ahci/ahci.cMon Nov 22 22:55:43 2010(r215724)
+++ head/sys/dev/ahci/ahci.cMon Nov 22 23:04:25 2010(r215725)
@@ -858,7 +858,7 @@ ahci_ch_attach(device_t dev)
ch-caps = ctlr-caps;
ch-caps2 = ctlr-caps2;
ch-quirks = ctlr-quirks;
-   ch-numslots = ((ch-caps  AHCI_CAP_NCS)  AHCI_CAP_NCS_SHIFT) + 1,
+   ch-numslots = ((ch-caps  AHCI_CAP_NCS)  AHCI_CAP_NCS_SHIFT) + 1;
mtx_init(ch-mtx, AHCI channel lock, NULL, MTX_DEF);
resource_int_value(device_get_name(dev),
device_get_unit(dev), pm_level, ch-pm_level);
___
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-unsubscr...@freebsd.org


svn commit: r215726 - head/sys/net

2010-11-22 Thread Marko Zec
Author: zec
Date: Mon Nov 22 23:35:29 2010
New Revision: 215726
URL: http://svn.freebsd.org/changeset/base/215726

Log:
  Allow for vlan(4) ifnets to have overlapping unit numbers if they are
  created in separated vnets.  As a side-effect of having a separated
  if_cloner instance for each vnet, all vlan ifnets created in a vnet
  will be automatically destroyed when vnet teardown is initiated.
  
  Disallow SIOCSETVLAN and SIOCGETVLAN ioctls on vlan ifnets which are
  associated with physical ifnets residing in parent vnets.
  
  This is an interim vlan-specific solution which will be superseded by a
  more generic if_cloner V_irtualization change from p4.  For nooptions
  VIMAGE builds, this should be a no-op change.
  
  Discussed with:   bz
  MFC after:3 days

Modified:
  head/sys/net/if_vlan.c

Modified: head/sys/net/if_vlan.c
==
--- head/sys/net/if_vlan.c  Mon Nov 22 23:04:25 2010(r215725)
+++ head/sys/net/if_vlan.c  Mon Nov 22 23:35:29 2010(r215726)
@@ -206,6 +206,11 @@ static  void vlan_iflladdr(void *arg, st
 static struct if_clone vlan_cloner = IFC_CLONE_INITIALIZER(VLANNAME, NULL,
 IF_MAXUNIT, NULL, vlan_clone_match, vlan_clone_create, vlan_clone_destroy);
 
+#ifdef VIMAGE
+static VNET_DEFINE(struct if_clone, vlan_cloner);
+#defineV_vlan_cloner   VNET(vlan_cloner)
+#endif
+
 #ifndef VLAN_ARRAY
 #define HASH(n, m) n)  8) ^ ((n)  4) ^ (n))  (m))
 
@@ -588,7 +593,9 @@ vlan_modevent(module_t mod, int type, vo
vlan_input_p = vlan_input;
vlan_link_state_p = vlan_link_state;
vlan_trunk_cap_p = vlan_trunk_capabilities;
+#ifndef VIMAGE
if_clone_attach(vlan_cloner);
+#endif
if (bootverbose)
printf(vlan: initialized, using 
 #ifdef VLAN_ARRAY
@@ -600,7 +607,9 @@ vlan_modevent(module_t mod, int type, vo
   \n);
break;
case MOD_UNLOAD:
+#ifndef VIMAGE
if_clone_detach(vlan_cloner);
+#endif
EVENTHANDLER_DEREGISTER(ifnet_departure_event, ifdetach_tag);
EVENTHANDLER_DEREGISTER(iflladdr_event, iflladdr_tag);
vlan_input_p = NULL;
@@ -625,6 +634,27 @@ static moduledata_t vlan_mod = {
 DECLARE_MODULE(if_vlan, vlan_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
 MODULE_VERSION(if_vlan, 3);
 
+#ifdef VIMAGE
+static void
+vnet_vlan_init(const void *unused __unused)
+{
+
+   V_vlan_cloner = vlan_cloner;
+   if_clone_attach(V_vlan_cloner);
+}
+VNET_SYSINIT(vnet_vlan_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY,
+vnet_vlan_init, NULL);
+
+static void
+vnet_vlan_uninit(const void *unused __unused)
+{
+
+   if_clone_detach(V_vlan_cloner);
+}
+VNET_SYSUNINIT(vnet_vlan_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_FIRST,
+vnet_vlan_uninit, NULL);
+#endif
+
 static struct ifnet *
 vlan_clone_match_ethertag(struct if_clone *ifc, const char *name, int *tag)
 {
@@ -1432,6 +1462,12 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd
break;
 
case SIOCSETVLAN:
+#ifdef VIMAGE
+   if (ifp-if_vnet != ifp-if_home_vnet) {
+   error = EPERM;
+   break;
+   }
+#endif
error = copyin(ifr-ifr_data, vlr, sizeof(vlr));
if (error)
break;
@@ -1461,6 +1497,12 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd
break;
 
case SIOCGETVLAN:
+#ifdef VIMAGE
+   if (ifp-if_vnet != ifp-if_home_vnet) {
+   error = EPERM;
+   break;
+   }
+#endif
bzero(vlr, sizeof(vlr));
VLAN_LOCK();
if (TRUNK(ifv) != NULL) {
___
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-unsubscr...@freebsd.org


svn commit: r215727 - head/bin/sh

2010-11-22 Thread Jilles Tjoelker
Author: jilles
Date: Mon Nov 22 23:49:06 2010
New Revision: 215727
URL: http://svn.freebsd.org/changeset/base/215727

Log:
  sh: Fix confusing behaviour if chdir succeeded but getcwd failed in cd -P.
  
  If getcwd fails, do not treat this as an error, but print a warning and
  unset PWD. This is similar to the behaviour when starting the shell in a
  directory whose name cannot be determined.

Modified:
  head/bin/sh/cd.c

Modified: head/bin/sh/cd.c
==
--- head/bin/sh/cd.cMon Nov 22 23:35:29 2010(r215726)
+++ head/bin/sh/cd.cMon Nov 22 23:49:06 2010(r215727)
@@ -219,10 +219,13 @@ cdphysical(char *dest)
char *p;
 
INTOFF;
-   if (chdir(dest)  0 || (p = findcwd(NULL)) == NULL) {
+   if (chdir(dest)  0) {
INTON;
return (-1);
}
+   p = findcwd(NULL);
+   if (p == NULL)
+   out2fmt_flush(cd: warning: failed to get name of current 
directory\n);
updatepwd(p);
INTON;
return (0);
@@ -304,7 +307,7 @@ updatepwd(char *dir)
if (prevdir)
ckfree(prevdir);
prevdir = curdir;
-   curdir = savestr(dir);
+   curdir = dir ? savestr(dir) : NULL;
setvar(PWD, curdir, VEXPORT);
setvar(OLDPWD, prevdir, VEXPORT);
 }
___
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-unsubscr...@freebsd.org


svn commit: r215728 - stable/8/sbin/newfs

2010-11-22 Thread Kirk McKusick
Author: mckusick
Date: Tue Nov 23 01:24:27 2010
New Revision: 215728
URL: http://svn.freebsd.org/changeset/base/215728

Log:
  MFC of 213119
  
  Reported problem:
  Large (60GB) filesystems created using newfs -U -O 1 -b 65536 -f 8192
  show incorrect results from df for free and used space when mounted
  immediately after creation. fsck on the new filesystem (before ever
  mounting it once) gives a SUMMARY INFORMATION BAD error in phase 5.
  
  This error hasn't occurred in any runs of fsck immediately after
  newfs -U -b 65536 -f 8192 (leaving out the -O 1 option).
  
  Solution:
  The default UFS1 superblock is located at offset 8K in the filesystem
  partition; the default UFS2 superblock is located at offset 64K in
  the filesystem partition. For UFS1 filesystems with a blocksize of
  64K, the first alternate superblock resides at 64K which is the the
  location used for the default UFS2 superblock. By default, the
  system first checks for a valid superblock at the default location
  for a UFS2 filoesystem. For a UFS1 filesystem with a blocksize of
  64K, there is a valid UFS1 superblock at this location. Thus, even
  though it is expected to be a backup superblock, the system will
  use it as its default superblock. So, we have to ensure that all the
  statistcs on usage are correct in this first alternate superblock
  as it is the superblock that will actually be used.
  
  While tracking down this problem, another limitation of UFS1 became
  evident. For UFS1, the number of inodes per cylinder group is stored
  in an int16_t. Thus the maximum number of inodes per cylinder group
  is limited to 2^15 - 1. This limit can easily be exceeded for block
  sizes of 32K and above. Thus when building UFS1 filesystems, newfs
  must limit the number of inodes per cylinder group to 2^15 - 1.
  
  Reported by: Guy Helmerghel...@palisadesys.com
  Followup by: Bruce Cran bru...@freebsd.org
  PR: 107692

Modified:
  stable/8/sbin/newfs/mkfs.c
Directory Properties:
  stable/8/sbin/newfs/   (props changed)

Modified: stable/8/sbin/newfs/mkfs.c
==
--- stable/8/sbin/newfs/mkfs.c  Mon Nov 22 23:49:06 2010(r215727)
+++ stable/8/sbin/newfs/mkfs.c  Tue Nov 23 01:24:27 2010(r215728)
@@ -376,16 +376,20 @@ restart:
 * Start packing more blocks into the cylinder group until
 * it cannot grow any larger, the number of cylinder groups
 * drops below MINCYLGRPS, or we reach the size requested.
+* For UFS1 inodes per cylinder group are stored in an int16_t
+* so fs_ipg is limited to 2^15 - 1.
 */
for ( ; sblock.fs_fpg  maxblkspercg; sblock.fs_fpg += sblock.fs_frag) {
sblock.fs_ipg = roundup(howmany(sblock.fs_fpg, fragsperinode),
INOPB(sblock));
-   if (sblock.fs_size / sblock.fs_fpg  MINCYLGRPS)
-   break;
-   if (CGSIZE(sblock)  (unsigned long)sblock.fs_bsize)
-   continue;
-   if (CGSIZE(sblock) == (unsigned long)sblock.fs_bsize)
-   break;
+   if (Oflag  1 || (Oflag == 1  sblock.fs_ipg = 0x7fff)) {
+   if (sblock.fs_size / sblock.fs_fpg  MINCYLGRPS)
+   break;
+   if (CGSIZE(sblock)  (unsigned long)sblock.fs_bsize)
+   continue;
+   if (CGSIZE(sblock) == (unsigned long)sblock.fs_bsize)
+   break;
+   }
sblock.fs_fpg -= sblock.fs_frag;
sblock.fs_ipg = roundup(howmany(sblock.fs_fpg, fragsperinode),
INOPB(sblock));
@@ -584,8 +588,20 @@ restart:
printf(** Exiting on Xflag 3\n);
exit(0);
}
-   if (!Nflag)
+   if (!Nflag) {
do_sbwrite(disk);
+   /*
+* For UFS1 filesystems with a blocksize of 64K, the first
+* alternate superblock resides at the location used for
+* the default UFS2 superblock. As there is a valid
+* superblock at this location, the boot code will use
+* it as its first choice. Thus we have to ensure that
+* all of its statistcs on usage are correct.
+*/
+   if (Oflag == 1  sblock.fs_bsize == 65536)
+   wtfs(fsbtodb(sblock, cgsblock(sblock, 0)),
+   sblock.fs_bsize, (char *)sblock);
+   }
for (i = 0; i  sblock.fs_cssize; i += sblock.fs_bsize)
wtfs(fsbtodb(sblock, sblock.fs_csaddr + numfrags(sblock, i)),
sblock.fs_cssize - i  sblock.fs_bsize ?
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to 

svn commit: r215729 - stable/7/sbin/newfs

2010-11-22 Thread Kirk McKusick
Author: mckusick
Date: Tue Nov 23 01:32:44 2010
New Revision: 215729
URL: http://svn.freebsd.org/changeset/base/215729

Log:
  MFC of 213119
  
  Reported problem:
  Large (60GB) filesystems created using newfs -U -O 1 -b 65536 -f 8192
  show incorrect results from df for free and used space when mounted
  immediately after creation. fsck on the new filesystem (before ever
  mounting it once) gives a SUMMARY INFORMATION BAD error in phase 5.
  
  This error hasn't occurred in any runs of fsck immediately after
  newfs -U -b 65536 -f 8192 (leaving out the -O 1 option).
  
  Solution:
  The default UFS1 superblock is located at offset 8K in the filesystem
  partition; the default UFS2 superblock is located at offset 64K in
  the filesystem partition. For UFS1 filesystems with a blocksize of
  64K, the first alternate superblock resides at 64K which is the the
  location used for the default UFS2 superblock. By default, the
  system first checks for a valid superblock at the default location
  for a UFS2 filoesystem. For a UFS1 filesystem with a blocksize of
  64K, there is a valid UFS1 superblock at this location. Thus, even
  though it is expected to be a backup superblock, the system will
  use it as its default superblock. So, we have to ensure that all the
  statistcs on usage are correct in this first alternate superblock
  as it is the superblock that will actually be used.
  
  While tracking down this problem, another limitation of UFS1 became
  evident. For UFS1, the number of inodes per cylinder group is stored
  in an int16_t. Thus the maximum number of inodes per cylinder group
  is limited to 2^15 - 1. This limit can easily be exceeded for block
  sizes of 32K and above. Thus when building UFS1 filesystems, newfs
  must limit the number of inodes per cylinder group to 2^15 - 1.
  
  Reported by: Guy Helmerghel...@palisadesys.com
  Followup by: Bruce Cran bru...@freebsd.org
  PR: 107692

Modified:
  stable/7/sbin/newfs/mkfs.c
Directory Properties:
  stable/7/sbin/newfs/   (props changed)

Modified: stable/7/sbin/newfs/mkfs.c
==
--- stable/7/sbin/newfs/mkfs.c  Tue Nov 23 01:24:27 2010(r215728)
+++ stable/7/sbin/newfs/mkfs.c  Tue Nov 23 01:32:44 2010(r215729)
@@ -367,16 +367,20 @@ restart:
 * Start packing more blocks into the cylinder group until
 * it cannot grow any larger, the number of cylinder groups
 * drops below MINCYLGRPS, or we reach the size requested.
+* For UFS1 inodes per cylinder group are stored in an int16_t
+* so fs_ipg is limited to 2^15 - 1.
 */
for ( ; sblock.fs_fpg  maxblkspercg; sblock.fs_fpg += sblock.fs_frag) {
sblock.fs_ipg = roundup(howmany(sblock.fs_fpg, fragsperinode),
INOPB(sblock));
-   if (sblock.fs_size / sblock.fs_fpg  MINCYLGRPS)
-   break;
-   if (CGSIZE(sblock)  (unsigned long)sblock.fs_bsize)
-   continue;
-   if (CGSIZE(sblock) == (unsigned long)sblock.fs_bsize)
-   break;
+   if (Oflag  1 || (Oflag == 1  sblock.fs_ipg = 0x7fff)) {
+   if (sblock.fs_size / sblock.fs_fpg  MINCYLGRPS)
+   break;
+   if (CGSIZE(sblock)  (unsigned long)sblock.fs_bsize)
+   continue;
+   if (CGSIZE(sblock) == (unsigned long)sblock.fs_bsize)
+   break;
+   }
sblock.fs_fpg -= sblock.fs_frag;
sblock.fs_ipg = roundup(howmany(sblock.fs_fpg, fragsperinode),
INOPB(sblock));
@@ -568,8 +572,20 @@ restart:
printf(** Exiting on Eflag 3\n);
exit(0);
}
-   if (!Nflag)
+   if (!Nflag) {
sbwrite(disk, 0);
+   /*
+* For UFS1 filesystems with a blocksize of 64K, the first
+* alternate superblock resides at the location used for
+* the default UFS2 superblock. As there is a valid
+* superblock at this location, the boot code will use
+* it as its first choice. Thus we have to ensure that
+* all of its statistcs on usage are correct.
+*/
+   if (Oflag == 1  sblock.fs_bsize == 65536)
+   wtfs(fsbtodb(sblock, cgsblock(sblock, 0)),
+   sblock.fs_bsize, (char *)sblock);
+   }
for (i = 0; i  sblock.fs_cssize; i += sblock.fs_bsize)
wtfs(fsbtodb(sblock, sblock.fs_csaddr + numfrags(sblock, i)),
sblock.fs_cssize - i  sblock.fs_bsize ?
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to 

svn commit: r215730 - in stable/8: etc/periodic/security tools/build/mk

2010-11-22 Thread Xin LI
Author: delphij
Date: Tue Nov 23 01:39:30 2010
New Revision: 215730
URL: http://svn.freebsd.org/changeset/base/215730

Log:
  MFC r204459 (antonie):
  
  Add files to remove when MK_PKGTOOLS=no.
  
  MFC r215045 [1]:
  
  Hide 460.chkportsum in MK_PKGTOOLS != no case.
  
  Submitted by: Alex Kozlov spam rm-rf kiev ua [1]

Modified:
  stable/8/etc/periodic/security/Makefile
  stable/8/tools/build/mk/OptionalObsoleteFiles.inc
Directory Properties:
  stable/8/etc/periodic/security/   (props changed)
  stable/8/tools/build/mk/   (props changed)

Modified: stable/8/etc/periodic/security/Makefile
==
--- stable/8/etc/periodic/security/Makefile Tue Nov 23 01:32:44 2010
(r215729)
+++ stable/8/etc/periodic/security/Makefile Tue Nov 23 01:39:30 2010
(r215730)
@@ -7,7 +7,6 @@ FILES=  100.chksetuid \
300.chkuid0 \
400.passwdless \
410.logincheck \
-   460.chkportsum \
700.kernelmsg \
800.loginfail \
900.tcpwrap \
@@ -28,4 +27,8 @@ FILES+=   500.ipfwdenied \
 FILES+=520.pfdenied
 .endif
 
+.if ${MK_PKGTOOLS} != no
+FILES+=460.chkportsum
+.endif
+
 .include bsd.prog.mk

Modified: stable/8/tools/build/mk/OptionalObsoleteFiles.inc
==
--- stable/8/tools/build/mk/OptionalObsoleteFiles.inc   Tue Nov 23 01:32:44 
2010(r215729)
+++ stable/8/tools/build/mk/OptionalObsoleteFiles.inc   Tue Nov 23 01:39:30 
2010(r215730)
@@ -1213,6 +1213,23 @@ OLD_FILES+=usr/share/man/man1/nc.1.gz
 # to be filled in
 #.endif
 
+.if ${MK_PKGTOOLS} == no
+OLD_FILES+=etc/periodic/security/460.chkportsum
+OLD_FILES+=etc/periodic/weekly/400.status-pkg
+OLD_FILES+=usr/sbin/pkg_add
+OLD_FILES+=usr/sbin/pkg_create
+OLD_FILES+=usr/sbin/pkg_delete
+OLD_FILES+=usr/sbin/pkg_info
+OLD_FILES+=usr/sbin/pkg_updating
+OLD_FILES+=usr/sbin/pkg_version
+OLD_FILES+=usr/share/man/man1/pkg_add.1.gz
+OLD_FILES+=usr/share/man/man1/pkg_create.1.gz
+OLD_FILES+=usr/share/man/man1/pkg_delete.1.gz
+OLD_FILES+=usr/share/man/man1/pkg_info.1.gz
+OLD_FILES+=usr/share/man/man1/pkg_updating.1.gz
+OLD_FILES+=usr/share/man/man1/pkg_version.1.gz
+.endif
+
 .if ${MK_PROFILE} == no
 OLD_FILES+=usr/lib/libalias_cuseeme_p.a
 OLD_FILES+=usr/lib/libalias_dummy_p.a
___
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-unsubscr...@freebsd.org


svn commit: r215732 - head/sys/kern

2010-11-22 Thread Colin Percival
Author: cperciva
Date: Tue Nov 23 04:50:01 2010
New Revision: 215732
URL: http://svn.freebsd.org/changeset/base/215732

Log:
  Add parentheses for clarity.  The parentheses around the two terms of the 
  are unnecessary but I'm leaving them in for the sake of avoiding confusion
  (I confuse easily).
  
  Submitted by: bde

Modified:
  head/sys/kern/kern_tc.c

Modified: head/sys/kern/kern_tc.c
==
--- head/sys/kern/kern_tc.c Tue Nov 23 03:53:53 2010(r215731)
+++ head/sys/kern/kern_tc.c Tue Nov 23 04:50:01 2010(r215732)
@@ -448,7 +448,7 @@ tc_windup(void)
th-th_offset.sec++;
}
if ((delta  th-th_counter-tc_frequency / 2) 
-   (th-th_scale * delta  (uint64_t)1  63)) {
+   (th-th_scale * delta  ((uint64_t)1  63))) {
/* The product th_scale * delta just barely overflows. */
th-th_offset.sec++;
}
___
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-unsubscr...@freebsd.org


svn commit: r215733 - head/share/misc

2010-11-22 Thread Maxim Konovalov
Author: maxim
Date: Tue Nov 23 06:31:09 2010
New Revision: 215733
URL: http://svn.freebsd.org/changeset/base/215733

Log:
  o NetBSD 5.1 added.

Modified:
  head/share/misc/bsd-family-tree

Modified: head/share/misc/bsd-family-tree
==
--- head/share/misc/bsd-family-tree Tue Nov 23 04:50:01 2010
(r215732)
+++ head/share/misc/bsd-family-tree Tue Nov 23 06:31:09 2010
(r215733)
@@ -228,20 +228,20 @@ FreeBSD 5.2   |  |  
  |  FreeBSD 7.1   |  | |   |
  | |  |  | |DragonFly 2.2.0
  |  FreeBSD 7.2   |   NetBSD 5.0   OpenBSD 4.5 |
- | \  |  | |   |
- |  | |  | |DragonFly 2.4.0
- |  | |  | OpenBSD 4.6 |
- |  | |  | |   |
- *--FreeBSD | |  | |   |
- |8.0   | |  | |   |
- | |FreeBSD   |  | |   |
- | |   7.3|  | |DragonFly 2.6.0
- | |  |  | OpenBSD 4.7 |
- |  FreeBSD   |  | |   |
- |8.1 |  | |   |
- | |  |  | |DragonFly 2.8.0
- | |  |  | OpenBSD 4.8 |
- | V  |  | |   |
+ | \  |  |||   |
+ |  | |  |||DragonFly 2.4.0
+ |  | |  ||OpenBSD 4.6 |
+ |  | |  |||   |
+ *--FreeBSD | |  |||   |
+ |8.0   | |  |||   |
+ | |FreeBSD   |  |||   |
+ | |   7.3|  |||DragonFly 2.6.0
+ | |  |  ||OpenBSD 4.7 |
+ |  FreeBSD   |  |||   |
+ |8.1 |  |||   |
+ | |  |  |||DragonFly 2.8.0
+ | |  |  ||OpenBSD 4.8 |
+ | V  |  | NetBSD 5.1  |   |
  ||  | |   |
 FreeBSD 9 -current|  NetBSD -current  OpenBSD -current |
  ||  | |   |
@@ -523,6 +523,7 @@ OpenBSD 4.7 2010-05-19 [OBD]
 FreeBSD 8.12010-07-24 [FBD]
 DragonFly 2.8.02010-10-30 [DFB]
 OpenBSD 4.82010-11-01 [OBD]
+NetBSD 5.1 2010-11-19 [NBD]
 
 Bibliography
 
___
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-unsubscr...@freebsd.org