svn commit: r217391 - in head/release: amd64 i386 ia64 pc98 powerpc sparc64 sun4v

2011-01-14 Thread Takahashi Yoshihiro
Author: nyan
Date: Fri Jan 14 10:56:44 2011
New Revision: 217391
URL: http://svn.freebsd.org/changeset/base/217391

Log:
  Fix making a release.  The old libdialog was renamed to libodialog.

Modified:
  head/release/amd64/boot_crunch.conf
  head/release/i386/boot_crunch.conf
  head/release/ia64/boot_crunch.conf
  head/release/pc98/boot_crunch.conf
  head/release/powerpc/boot_crunch.conf
  head/release/sparc64/boot_crunch.conf
  head/release/sun4v/boot_crunch.conf

Modified: head/release/amd64/boot_crunch.conf
==
--- head/release/amd64/boot_crunch.conf Fri Jan 14 05:31:51 2011
(r217390)
+++ head/release/amd64/boot_crunch.conf Fri Jan 14 10:56:44 2011
(r217391)
@@ -40,5 +40,5 @@ progs sysinstall
 progs usbconfig
 
 libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph
-libs -ldialog -lncurses -ldisk -lcam -lsbuf -lufs -ldevinfo
+libs -lodialog -lncurses -ldisk -lcam -lsbuf -lufs -ldevinfo
 libs -lbsdxml -larchive -lcrypto -lbz2 -llzma -lusb -ljail

Modified: head/release/i386/boot_crunch.conf
==
--- head/release/i386/boot_crunch.conf  Fri Jan 14 05:31:51 2011
(r217390)
+++ head/release/i386/boot_crunch.conf  Fri Jan 14 10:56:44 2011
(r217391)
@@ -40,5 +40,5 @@ progs sysinstall
 progs usbconfig
 
 libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph
-libs -ldialog -lncurses -ldisk -lcam -lsbuf -lufs -ldevinfo
+libs -lodialog -lncurses -ldisk -lcam -lsbuf -lufs -ldevinfo
 libs -lbsdxml -larchive -lcrypto -lbz2 -llzma -lusb -ljail

Modified: head/release/ia64/boot_crunch.conf
==
--- head/release/ia64/boot_crunch.conf  Fri Jan 14 05:31:51 2011
(r217390)
+++ head/release/ia64/boot_crunch.conf  Fri Jan 14 10:56:44 2011
(r217391)
@@ -45,5 +45,5 @@ progs sysinstall
 progs usbconfig
 
 libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph
-libs -ldialog -lncurses -ldisk -lcam -lkiconv -lsbuf -lufs -ldevinfo
+libs -lodialog -lncurses -ldisk -lcam -lkiconv -lsbuf -lufs -ldevinfo
 libs -lgeom -lbsdxml -larchive -lcrypto -lbz2 -llzma -lusb -ljail

Modified: head/release/pc98/boot_crunch.conf
==
--- head/release/pc98/boot_crunch.conf  Fri Jan 14 05:31:51 2011
(r217390)
+++ head/release/pc98/boot_crunch.conf  Fri Jan 14 10:56:44 2011
(r217391)
@@ -39,5 +39,5 @@ progs ppp
 progs sysinstall
 
 libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph
-libs -ldialog -lncurses -ldisk -lcam -lsbuf -lufs -lbsdxml
+libs -lodialog -lncurses -ldisk -lcam -lsbuf -lufs -lbsdxml
 libs -larchive -lcrypto -lbz2 -llzma -ljail

Modified: head/release/powerpc/boot_crunch.conf
==
--- head/release/powerpc/boot_crunch.conf   Fri Jan 14 05:31:51 2011
(r217390)
+++ head/release/powerpc/boot_crunch.conf   Fri Jan 14 10:56:44 2011
(r217391)
@@ -45,5 +45,5 @@ progs sysinstall
 progs usbconfig
 
 libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph
-libs -ldialog -lncurses -ldisk -lcam -lkiconv -lsbuf -lufs
+libs -lodialog -lncurses -ldisk -lcam -lkiconv -lsbuf -lufs
 libs -lgeom -lbsdxml -larchive -lcrypto -lbz2 -llzma -lusb -ljail

Modified: head/release/sparc64/boot_crunch.conf
==
--- head/release/sparc64/boot_crunch.conf   Fri Jan 14 05:31:51 2011
(r217390)
+++ head/release/sparc64/boot_crunch.conf   Fri Jan 14 10:56:44 2011
(r217391)
@@ -43,5 +43,5 @@ progs sysinstall
 progs usbconfig
 
 libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph
-libs -ldialog -lncurses -ldisk -lcam -lsbuf -lufs -lgeom -lbsdxml
+libs -lodialog -lncurses -ldisk -lcam -lsbuf -lufs -lgeom -lbsdxml
 libs -larchive -lcrypto -lbz2 -llzma -lusb -ljail

Modified: head/release/sun4v/boot_crunch.conf
==
--- head/release/sun4v/boot_crunch.conf Fri Jan 14 05:31:51 2011
(r217390)
+++ head/release/sun4v/boot_crunch.conf Fri Jan 14 10:56:44 2011
(r217391)
@@ -40,5 +40,5 @@ progs sysinstall
 progs usbconfig
 
 libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph
-libs -ldialog -lncurses -ldisk -lcam -lsbuf -lufs -lbsdxml
+libs -lodialog -lncurses -ldisk -lcam -lsbuf -lufs -lbsdxml
 libs -larchive -lcrypto -lbz2 -llzma -lusb -ljail
___
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: r217392 - stable/8/sys/geom

2011-01-14 Thread Jaakko Heinonen
Author: jh
Date: Fri Jan 14 11:12:56 2011
New Revision: 217392
URL: http://svn.freebsd.org/changeset/base/217392

Log:
  MFC r214748:
  
  Extend the g_eventlock mutex coverage in one_event() to include setting
  of the EV_DONE flag and use the mutex to protect against losing wakeups
  in g_waitfor_event().

Modified:
  stable/8/sys/geom/geom_event.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)

Modified: stable/8/sys/geom/geom_event.c
==
--- stable/8/sys/geom/geom_event.c  Fri Jan 14 10:56:44 2011
(r217391)
+++ stable/8/sys/geom/geom_event.c  Fri Jan 14 11:12:56 2011
(r217392)
@@ -212,11 +212,12 @@ one_event(void)
g_topology_assert();
mtx_lock(&g_eventlock);
TAILQ_REMOVE(&g_events, ep, events);
-   mtx_unlock(&g_eventlock);
if (ep->flag & EV_WAKEUP) {
ep->flag |= EV_DONE;
+   mtx_unlock(&g_eventlock);
wakeup(ep);
} else {
+   mtx_unlock(&g_eventlock);
g_free(ep);
}
g_topology_unlock();
@@ -355,11 +356,14 @@ g_waitfor_event(g_event_t *func, void *a
va_end(ap);
if (error)
return (error);
-   do 
-   tsleep(ep, PRIBIO, "g_waitfor_event", hz);
-   while (!(ep->flag & EV_DONE));
+
+   mtx_lock(&g_eventlock);
+   while (!(ep->flag & EV_DONE))
+   msleep(ep, &g_eventlock, PRIBIO, "g_waitfor_event", hz);
if (ep->flag & EV_CANCELED)
error = EAGAIN;
+   mtx_unlock(&g_eventlock);
+
g_free(ep);
return (error);
 }
___
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: r217393 - head/lib/libcompiler_rt

2011-01-14 Thread Konstantin Belousov
Author: kib
Date: Fri Jan 14 11:23:39 2011
New Revision: 217393
URL: http://svn.freebsd.org/changeset/base/217393

Log:
  Mark libcompiler_rt as not needed executable stack on powerpc.
  
  Reviewed and tested by:   nwhitehorn

Modified:
  head/lib/libcompiler_rt/Makefile

Modified: head/lib/libcompiler_rt/Makefile
==
--- head/lib/libcompiler_rt/MakefileFri Jan 14 11:12:56 2011
(r217392)
+++ head/lib/libcompiler_rt/MakefileFri Jan 14 11:23:39 2011
(r217393)
@@ -156,7 +156,8 @@ SYMLINKS+=libcompiler_rt_p.a ${LIBDIR}/l
 . endif
 .endif
 
-.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
+.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" || \
+${MACHINE_CPUARCH} == "powerpc"
 AFLAGS+=--noexecstack
 ACFLAGS+=-Wa,--noexecstack
 .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: r217394 - head/contrib/binutils/ld

2011-01-14 Thread Konstantin Belousov
Author: kib
Date: Fri Jan 14 11:25:11 2011
New Revision: 217394
URL: http://svn.freebsd.org/changeset/base/217394

Log:
  Add a workaround for the warnings and sometimes errors due to missed
  forward-declaration.
  
  Reviewed by:  dim

Modified:
  head/contrib/binutils/ld/ldemul.h

Modified: head/contrib/binutils/ld/ldemul.h
==
--- head/contrib/binutils/ld/ldemul.h   Fri Jan 14 11:23:39 2011
(r217393)
+++ head/contrib/binutils/ld/ldemul.h   Fri Jan 14 11:25:11 2011
(r217394)
@@ -17,6 +17,9 @@
 #ifndef LDEMUL_H
 #define LDEMUL_H
 
+/* Forward declaration for ldemul_add_options() and others.  */
+struct option;
+
 extern void ldemul_hll
   (char *);
 extern void ldemul_syslib
___
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: r217395 - head/contrib/binutils/ld/emultempl

2011-01-14 Thread Konstantin Belousov
Author: kib
Date: Fri Jan 14 11:28:34 2011
New Revision: 217395
URL: http://svn.freebsd.org/changeset/base/217395

Log:
  On PowerPC64, linker emits a fake object into each linked object,
  'linker stubs'. Add .note.GNU-stack for the stubs objects. Without this,
  final binary will have RWE mode for PT_GNU_STACK regardless of the
  actual requirements.
  
  Tested by:nwhitehorn
  Reviewed by:  dim, nwhitehorn

Modified:
  head/contrib/binutils/ld/emultempl/ppc64elf.em

Modified: head/contrib/binutils/ld/emultempl/ppc64elf.em
==
--- head/contrib/binutils/ld/emultempl/ppc64elf.em  Fri Jan 14 11:25:11 
2011(r217394)
+++ head/contrib/binutils/ld/emultempl/ppc64elf.em  Fri Jan 14 11:28:34 
2011(r217395)
@@ -60,6 +60,7 @@ ppc_create_output_section_statements (vo
 {
   extern const bfd_target bfd_elf64_powerpc_vec;
   extern const bfd_target bfd_elf64_powerpcle_vec;
+  asection *sect;
 
   if (link_info.hash->creator != &bfd_elf64_powerpc_vec
   && link_info.hash->creator != &bfd_elf64_powerpcle_vec)
@@ -80,6 +81,8 @@ ppc_create_output_section_statements (vo
   return;
 }
 
+  if (bfd_get_section_by_name (stub_file->the_bfd, ".note.GNU-stack") == NULL)
+sect = bfd_make_section (stub_file->the_bfd, ".note.GNU-stack");
   ldlang_add_file (stub_file);
   ppc64_elf_init_stub_bfd (stub_file->the_bfd, &link_info);
 }
___
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: r217396 - head/contrib/gcc/config/rs6000

2011-01-14 Thread Konstantin Belousov
Author: kib
Date: Fri Jan 14 11:31:22 2011
New Revision: 217396
URL: http://svn.freebsd.org/changeset/base/217396

Log:
  Configure gcc to emit .note.GNU-stack for both 32 and 64 bits PowerPC.
  Mark gcc-provided asm files as not requiring executable stack.
  
  It seems that non-FreeBSD ABIs for powerpc64 claim stack non-executable.
  Due to this, rs6000_elf_end_indicate_exec_stack() only emit the note for
  32 bit target. I decided not to change FreeBSD ABI and patch
  emit the notes for both variants.
  
  Reviewed and tested by:   nwhitehorn

Modified:
  head/contrib/gcc/config/rs6000/crtsavres.asm
  head/contrib/gcc/config/rs6000/freebsd.h
  head/contrib/gcc/config/rs6000/rs6000.c
  head/contrib/gcc/config/rs6000/tramp.asm

Modified: head/contrib/gcc/config/rs6000/crtsavres.asm
==
--- head/contrib/gcc/config/rs6000/crtsavres.asmFri Jan 14 11:28:34 
2011(r217395)
+++ head/contrib/gcc/config/rs6000/crtsavres.asmFri Jan 14 11:31:22 
2011(r217396)
@@ -305,3 +305,5 @@ FUNC_END(_restgpr_15_x)
 FUNC_END(_restgpr_14_x)
 
 #endif
+
+   .section .note.GNU-stack,"",%progbits

Modified: head/contrib/gcc/config/rs6000/freebsd.h
==
--- head/contrib/gcc/config/rs6000/freebsd.hFri Jan 14 11:28:34 2011
(r217395)
+++ head/contrib/gcc/config/rs6000/freebsd.hFri Jan 14 11:31:22 2011
(r217396)
@@ -230,6 +230,8 @@
   }
 #endif
 
+#define TARGET_ASM_FILE_END rs6000_elf_end_indicate_exec_stack
+
 /* FreeBSD doesn't support saving and restoring 64-bit regs with a 32-bit
kernel. This is supported when running on a 64-bit kernel with
COMPAT_FREEBSD32, but tell GCC it isn't so that our 32-bit binaries
@@ -242,3 +244,5 @@
 #define PROFILE_HOOK(LABEL) \
   do { if (TARGET_64BIT) output_profile_hook (LABEL); } while (0)
 
+#undef NEED_INDICATE_EXEC_STACK
+#define NEED_INDICATE_EXEC_STACK 1

Modified: head/contrib/gcc/config/rs6000/rs6000.c
==
--- head/contrib/gcc/config/rs6000/rs6000.c Fri Jan 14 11:28:34 2011
(r217395)
+++ head/contrib/gcc/config/rs6000/rs6000.c Fri Jan 14 11:31:22 2011
(r217396)
@@ -18426,7 +18426,7 @@ rs6000_elf_declare_function_name (FILE *
 static void
 rs6000_elf_end_indicate_exec_stack (void)
 {
-  if (TARGET_32BIT)
+  if (NEED_INDICATE_EXEC_STACK)
 file_end_indicate_exec_stack ();
 }
 #endif

Modified: head/contrib/gcc/config/rs6000/tramp.asm
==
--- head/contrib/gcc/config/rs6000/tramp.asmFri Jan 14 11:28:34 2011
(r217395)
+++ head/contrib/gcc/config/rs6000/tramp.asmFri Jan 14 11:31:22 2011
(r217396)
@@ -115,3 +115,5 @@ FUNC_START(__trampoline_setup)
 FUNC_END(__trampoline_setup)
 
 #endif
+
+   .section .note.GNU-stack,"",%progbits
___
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: r217397 - in head/libexec/rtld-elf: powerpc powerpc64

2011-01-14 Thread Konstantin Belousov
Author: kib
Date: Fri Jan 14 11:32:31 2011
New Revision: 217397
URL: http://svn.freebsd.org/changeset/base/217397

Log:
  Mark rtld on PowerPC as not requiring executable stack.
  
  Reviewed and tested by:   nwhitehorn

Modified:
  head/libexec/rtld-elf/powerpc/rtld_start.S
  head/libexec/rtld-elf/powerpc64/rtld_start.S

Modified: head/libexec/rtld-elf/powerpc/rtld_start.S
==
--- head/libexec/rtld-elf/powerpc/rtld_start.S  Fri Jan 14 11:31:22 2011
(r217396)
+++ head/libexec/rtld-elf/powerpc/rtld_start.S  Fri Jan 14 11:32:31 2011
(r217397)
@@ -197,4 +197,4 @@ _ENTRY(_rtld_powerpc_pltcall)
 mtctr   %r11
 bctr   # (*jmptab[index])()
 
-
+   .section .note.GNU-stack,"",%progbits

Modified: head/libexec/rtld-elf/powerpc64/rtld_start.S
==
--- head/libexec/rtld-elf/powerpc64/rtld_start.SFri Jan 14 11:31:22 
2011(r217396)
+++ head/libexec/rtld-elf/powerpc64/rtld_start.SFri Jan 14 11:32:31 
2011(r217397)
@@ -159,3 +159,4 @@ _ENTRY(_rtld_bind_start)
 
bctr# jump to target
 
+   .section .note.GNU-stack,"",%progbits
___
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: r217398 - in head/lib/libc: powerpc/gen powerpc/sys powerpc64/gen powerpc64/sys

2011-01-14 Thread Konstantin Belousov
Author: kib
Date: Fri Jan 14 11:33:40 2011
New Revision: 217398
URL: http://svn.freebsd.org/changeset/base/217398

Log:
  Mark assembler sources from libc as working with non-executable stack.
  
  Reviewed and tested by:   nwhitehorn

Modified:
  head/lib/libc/powerpc/gen/_ctx_start.S
  head/lib/libc/powerpc/gen/_setjmp.S
  head/lib/libc/powerpc/gen/fabs.S
  head/lib/libc/powerpc/gen/setjmp.S
  head/lib/libc/powerpc/gen/sigsetjmp.S
  head/lib/libc/powerpc/sys/brk.S
  head/lib/libc/powerpc/sys/cerror.S
  head/lib/libc/powerpc/sys/exect.S
  head/lib/libc/powerpc/sys/pipe.S
  head/lib/libc/powerpc/sys/ptrace.S
  head/lib/libc/powerpc/sys/sbrk.S
  head/lib/libc/powerpc/sys/setlogin.S
  head/lib/libc/powerpc64/gen/_ctx_start.S
  head/lib/libc/powerpc64/gen/_setjmp.S
  head/lib/libc/powerpc64/gen/fabs.S
  head/lib/libc/powerpc64/gen/setjmp.S
  head/lib/libc/powerpc64/gen/sigsetjmp.S
  head/lib/libc/powerpc64/sys/brk.S
  head/lib/libc/powerpc64/sys/cerror.S
  head/lib/libc/powerpc64/sys/exect.S
  head/lib/libc/powerpc64/sys/pipe.S
  head/lib/libc/powerpc64/sys/ptrace.S
  head/lib/libc/powerpc64/sys/sbrk.S
  head/lib/libc/powerpc64/sys/setlogin.S

Modified: head/lib/libc/powerpc/gen/_ctx_start.S
==
--- head/lib/libc/powerpc/gen/_ctx_start.S  Fri Jan 14 11:32:31 2011
(r217397)
+++ head/lib/libc/powerpc/gen/_ctx_start.S  Fri Jan 14 11:33:40 2011
(r217398)
@@ -41,3 +41,5 @@
 * above branch.
 */
bl  PIC_PLT(CNAME(abort))   /* abort */
+
+   .section .note.GNU-stack,"",%progbits

Modified: head/lib/libc/powerpc/gen/_setjmp.S
==
--- head/lib/libc/powerpc/gen/_setjmp.S Fri Jan 14 11:32:31 2011
(r217397)
+++ head/lib/libc/powerpc/gen/_setjmp.S Fri Jan 14 11:33:40 2011
(r217398)
@@ -69,3 +69,5 @@ ENTRY(_longjmp)
bnelr
li  %r3,1
blr
+
+   .section .note.GNU-stack,"",%progbits

Modified: head/lib/libc/powerpc/gen/fabs.S
==
--- head/lib/libc/powerpc/gen/fabs.SFri Jan 14 11:32:31 2011
(r217397)
+++ head/lib/libc/powerpc/gen/fabs.SFri Jan 14 11:33:40 2011
(r217398)
@@ -33,3 +33,5 @@ __FBSDID("$FreeBSD$");
 ENTRY(fabs)
fabs%f1,%f1
blr
+
+   .section .note.GNU-stack,"",%progbits

Modified: head/lib/libc/powerpc/gen/setjmp.S
==
--- head/lib/libc/powerpc/gen/setjmp.S  Fri Jan 14 11:32:31 2011
(r217397)
+++ head/lib/libc/powerpc/gen/setjmp.S  Fri Jan 14 11:33:40 2011
(r217398)
@@ -89,3 +89,4 @@ ENTRY(__longjmp)
li  %r3,1
blr
 
+   .section .note.GNU-stack,"",%progbits

Modified: head/lib/libc/powerpc/gen/sigsetjmp.S
==
--- head/lib/libc/powerpc/gen/sigsetjmp.S   Fri Jan 14 11:32:31 2011
(r217397)
+++ head/lib/libc/powerpc/gen/sigsetjmp.S   Fri Jan 14 11:33:40 2011
(r217398)
@@ -95,3 +95,5 @@ ENTRY(siglongjmp)
bnelr
li  %r3,1
blr
+
+   .section .note.GNU-stack,"",%progbits

Modified: head/lib/libc/powerpc/sys/brk.S
==
--- head/lib/libc/powerpc/sys/brk.S Fri Jan 14 11:32:31 2011
(r217397)
+++ head/lib/libc/powerpc/sys/brk.S Fri Jan 14 11:33:40 2011
(r217398)
@@ -71,3 +71,5 @@ ENTRY(brk)
 
 1:
b   PIC_PLT(HIDENAME(cerror))
+
+   .section .note.GNU-stack,"",%progbits

Modified: head/lib/libc/powerpc/sys/cerror.S
==
--- head/lib/libc/powerpc/sys/cerror.S  Fri Jan 14 11:32:31 2011
(r217397)
+++ head/lib/libc/powerpc/sys/cerror.S  Fri Jan 14 11:33:40 2011
(r217398)
@@ -54,4 +54,4 @@ HIDENAME(cerror):
li  %r4,-1
blr /* return to callers caller */
 
-
+   .section .note.GNU-stack,"",%progbits

Modified: head/lib/libc/powerpc/sys/exect.S
==
--- head/lib/libc/powerpc/sys/exect.S   Fri Jan 14 11:32:31 2011
(r217397)
+++ head/lib/libc/powerpc/sys/exect.S   Fri Jan 14 11:33:40 2011
(r217398)
@@ -37,3 +37,5 @@ ENTRY(exect)
blr
 1:
b   PIC_PLT(HIDENAME(cerror))
+
+   .section .note.GNU-stack,"",%progbits

Modified: head/lib/libc/powerpc/sys/pipe.S
==
--- head/lib/libc/powerpc/sys/pipe.SFri Jan 14 11:32:31 2011
(r217397)
+++ head/lib/libc/powerpc/sys/pipe.SFri Jan 14 11:33:40 2011
(r217398)
@@ -41,3 +41,5 @@ ENTRY(pipe)
blr /* and ret

svn commit: r217399 - in head/lib/csu: powerpc powerpc64

2011-01-14 Thread Konstantin Belousov
Author: kib
Date: Fri Jan 14 11:34:58 2011
New Revision: 217399
URL: http://svn.freebsd.org/changeset/base/217399

Log:
  Mark csu on PowerPC as not requiring executable stack.
  
  Reviewed and tested by:   nwhitehorn

Modified:
  head/lib/csu/powerpc/crti.S
  head/lib/csu/powerpc/crtn.S
  head/lib/csu/powerpc64/crti.S
  head/lib/csu/powerpc64/crtn.S

Modified: head/lib/csu/powerpc/crti.S
==
--- head/lib/csu/powerpc/crti.S Fri Jan 14 11:33:40 2011(r217398)
+++ head/lib/csu/powerpc/crti.S Fri Jan 14 11:34:58 2011(r217399)
@@ -47,3 +47,5 @@ _fini:
stw 31,12(1)
stw 0,20(1)
mr 31,1
+
+   .section .note.GNU-stack,"",%progbits

Modified: head/lib/csu/powerpc/crtn.S
==
--- head/lib/csu/powerpc/crtn.S Fri Jan 14 11:33:40 2011(r217398)
+++ head/lib/csu/powerpc/crtn.S Fri Jan 14 11:34:58 2011(r217399)
@@ -42,3 +42,5 @@ __FBSDID("$FreeBSD$");
lwz 31,-4(11)
mr 1,11
blr
+
+   .section .note.GNU-stack,"",%progbits

Modified: head/lib/csu/powerpc64/crti.S
==
--- head/lib/csu/powerpc64/crti.S   Fri Jan 14 11:33:40 2011
(r217398)
+++ head/lib/csu/powerpc64/crti.S   Fri Jan 14 11:34:58 2011
(r217399)
@@ -59,3 +59,5 @@ _fini:
stdu 1,-48(1)
mflr 0
std 0,64(1)
+
+   .section .note.GNU-stack,"",%progbits

Modified: head/lib/csu/powerpc64/crtn.S
==
--- head/lib/csu/powerpc64/crtn.S   Fri Jan 14 11:33:40 2011
(r217398)
+++ head/lib/csu/powerpc64/crtn.S   Fri Jan 14 11:34:58 2011
(r217399)
@@ -38,3 +38,5 @@ __FBSDID("$FreeBSD$");
ld 0,16(%r1)
mtlr 0
blr
+
+   .section .note.GNU-stack,"",%progbits
___
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: r217400 - in head/sys/powerpc: include powerpc

2011-01-14 Thread Konstantin Belousov
Author: kib
Date: Fri Jan 14 11:36:44 2011
New Revision: 217400
URL: http://svn.freebsd.org/changeset/base/217400

Log:
  Enable shared page for the signal trampolines on PowerPC.
  
  Reviewed and tested by:   nwhitehorn

Modified:
  head/sys/powerpc/include/vmparam.h
  head/sys/powerpc/powerpc/elf32_machdep.c
  head/sys/powerpc/powerpc/elf64_machdep.c
  head/sys/powerpc/powerpc/exec_machdep.c

Modified: head/sys/powerpc/include/vmparam.h
==
--- head/sys/powerpc/include/vmparam.h  Fri Jan 14 11:34:58 2011
(r217399)
+++ head/sys/powerpc/include/vmparam.h  Fri Jan 14 11:36:44 2011
(r217400)
@@ -35,7 +35,7 @@
 #ifndef _MACHINE_VMPARAM_H_
 #define_MACHINE_VMPARAM_H_
 
-#defineUSRSTACKVM_MAXUSER_ADDRESS
+#defineUSRSTACKSHAREDPAGE
 
 #ifndefMAXTSIZ
 #defineMAXTSIZ (64*1024*1024)  /* max text size */
@@ -64,10 +64,12 @@
 #ifdef __powerpc64__
 #defineVM_MIN_ADDRESS  (0xUL)
 #defineVM_MAXUSER_ADDRESS  (0x7000UL)
+#defineSHAREDPAGE  (VM_MAXUSER_ADDRESS - PAGE_SIZE)
 #defineVM_MAX_ADDRESS  (0xUL)
 #else
 #defineVM_MIN_ADDRESS  ((vm_offset_t)0)
 #defineVM_MAXUSER_ADDRESS  ((vm_offset_t)0x7000)
+#defineSHAREDPAGE  (VM_MAXUSER_ADDRESS - PAGE_SIZE)
 #defineVM_MAX_ADDRESS  VM_MAXUSER_ADDRESS
 #endif
 #else /* LOCORE */
@@ -77,8 +79,8 @@
 #endif
 #endif /* LOCORE */
 
-#defineFREEBSD32_USRSTACK  0x7000
-
+#defineFREEBSD32_SHAREDPAGE(0x7000 - PAGE_SIZE)
+#defineFREEBSD32_USRSTACK  FREEBSD32_SHAREDPAGE
 
 #ifdef AIM
 #defineKERNBASE0x0010UL/* start of kernel 
virtual */

Modified: head/sys/powerpc/powerpc/elf32_machdep.c
==
--- head/sys/powerpc/powerpc/elf32_machdep.cFri Jan 14 11:34:58 2011
(r217399)
+++ head/sys/powerpc/powerpc/elf32_machdep.cFri Jan 14 11:36:44 2011
(r217400)
@@ -101,10 +101,13 @@ struct sysentvec elf32_freebsd_sysvec = 
 #endif
.sv_fixlimit= NULL,
.sv_maxssiz = NULL,
-   .sv_flags   = SV_ABI_FREEBSD | SV_ILP32,
+   .sv_flags   = SV_ABI_FREEBSD | SV_ILP32 | SV_SHP,
.sv_set_syscall_retval = cpu_set_syscall_retval,
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
+   .sv_shared_page_base = FREEBSD32_SHAREDPAGE,
+   .sv_shared_page_len = PAGE_SIZE,
 };
+INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec);
 
 static Elf32_Brandinfo freebsd_brand_info = {
.brand  = ELFOSABI_FREEBSD,

Modified: head/sys/powerpc/powerpc/elf64_machdep.c
==
--- head/sys/powerpc/powerpc/elf64_machdep.cFri Jan 14 11:34:58 2011
(r217399)
+++ head/sys/powerpc/powerpc/elf64_machdep.cFri Jan 14 11:36:44 2011
(r217400)
@@ -76,11 +76,14 @@ struct sysentvec elf64_freebsd_sysvec = 
.sv_setregs = exec_setregs,
.sv_fixlimit= NULL,
.sv_maxssiz = NULL,
-   .sv_flags   = SV_ABI_FREEBSD | SV_LP64,
+   .sv_flags   = SV_ABI_FREEBSD | SV_LP64 | SV_SHP,
.sv_set_syscall_retval = cpu_set_syscall_retval,
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
.sv_syscallnames = syscallnames,
+   .sv_shared_page_base = SHAREDPAGE,
+   .sv_shared_page_len = PAGE_SIZE,
 };
+INIT_SYSENTVEC(elf64_sysvec, &elf64_freebsd_sysvec);
 
 static Elf64_Brandinfo freebsd_brand_info = {
.brand  = ELFOSABI_FREEBSD,
@@ -114,7 +117,6 @@ SYSINIT(oelf64, SI_SUB_EXEC, SI_ORDER_AN
(sysinit_cfunc_t) elf64_insert_brand_entry,
&freebsd_brand_oinfo);
 
-
 void
 elf64_dump_thread(struct thread *td __unused, void *dst __unused,
 size_t *off __unused)

Modified: head/sys/powerpc/powerpc/exec_machdep.c
==
--- head/sys/powerpc/powerpc/exec_machdep.c Fri Jan 14 11:34:58 2011
(r217399)
+++ head/sys/powerpc/powerpc/exec_machdep.c Fri Jan 14 11:36:44 2011
(r217400)
@@ -290,8 +290,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, 
mtx_unlock(&psp->ps_mtx);
PROC_UNLOCK(p);
 
-   tf->srr0 = (register_t)(p->p_sysent->sv_psstrings -
-   *(p->p_sysent->sv_szsigcode));
+   tf->srr0 = (register_t)p->p_sysent->sv_sigcode_base;
 
/*
 * copy the frame out to userland.
___
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: r217330 - head/sys/x86/x86

2011-01-14 Thread John Baldwin
On Thursday, January 13, 2011 5:12:47 pm Warner Losh wrote:
> On 01/12/2011 17:06, Bruce Evans wrote:
> > On Wed, 12 Jan 2011, John Baldwin wrote:
> >
> >>> Log:
> >>>   Fix a brain fart.  Since this file is shared between i386 and 
> >>> amd64, a
> >>>   bus_size_t may be 32 or 64 bits.  Change the bounce_zone alignment 
> >>> field
> >>>   to explicitly be 32 bits, as I can't really imagine a DMA device that
> >>>   needs anything close to 2GB alignment of data.
> >>
> >> Hmm, we do have devices with 4GB boundaries though.  I think I'd 
> >> prefer it if
> >> you instead if you did this:
> >>
> >> #if defined(amd64) || defined(PAE)
> >> #defineSYSCTL_ADD_BUS_SIZE_TSYSCTL_ADD_UQUAD
> >> #else
> >> #defineSYSCTL_ADD_BUS_SIZE_TSYSCTL_ADD_UINT
> >> #endif
> >>
> >> and then just used SYSCTL_ADD_BUS_SIZE_T() in the code so we could 
> >> let the
> >> members in the bounce zone retain the same types passed to
> >> bus_dma_tag_create().
> >
> > U_LONG should work on all arches.  malloc(9) still uses u_long instead
> > of size_t.  This works for scalars even on the recently removed i386's
> > with 32-bit longs where u_long is larger than size_t, since larger is
> > a fail-safe direction.  This fails for pointers.  Newer parts of malloc()
> > and uma are broken unless u_long is the same as uintptr_t, since they
> > cast pointers to u_long.  This direction is fail-safe too, but gcc warns
> > about it.
> 
> u_long doesn't work for N32.  There, the pointers may only be 32-bit, 
> but PAs ar 64-bit.  Longs are only 32-bits.

It doesn't work on PAE either.  bus_size_t is not the same as size_t in this
case.

-- 
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: r217401 - stable/8/share/man/man4

2011-01-14 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Jan 14 13:34:56 2011
New Revision: 217401
URL: http://svn.freebsd.org/changeset/base/217401

Log:
  MFC r217135:
  
Clarify when we switch from keepidle to keepinvtl intervals if sending
TCP keepalive probes is enabled.

Modified:
  stable/8/share/man/man4/tcp.4
Directory Properties:
  stable/8/share/man/man4/   (props changed)

Modified: stable/8/share/man/man4/tcp.4
==
--- stable/8/share/man/man4/tcp.4   Fri Jan 14 11:36:44 2011
(r217400)
+++ stable/8/share/man/man4/tcp.4   Fri Jan 14 13:34:56 2011
(r217401)
@@ -32,7 +32,7 @@
 .\" From: @(#)tcp.48.1 (Berkeley) 6/5/93
 .\" $FreeBSD$
 .\"
-.Dd August 16, 2008
+.Dd January 8, 2011
 .Dt TCP 4
 .Os
 .Sh NAME
@@ -289,7 +289,9 @@ Amount of time, in milliseconds, that th
 before keepalive probes (if enabled) are sent.
 .It Va keepintvl
 The interval, in milliseconds, between keepalive probes sent to remote
-machines.
+machines, when no response is received on a
+.Va keepidle
+probe.
 After
 .Dv TCPTV_KEEPCNT
 (default 8) probes are sent, with no response, the connection is dropped.
___
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: r217402 - stable/7/share/man/man4

2011-01-14 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Jan 14 13:35:55 2011
New Revision: 217402
URL: http://svn.freebsd.org/changeset/base/217402

Log:
  MFC r217135:
  
Clarify when we switch from keepidle to keepinvtl intervals if sending
TCP keepalive probes is enabled.

Modified:
  stable/7/share/man/man4/tcp.4
Directory Properties:
  stable/7/share/man/man4/   (props changed)

Modified: stable/7/share/man/man4/tcp.4
==
--- stable/7/share/man/man4/tcp.4   Fri Jan 14 13:34:56 2011
(r217401)
+++ stable/7/share/man/man4/tcp.4   Fri Jan 14 13:35:55 2011
(r217402)
@@ -32,7 +32,7 @@
 .\" From: @(#)tcp.48.1 (Berkeley) 6/5/93
 .\" $FreeBSD$
 .\"
-.Dd February 28, 2007
+.Dd January 8, 2011
 .Dt TCP 4
 .Os
 .Sh NAME
@@ -289,7 +289,9 @@ Amount of time, in milliseconds, that th
 before keepalive probes (if enabled) are sent.
 .It Va keepintvl
 The interval, in milliseconds, between keepalive probes sent to remote
-machines.
+machines, when no response is received on a
+.Va keepidle
+probe.
 After
 .Dv TCPTV_KEEPCNT
 (default 8) probes are sent, with no response, the connection is dropped.
___
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: r217403 - stable/8/sys/net

2011-01-14 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Jan 14 14:20:54 2011
New Revision: 217403
URL: http://svn.freebsd.org/changeset/base/217403

Log:
  MFC r217203:
  
MfP4 CH=185246 [1]:
  
  Add FEATURE() to announce optional VIMAGE.
  
[1] for the moment put it in vnet.c.

Modified:
  stable/8/sys/net/vnet.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)

Modified: stable/8/sys/net/vnet.c
==
--- stable/8/sys/net/vnet.c Fri Jan 14 13:35:55 2011(r217402)
+++ stable/8/sys/net/vnet.c Fri Jan 14 14:20:54 2011(r217403)
@@ -80,6 +80,8 @@ __FBSDID("$FreeBSD$");
  *   stack instance.
  */
 
+FEATURE(vimage, "VIMAGE kernel virtualization");
+
 MALLOC_DEFINE(M_VNET, "vnet", "network stack control block");
 
 /*
___
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: r217391 - in head/release: amd64 i386 ia64 pc98 powerpc sparc64 sun4v

2011-01-14 Thread Nathan Whitehorn

On 01/14/11 04:56, Takahashi Yoshihiro wrote:

Author: nyan
Date: Fri Jan 14 10:56:44 2011
New Revision: 217391
URL: http://svn.freebsd.org/changeset/base/217391

Log:
   Fix making a release.  The old libdialog was renamed to libodialog.


Ack, I guess I missed this one. Thank you for fixing it!
-Nathan

___
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: r217369 - in head/sys: cam/scsi sys

2011-01-14 Thread mdf
On Thu, Jan 13, 2011 at 10:50 PM, Bruce Evans  wrote:
> On Thu, 13 Jan 2011 m...@freebsd.org wrote:
>
>> There appear to be 330 uses of SYSCTL and QUAD on the same line in
>> CURRENT.  This seems reasonable to change them to S64, U64 and X64 so
>> they correctly reflect the size they operate upon.
>>
>> What do y'all think?
>
> Now I suggest delaying this until they can be renamed to a type- generic
> SYSCTL_INT() (would probably need to be spelled differently, SYSCTL_I()
> say, even if SYSCTL_INT() was changed at the same time).

I'm torn on this one.  The compiler knows the type (unless, for
SYSCTL_INT, NULL/0 is used, but that is also a compile-time check),
but to interpret it requires the use of __builtin_foo which is a gcc
extension and not part of standard C.

Philosophically, while I like this kind of letting the compiler do the
work, if you want C++ you know where to find it.

Thanks,
matthew
___
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: r217369 - in head/sys: cam/scsi sys

2011-01-14 Thread mdf
On Thu, Jan 13, 2011 at 9:56 PM, Bruce Evans  wrote:
> On Thu, 13 Jan 2011, Matthew D Fleming wrote:
>
>> Log:
>>  Add a 64-bit hex-printed sysctl(9) since there is at least one place in
>>  the code that wanted it.  It is named X64 rather than XQUAD since the
>>  quad name is a historical abomination that should not be perpetuated.
>
> :-).  It is only long long that is abominable.  Both are historical.
>
> I think these X formats shouldn't exist, even as defaults.  Instead,
> sysctl(8) should have option(s) to control the format.  I'm used to
> typing lots of "p/x"s to get hex formatting in gdb.  There is little
> reason for sysctl(8) to have finer-grained control than gdb (sysctl
> now has hard-coded defaults instead of control).
>
> Now with stricter type checking, even formats for integers are redundant.
> The CTLTYPE now always matches the type, and the format should always
> match the type.  The space wasted for the format is 1 pointer plus the
> string.

There are several issues here.  First, for OPAQUE types the string is
interpreted by sysctl(8) to know how to interpret the binary blob.
Second, anyone can still use SYSCTL_OID(... CTLTYPE_INT, ..., "QU")
and there's not a lot that can be done to check it.  Locally I have
another patch for the various sysctl_handle_foo that asserts the
CTLTYPE_FOO matches the handler, but looking around the FreeBSD code
there's plenty of hand-rolled instances that won't pass; some of these
come from a SYSCTL_PROC setup.  Perhaps we could start with a warning
message and upgrade to a KASSERT later.

Thirdly, at the moment sysctl(8) doesn't fetch the access flags and
type specifier and only looks at the string.  This is also fixable.

I do agree that the incredibly limited use of XINT, XLONG, and the one
use of X64 mean that it's not a widely used feature, and can probably
be better done with a -x flag to sysctl(8).  Most bitflags are still
added as SYSCTL_UINT, so one has to re-interpret the value anyways to
see which bits are set.

> Perhaps there are some remaining type errors involving the kernel type
> being signed when it should be unsigned, or vice versa.  This could
> be "fixed" by mis-specifying the format with a U, or vice versa.  Since
> the specification is usually done by invoking a SYSCTL*() macro, most
> such fixes, if any, would have been undone by changing the macro to
> match the type, and it would take fixing the kernel type to fix the
> userland format.

The framework is in place to fix the obvious type errors for scalar
types, but I haven't yet finished making the kernel compile cleanly in
universe mode.  Until then the check is still if 0'd out.

Thanks,
matthew


>
>> Modified: head/sys/cam/scsi/scsi_da.c
>>
>> ==
>> --- head/sys/cam/scsi/scsi_da.c Thu Jan 13 18:20:27 2011        (r217368)
>> +++ head/sys/cam/scsi/scsi_da.c Thu Jan 13 18:20:33 2011        (r217369)
>> @@ -1127,9 +1127,9 @@ dasysctlinit(void *context, int pending)
>>                struct ccb_trans_settings_fc *fc = &cts.xport_specific.fc;
>>                if (fc->valid & CTS_FC_VALID_WWPN) {
>>                        softc->wwpn = fc->wwpn;
>> -                       SYSCTL_ADD_XLONG(&softc->sysctl_ctx,
>> +                       SYSCTL_ADD_X64(&softc->sysctl_ctx,
>>                            SYSCTL_CHILDREN(softc->sysctl_tree),
>> -                           OID_AUTO, "wwpn", CTLTYPE_QUAD | CTLFLAG_RD,
>> +                           OID_AUTO, "wwpn", CTLFLAG_RD,
>>                            &softc->wwpn, "World Wide Port Name");
>>                }
>>        }
>>
>
> Hmm, forcing hex might be best for flags (but I'll ask for binary then :-)
> and for mac addresses, but not for inet4 addresses.  I don't know what sort
> of address this is.
>
> Bruce
>
___
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: r217408 - stable/8/sys/i386/i386

2011-01-14 Thread Colin Percival
Author: cperciva
Date: Fri Jan 14 16:30:22 2011
New Revision: 217408
URL: http://svn.freebsd.org/changeset/base/217408

Log:
  Don't use amdc1e on XEN && !XEN_PRIVILEGED.  The Xen hypervisor
  gets justifiably annoyed when a guest OS tries to halt the CPU.
  This fixes a panic when booting FreeBSD/XEN on recent AMD CPUs.
  
  This is not an MFC; the problem was (accidentally?) fixed in HEAD
  four months ago via SVN r212541.

Modified:
  stable/8/sys/i386/i386/machdep.c

Modified: stable/8/sys/i386/i386/machdep.c
==
--- stable/8/sys/i386/i386/machdep.cFri Jan 14 15:15:33 2011
(r217407)
+++ stable/8/sys/i386/i386/machdep.cFri Jan 14 16:30:22 2011
(r217408)
@@ -1228,6 +1228,7 @@ cpu_idle_acpi(int busy)
 
 static int cpu_ident_amdc1e = 0;
 
+#if !defined(XEN) || defined(XEN_PRIVILEGED)
 static int
 cpu_probe_amdc1e(void)
 { 
@@ -1254,6 +1255,7 @@ cpu_probe_amdc1e(void)
 #endif
return (0);
 }
+#endif
 
 /*
  * C1E renders the local APIC timer dead, so we disable it by
@@ -2690,8 +2692,10 @@ init386(first)
thread0.td_pcb->pcb_fsd = PCPU_GET(fsgs_gdt)[0];
thread0.td_pcb->pcb_gsd = PCPU_GET(fsgs_gdt)[1];
 
+#if defined(XEN_PRIVILEGED)
if (cpu_probe_amdc1e())
cpu_idle_fn = cpu_idle_amdc1e;
+#endif
 }
 
 #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"


svn commit: r217410 - in head/sys: kern sys

2011-01-14 Thread John Baldwin
Author: jhb
Date: Fri Jan 14 17:06:54 2011
New Revision: 217410
URL: http://svn.freebsd.org/changeset/base/217410

Log:
  Rework realtime priority support:
  - Move the realtime priority range up above kernel sleep priorities and
just below interrupt thread priorities.
  - Contract the interrupt and kernel sleep priority ranges a bit so that
the timesharing priority band can be increased.  The new timeshare range
is now slightly larger than the old realtime + timeshare ranges.
  - Change the ULE scheduler to no longer use realtime priorities for
interactive threads.  Instead, the larger timeshare range is now split
into separate subranges for interactive and non-interactive ("batch")
threads.  The end result is that interactive threads and non-interactive
threads still use the same priority ranges as before, but realtime
threads now have a separate, dedicated priority range.
  - Do not modify the priority of non-timeshare threads in sched_sleep()
or via cv_broadcastpri().  Realtime and idle priority threads will
no longer have their priorities affected by sleeping in the kernel.
  
  Reviewed by:  jeff

Modified:
  head/sys/kern/sched_4bsd.c
  head/sys/kern/sched_ule.c
  head/sys/kern/subr_sleepqueue.c
  head/sys/sys/priority.h

Modified: head/sys/kern/sched_4bsd.c
==
--- head/sys/kern/sched_4bsd.c  Fri Jan 14 16:42:13 2011(r217409)
+++ head/sys/kern/sched_4bsd.c  Fri Jan 14 17:06:54 2011(r217410)
@@ -908,7 +908,7 @@ sched_sleep(struct thread *td, int pri)
THREAD_LOCK_ASSERT(td, MA_OWNED);
td->td_slptick = ticks;
td->td_sched->ts_slptime = 0;
-   if (pri)
+   if (pri != 0 && PRI_BASE(td->td_pri_class) == PRI_TIMESHARE)
sched_prio(td, pri);
if (TD_IS_SUSPENDED(td) || pri >= PSOCK)
td->td_flags |= TDF_CANSWAP;

Modified: head/sys/kern/sched_ule.c
==
--- head/sys/kern/sched_ule.c   Fri Jan 14 16:42:13 2011(r217409)
+++ head/sys/kern/sched_ule.c   Fri Jan 14 17:06:54 2011(r217410)
@@ -118,11 +118,17 @@ static struct td_sched td_sched0;
 
 /*
  * Priority ranges used for interactive and non-interactive timeshare
- * threads.  Interactive threads use realtime priorities.
- */
-#definePRI_MIN_INTERACTPRI_MIN_REALTIME
-#definePRI_MAX_INTERACTPRI_MAX_REALTIME
-#definePRI_MIN_BATCH   PRI_MIN_TIMESHARE
+ * threads.  The timeshare priorities are split up into four ranges.
+ * The first range handles interactive threads.  The last three ranges
+ * (NHALF, x, and NHALF) handle non-interactive threads with the outer
+ * ranges supporting nice values.
+ */
+#definePRI_TIMESHARE_RANGE (PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE 
+ 1)
+#definePRI_INTERACT_RANGE  ((PRI_TIMESHARE_RANGE - 
SCHED_PRI_NRESV) / 2)
+
+#definePRI_MIN_INTERACTPRI_MIN_TIMESHARE
+#definePRI_MAX_INTERACT(PRI_MIN_TIMESHARE + PRI_INTERACT_RANGE 
- 1)
+#definePRI_MIN_BATCH   (PRI_MIN_TIMESHARE + PRI_INTERACT_RANGE)
 #definePRI_MAX_BATCH   PRI_MAX_TIMESHARE
 
 /*
@@ -1893,6 +1899,8 @@ sched_sleep(struct thread *td, int prio)
td->td_slptick = ticks;
if (TD_IS_SUSPENDED(td) || prio >= PSOCK)
td->td_flags |= TDF_CANSWAP;
+   if (PRI_BASE(td->td_pri_class) != PRI_TIMESHARE)
+   return;
if (static_boost == 1 && prio)
sched_prio(td, prio);
else if (static_boost && td->td_priority > static_boost)

Modified: head/sys/kern/subr_sleepqueue.c
==
--- head/sys/kern/subr_sleepqueue.c Fri Jan 14 16:42:13 2011
(r217409)
+++ head/sys/kern/subr_sleepqueue.c Fri Jan 14 17:06:54 2011
(r217410)
@@ -745,7 +745,8 @@ sleepq_resume_thread(struct sleepqueue *
 
/* Adjust priority if requested. */
MPASS(pri == 0 || (pri >= PRI_MIN && pri <= PRI_MAX));
-   if (pri != 0 && td->td_priority > pri)
+   if (pri != 0 && td->td_priority > pri &&
+   PRI_BASE(td->td_pri_class) == PRI_TIMESHARE)
sched_prio(td, pri);
 
/*

Modified: head/sys/sys/priority.h
==
--- head/sys/sys/priority.h Fri Jan 14 16:42:13 2011(r217409)
+++ head/sys/sys/priority.h Fri Jan 14 17:06:54 2011(r217410)
@@ -67,10 +67,10 @@
  * Priorities range from 0 to 255, but differences of less then 4 (RQ_PPQ)
  * are insignificant.  Ranges are as follows:
  *
- * Interrupt threads:  0 - 63
- * Top half kernel threads:64 - 127
- * Realtime user threads:  128 - 159
- * Time sharing user threads:  160 - 223
+ * Interrupt threads:  0 - 47
+ * Realtime user thr

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

2011-01-14 Thread Marius Strobl
Author: marius
Date: Fri Jan 14 19:16:59 2011
New Revision: 217412
URL: http://svn.freebsd.org/changeset/base/217412

Log:
  - Masking IFM_GMASK when also masking IFM_FDX is redundant and just
complicates the code.
  - Don't let atphy_setmedia() announce PAUSE support for half-duplex when
MIIF_FORCEPAUSE is set.
  - Simplify e1000phy_service() and ip1000phy_service() to only set the
manual configuration bits once after we have figured them all out. For
ip1000phy_service() this also means we no longer unnecessarily update
the hardware along the road.
  
  MFC after:1 week

Modified:
  head/sys/dev/mii/atphy.c
  head/sys/dev/mii/e1000phy.c
  head/sys/dev/mii/ip1000phy.c

Modified: head/sys/dev/mii/atphy.c
==
--- head/sys/dev/mii/atphy.cFri Jan 14 18:43:14 2011(r217411)
+++ head/sys/dev/mii/atphy.cFri Jan 14 19:16:59 2011(r217412)
@@ -187,9 +187,9 @@ atphy_service(struct mii_softc *sc, stru
}
 
anar = atphy_anar(ife);
-   if (((ife->ifm_media & IFM_GMASK) & IFM_FDX) != 0) {
+   if ((ife->ifm_media & IFM_FDX) != 0) {
bmcr |= BMCR_FDX;
-   if (((ife->ifm_media & IFM_GMASK) & IFM_FLOW) != 0 ||
+   if ((ife->ifm_media & IFM_FLOW) != 0 ||
(sc->mii_flags & MIIF_FORCEPAUSE) != 0)
anar |= ANAR_PAUSE_TOWARDS;
}
@@ -371,7 +371,7 @@ atphy_anar(struct ifmedia_entry *ife)
return (0);
}
 
-   if (((ife->ifm_media & IFM_GMASK) & IFM_FDX) != 0) {
+   if ((ife->ifm_media & IFM_FDX) != 0) {
if (IFM_SUBTYPE(ife->ifm_media) == IFM_100_TX)
anar |= ANAR_TX_FD;
else
@@ -387,13 +387,13 @@ atphy_setmedia(struct mii_softc *sc, int
uint16_t anar;
 
anar = BMSR_MEDIA_TO_ANAR(sc->mii_capabilities) | ANAR_CSMA;
-   if (((IFM_SUBTYPE(media) == IFM_AUTO ||
-   ((media & IFM_GMASK) & IFM_FDX) != 0) &&
-   ((media & IFM_GMASK) & IFM_FLOW) != 0) ||
-   (sc->mii_flags & MIIF_FORCEPAUSE) != 0)
+   if ((IFM_SUBTYPE(media) == IFM_AUTO || (media & IFM_FDX) != 0) &&
+   ((media & IFM_FLOW) != 0 ||
+   (sc->mii_flags & MIIF_FORCEPAUSE) != 0))
anar |= ANAR_PAUSE_TOWARDS;
PHY_WRITE(sc, MII_ANAR, anar);
-   if ((sc->mii_extcapabilities & (EXTSR_1000TFDX | EXTSR_1000THDX)) != 0)
+   if ((sc->mii_extcapabilities &
+(EXTSR_1000TFDX | EXTSR_1000THDX)) != 0)
PHY_WRITE(sc, MII_100T2CR, GTCR_ADV_1000TFDX |
GTCR_ADV_1000THDX);
PHY_WRITE(sc, MII_BMCR, BMCR_RESET | BMCR_AUTOEN | BMCR_STARTNEG);

Modified: head/sys/dev/mii/e1000phy.c
==
--- head/sys/dev/mii/e1000phy.c Fri Jan 14 18:43:14 2011(r217411)
+++ head/sys/dev/mii/e1000phy.c Fri Jan 14 19:16:59 2011(r217412)
@@ -358,7 +358,7 @@ e1000phy_service(struct mii_softc *sc, s
return (EINVAL);
}
 
-   if (((ife->ifm_media & IFM_GMASK) & IFM_FDX) != 0) {
+   if ((ife->ifm_media & IFM_FDX) != 0) {
speed |= E1000_CR_FULL_DUPLEX;
gig = E1000_1GCR_1000T_FD;
} else
@@ -372,10 +372,10 @@ e1000phy_service(struct mii_softc *sc, s
gig |= E1000_1GCR_MS_ENABLE;
if ((ife->ifm_media & IFM_ETH_MASTER) != 0) 
gig |= E1000_1GCR_MS_VALUE;
-   PHY_WRITE(sc, E1000_1GCR, gig);
} else if ((sc->mii_extcapabilities &
(EXTSR_1000TFDX | EXTSR_1000THDX)) != 0)
-   PHY_WRITE(sc, E1000_1GCR, 0);
+   gig = 0;
+   PHY_WRITE(sc, E1000_1GCR, gig);
PHY_WRITE(sc, E1000_AR, E1000_AR_SELECTOR_FIELD);
PHY_WRITE(sc, E1000_CR, speed | E1000_CR_RESET);
 done:

Modified: head/sys/dev/mii/ip1000phy.c
==
--- head/sys/dev/mii/ip1000phy.cFri Jan 14 18:43:14 2011
(r217411)
+++ head/sys/dev/mii/ip1000phy.cFri Jan 14 19:16:59 2011
(r217412)
@@ -186,22 +186,21 @@ ip1000phy_service(struct mii_softc *sc, 
return (EINVAL);
}
 
-   if (((ife->ifm_media & IFM_GMASK) & IFM_FDX) != 0) {
+   if ((ife->ifm_media & IFM_FDX) != 0) {
speed |= IP1000PHY_BMCR_FDX;
gig = IP1000PHY_1000CR_1000T_FDX;
} else
gig = IP1000PHY_1000CR_1000T;
 
-   PHY_WRITE(sc, IP1000PHY_MII_1000CR, 0);
-   PHY_WRITE(sc, IP1000PHY_MII_BMCR

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

2011-01-14 Thread Marius Strobl
Author: marius
Date: Fri Jan 14 19:29:53 2011
New Revision: 217413
URL: http://svn.freebsd.org/changeset/base/217413

Log:
  - Even after masking the media with IFM_GMASK the result may have bits
besides the duplex ones set so just comparing it with IFM_FDX may lead
to false negatives.
  - Simplify ciphy_service() to only set the manual configuration bits
once after we have figured them all out. This also means we no longer
unnecessarily update the hardware along the road.
  
  MFC after:1 week

Modified:
  head/sys/dev/mii/brgphy.c
  head/sys/dev/mii/ciphy.c
  head/sys/dev/mii/xmphy.c

Modified: head/sys/dev/mii/brgphy.c
==
--- head/sys/dev/mii/brgphy.c   Fri Jan 14 19:16:59 2011(r217412)
+++ head/sys/dev/mii/brgphy.c   Fri Jan 14 19:29:53 2011(r217413)
@@ -453,7 +453,7 @@ brgphy_setmedia(struct mii_softc *sc, in
break;
}
 
-   if ((media & IFM_GMASK) == IFM_FDX) {
+   if ((media & IFM_FDX) != 0) {
bmcr |= BRGPHY_BMCR_FDX;
gig = BRGPHY_1000CTL_AFD;
} else {

Modified: head/sys/dev/mii/ciphy.c
==
--- head/sys/dev/mii/ciphy.cFri Jan 14 19:16:59 2011(r217412)
+++ head/sys/dev/mii/ciphy.cFri Jan 14 19:29:53 2011(r217413)
@@ -176,26 +176,23 @@ ciphy_service(struct mii_softc *sc, stru
case IFM_10_T:
speed = CIPHY_S10;
 setit:
-   if ((ife->ifm_media & IFM_GMASK) == IFM_FDX) {
+   if ((ife->ifm_media & IFM_FDX) != 0) {
speed |= CIPHY_BMCR_FDX;
gig = CIPHY_1000CTL_AFD;
-   } else {
+   } else
gig = CIPHY_1000CTL_AHD;
-   }
 
-   PHY_WRITE(sc, CIPHY_MII_1000CTL, 0);
+   if (IFM_SUBTYPE(ife->ifm_media) == IFM_1000_T) {
+   gig |= CIPHY_1000CTL_MSE;
+   if ((ife->ifm_media & IFM_ETH_MASTER) != 0)
+   gig |= CIPHY_1000CTL_MSC;
+   speed |=
+   CIPHY_BMCR_AUTOEN | CIPHY_BMCR_STARTNEG;
+   } else
+   gig = 0;
+   PHY_WRITE(sc, CIPHY_MII_1000CTL, gig);
PHY_WRITE(sc, CIPHY_MII_BMCR, speed);
PHY_WRITE(sc, CIPHY_MII_ANAR, CIPHY_SEL_TYPE);
-
-   if (IFM_SUBTYPE(ife->ifm_media) != IFM_1000_T)
-   break;
-
-   gig |= CIPHY_1000CTL_MSE;
-   if ((ife->ifm_media & IFM_ETH_MASTER) != 0)
-   gig |= CIPHY_1000CTL_MSC;
-   PHY_WRITE(sc, CIPHY_MII_1000CTL, gig);
-   PHY_WRITE(sc, CIPHY_MII_BMCR,
-   speed | CIPHY_BMCR_AUTOEN | CIPHY_BMCR_STARTNEG);
break;
case IFM_NONE:
PHY_WRITE(sc, MII_BMCR, BMCR_ISO | BMCR_PDOWN);

Modified: head/sys/dev/mii/xmphy.c
==
--- head/sys/dev/mii/xmphy.cFri Jan 14 19:16:59 2011(r217412)
+++ head/sys/dev/mii/xmphy.cFri Jan 14 19:29:53 2011(r217413)
@@ -171,7 +171,7 @@ xmphy_service(struct mii_softc *sc, stru
break;
case IFM_1000_SX:
mii_phy_reset(sc);
-   if ((ife->ifm_media & IFM_GMASK) == IFM_FDX) {
+   if ((ife->ifm_media & IFM_FDX) != 0) {
PHY_WRITE(sc, XMPHY_MII_ANAR, XMPHY_ANAR_FDX);
PHY_WRITE(sc, XMPHY_MII_BMCR, XMPHY_BMCR_FDX);
} 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"


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

2011-01-14 Thread Marius Strobl
Author: marius
Date: Fri Jan 14 19:33:58 2011
New Revision: 217414
URL: http://svn.freebsd.org/changeset/base/217414

Log:
  - Don't announce PAUSE support for half-duplex when MIIF_FORCEPAUSE is
set.
  - Let mii_phy_auto() also announce PAUSE support for 10baseT-FDX.
  
  MFC after:1 week

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

Modified: head/sys/dev/mii/jmphy.c
==
--- head/sys/dev/mii/jmphy.cFri Jan 14 19:29:53 2011(r217413)
+++ head/sys/dev/mii/jmphy.cFri Jan 14 19:33:58 2011(r217414)
@@ -373,10 +373,10 @@ jmphy_setmedia(struct mii_softc *sc, str
bmcr |= BMCR_LOOP;
 
anar = jmphy_anar(ife);
-   if (((IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO ||
+   if ((IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO ||
(ife->ifm_media & IFM_FDX) != 0) &&
-   (ife->ifm_media & IFM_FLOW) != 0) ||
-   (sc->mii_flags & MIIF_FORCEPAUSE) != 0)
+   ((ife->ifm_media & IFM_FLOW) != 0 ||
+   (sc->mii_flags & MIIF_FORCEPAUSE) != 0))
anar |= ANAR_PAUSE_TOWARDS;
 
if ((sc->mii_flags & MIIF_HAVE_GTCR) != 0) {

Modified: head/sys/dev/mii/mii_physubr.c
==
--- head/sys/dev/mii/mii_physubr.c  Fri Jan 14 19:29:53 2011
(r217413)
+++ head/sys/dev/mii/mii_physubr.c  Fri Jan 14 19:33:58 2011
(r217414)
@@ -135,8 +135,9 @@ mii_phy_setmedia(struct mii_softc *sc)
gtcr |= GTCR_ADV_MS;
}
 
-   if ((ife->ifm_media & IFM_GMASK) == (IFM_FDX | IFM_FLOW) ||
-   (sc->mii_flags & MIIF_FORCEPAUSE) != 0) {
+   if ((ife->ifm_media & IFM_FDX) != 0 &&
+   ((ife->ifm_media & IFM_FLOW) != 0 ||
+   (sc->mii_flags & MIIF_FORCEPAUSE) != 0)) {
if ((sc->mii_flags & MIIF_IS_1000X) != 0)
anar |= ANAR_X_PAUSE_TOWARDS;
else {
@@ -184,7 +185,8 @@ mii_phy_auto(struct mii_softc *sc)
ANAR_CSMA;
if ((ife->ifm_media & IFM_FLOW) != 0 ||
(sc->mii_flags & MIIF_FORCEPAUSE) != 0) {
-   if ((sc->mii_capabilities & BMSR_100TXFDX) != 0)
+   if ((sc->mii_capabilities &
+   (BMSR_10TFDX | BMSR_100TXFDX)) != 0)
anar |= ANAR_FC;
/* XXX Only 1000BASE-T has PAUSE_ASYM? */
if (((sc->mii_flags & MIIF_HAVE_GTCR) != 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: r217415 - head/sys/dev/mii

2011-01-14 Thread Marius Strobl
Author: marius
Date: Fri Jan 14 19:39:12 2011
New Revision: 217415
URL: http://svn.freebsd.org/changeset/base/217415

Log:
  - Allow IFM_FLAG0 to be set indicating that auto-negotiation with manual
configuration, which is used to work around issues with certain setups
(see r161237) by default, should not be triggered as it may in turn
cause harm in some edge cases.
  - Even after masking the media with IFM_GMASK the result may have bits
besides the duplex ones set so just comparing it with IFM_FDX may lead
to false negatives.
  - Announce PAUSE support also for manually selected 1000BASE-T, but for
all manually selected media types only in full-duplex mode. Announce
asymmetric PAUSE support only for manually selected 1000BASE-T.
  - Simplify setting the manual configuration bits to only once after we
have figured them all out. This also means we no longer unnecessarily
update the hardware along the road.
  - Remove a stale comment.
  
  Reviewed by:  yongari (plus additional testing)
  MFC after:3 days

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

Modified: head/sys/dev/mii/rgephy.c
==
--- head/sys/dev/mii/rgephy.c   Fri Jan 14 19:33:58 2011(r217414)
+++ head/sys/dev/mii/rgephy.c   Fri Jan 14 19:39:12 2011(r217415)
@@ -146,6 +146,13 @@ rgephy_attach(device_t dev)
mii_phy_add_media(sc);
printf("\n");
 #undef ADD
+   /*
+* Allow IFM_FLAG0 to be set indicating that auto-negotiation with
+* manual configuration, which is used to work around issues with
+* certain setups by default, should not be triggered as it may in
+* turn cause harm in some edge cases.
+*/
+   mii->mii_media.ifm_mask |= IFM_FLAG0;
 
rgephy_reset(sc);
MIIBUS_MEDIAINIT(sc->mii_dev);
@@ -201,37 +208,38 @@ rgephy_service(struct mii_softc *sc, str
speed = RGEPHY_S10;
anar |= RGEPHY_ANAR_10_FD | RGEPHY_ANAR_10;
 setit:
-   rgephy_loop(sc);
-   if ((ife->ifm_media & IFM_GMASK) == IFM_FDX) {
+   if ((ife->ifm_media & IFM_FLOW) != 0 &&
+   (mii->mii_media.ifm_media & IFM_FLAG0) != 0)
+   return (EINVAL);
+
+   if ((ife->ifm_media & IFM_FDX) != 0) {
speed |= RGEPHY_BMCR_FDX;
gig = RGEPHY_1000CTL_AFD;
anar &= ~(RGEPHY_ANAR_TX | RGEPHY_ANAR_10);
+   if ((ife->ifm_media & IFM_FLOW) != 0 ||
+   (sc->mii_flags & MIIF_FORCEPAUSE) != 0)
+   anar |=
+   RGEPHY_ANAR_PC | RGEPHY_ANAR_ASP;
} else {
gig = RGEPHY_1000CTL_AHD;
anar &=
~(RGEPHY_ANAR_TX_FD | RGEPHY_ANAR_10_FD);
}
-
-   if (IFM_SUBTYPE(ife->ifm_media) != IFM_1000_T) {
-   PHY_WRITE(sc, RGEPHY_MII_1000CTL, 0);
-   PHY_WRITE(sc, RGEPHY_MII_ANAR, anar);
-   PHY_WRITE(sc, RGEPHY_MII_BMCR, speed |
-   RGEPHY_BMCR_AUTOEN |
-   RGEPHY_BMCR_STARTNEG);
-   break;
+   if (IFM_SUBTYPE(ife->ifm_media) == IFM_1000_T) {
+   gig |= RGEPHY_1000CTL_MSE;
+   if ((ife->ifm_media & IFM_ETH_MASTER) != 0)
+   gig |= RGEPHY_1000CTL_MSC;
+   } else {
+   gig = 0;
+   anar &= ~RGEPHY_ANAR_ASP;
}
-
-   if ((ife->ifm_media & IFM_FLOW) != 0 ||
-   (sc->mii_flags & MIIF_FORCEPAUSE) != 0)
-   anar |= RGEPHY_ANAR_PC | RGEPHY_ANAR_ASP;
-
-   gig |= RGEPHY_1000CTL_MSE;
-   if ((ife->ifm_media & IFM_ETH_MASTER) != 0)
-   gig |= RGEPHY_1000CTL_MSC;
+   if ((mii->mii_media.ifm_media & IFM_FLAG0) == 0)
+   speed |=
+   RGEPHY_BMCR_AUTOEN | RGEPHY_BMCR_STARTNEG;
+   rgephy_loop(sc);
PHY_WRITE(sc, RGEPHY_MII_1000CTL, gig);
PHY_WRITE(sc, RGEPHY_MII_ANAR, anar);
-   PHY_WRITE(sc, RGEPHY_MII_BMCR, speed |
-   RGEPHY_BMCR_AUTOEN | RGEPHY_BMCR_STARTNEG);
+   PHY_WRITE(sc, RGEPHY_MII_BMCR, speed);
break;
case IFM_NO

svn commit: r217416 - head/usr.bin/cpuset

2011-01-14 Thread John Baldwin
Author: jhb
Date: Fri Jan 14 19:57:28 2011
New Revision: 217416
URL: http://svn.freebsd.org/changeset/base/217416

Log:
  Add two more features to cpuset(1):
  - Add a new -C flag to create a new cpuset and move an existing pid into
   that set.
  - Allow 'all' to be specified for a cpu list (e.g. cpuset -s 1 -l all)
   which maps to the list of all CPUs in the system.
  
  MFC after:2 weeks

Modified:
  head/usr.bin/cpuset/cpuset.1
  head/usr.bin/cpuset/cpuset.c

Modified: head/usr.bin/cpuset/cpuset.1
==
--- head/usr.bin/cpuset/cpuset.1Fri Jan 14 19:39:12 2011
(r217415)
+++ head/usr.bin/cpuset/cpuset.1Fri Jan 14 19:57:28 2011
(r217416)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 29, 2008
+.Dd January 14, 2011
 .Dt CPUSET 1
 .Os
 .Sh NAME
@@ -41,6 +41,11 @@
 .Op Fl s Ar setid
 .Fl p Ar pid
 .Nm
+.Op Fl c
+.Op Fl l Ar cpu-list
+.Fl C
+.Fl p Ar pid
+.Nm
 .Op Fl cr
 .Op Fl l Ar cpu-list
 .Op Fl j Ar jailid | Fl p Ar pid | Fl t Ar tid | Fl s Ar setid | Fl x Ar irq
@@ -98,6 +103,8 @@ for the thread.
 .Pp
 The options are as follows:
 .Bl -tag -width ".Fl l Ar cpu-list"
+.It Fl C
+Create a new cpuset and assign the target process to that set.
 .It Fl c
 The requested operation should reference the cpuset available via the
 target specifier.
@@ -117,6 +124,9 @@ Specifies a jail id as the target of the
 Specifies a list of CPUs to apply to a target.
 Specification may include
 numbers separated by '-' for ranges and commas separating individual numbers.
+A special list of
+.Dq all
+may be specified in which case the list includes all CPUs from the root set.
 .It Fl p Ar pid
 Specifies a pid as the target of the operation.
 .It Fl s Ar setid
@@ -168,6 +178,11 @@ into the specified cpuset
 .Ar setid
 so it may be managed with other pids in that set:
 .Dl cpuset -s  -p 
+.Pp
+Create a new cpuset that is restricted to CPUs 0 and 2 and move
+.Ar pid
+into the new set:
+.Dl cpuset -C -c -l 0,2 -p 
 .Sh SEE ALSO
 .Xr cpuset 2
 .Sh HISTORY

Modified: head/usr.bin/cpuset/cpuset.c
==
--- head/usr.bin/cpuset/cpuset.cFri Jan 14 19:39:12 2011
(r217415)
+++ head/usr.bin/cpuset/cpuset.cFri Jan 14 19:57:28 2011
(r217416)
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+int Cflag;
 int cflag;
 int gflag;
 int iflag;
@@ -72,6 +73,12 @@ parselist(char *list, cpuset_t *mask)
int curnum;
char *l;
 
+   if (strcasecmp(list, "all") == 0) {
+   if (cpuset_getaffinity(CPU_LEVEL_ROOT, CPU_WHICH_PID, -1,
+   sizeof(*mask), mask) != 0)
+   err(EXIT_FAILURE, "getaffinity");
+   return;
+   }
state = NONE;
curnum = lastnum = 0;
for (l = list; *l != '\0';) {
@@ -199,8 +206,11 @@ main(int argc, char *argv[])
level = CPU_LEVEL_WHICH;
which = CPU_WHICH_PID;
id = pid = tid = setid = -1;
-   while ((ch = getopt(argc, argv, "cgij:l:p:rs:t:x:")) != -1) {
+   while ((ch = getopt(argc, argv, "Ccgij:l:p:rs:t:x:")) != -1) {
switch (ch) {
+   case 'C':
+   Cflag = 1;
+   break;
case 'c':
if (rflag)
usage();
@@ -255,7 +265,7 @@ main(int argc, char *argv[])
argc -= optind;
argv += optind;
if (gflag) {
-   if (argc || lflag)
+   if (argc || Cflag || lflag)
usage();
/* Only one identity specifier. */
if (jflag + xflag + sflag + pflag + tflag > 1)
@@ -272,7 +282,7 @@ main(int argc, char *argv[])
 * The user wants to run a command with a set and possibly cpumask.
 */
if (argc) {
-   if (pflag | rflag | tflag | xflag | jflag)
+   if (Cflag | pflag | rflag | tflag | xflag | jflag)
usage();
if (sflag) {
if (cpuset_setid(CPU_WHICH_PID, -1, setid))
@@ -293,9 +303,11 @@ main(int argc, char *argv[])
/*
 * We're modifying something that presently exists.
 */
+   if (Cflag && (sflag || rflag || !pflag || tflag || xflag || jflag))
+   usage();
if (!lflag && (cflag || rflag))
usage();
-   if (!lflag && !sflag)
+   if (!lflag && !(Cflag || sflag))
usage();
/* You can only set a mask on a thread. */
if (tflag && (sflag | pflag | xflag | jflag))
@@ -303,6 +315,15 @@ main(int argc, char *argv[])
/* You can only set a mask on an irq. */
if (xflag && (jflag | pflag | sflag | tflag))
usage();
+   if (Cflag) {
+   /*
+* Create a new cpuset and move the specified process
+ 

svn commit: r217417 - head/sys/dev/dc

2011-01-14 Thread Marius Strobl
Author: marius
Date: Fri Jan 14 20:26:59 2011
New Revision: 217417
URL: http://svn.freebsd.org/changeset/base/217417

Log:
  - Even after masking the media with IFM_GMASK the result may have bits
besides the duplex ones set so just comparing it with IFM_FDX may lead
to false negatives.
  - Just let the default case handle all unsupported media types.
  - In pnphy_status() don't unnecessarily read a register twice.
  - Remove unnused macros.
  
  MFC after:1 week

Modified:
  head/sys/dev/dc/dcphy.c
  head/sys/dev/dc/pnphy.c

Modified: head/sys/dev/dc/dcphy.c
==
--- head/sys/dev/dc/dcphy.c Fri Jan 14 19:57:28 2011(r217416)
+++ head/sys/dev/dc/dcphy.c Fri Jan 14 20:26:59 2011(r217417)
@@ -222,17 +222,12 @@ dcphy_service(struct mii_softc *sc, stru
/*dcphy_reset(sc);*/
(void) dcphy_auto(sc);
break;
-   case IFM_100_T4:
-   /*
-* XXX Not supported as a manual setting right now.
-*/
-   return (EINVAL);
case IFM_100_TX:
dcphy_reset(sc);
DC_CLRBIT(dc_sc, DC_10BTCTRL, DC_TCTL_AUTONEGENBL);
mode |= DC_NETCFG_PORTSEL | DC_NETCFG_PCS |
DC_NETCFG_SCRAMBLER;
-   if ((ife->ifm_media & IFM_GMASK) == IFM_FDX)
+   if ((ife->ifm_media & IFM_FDX) != 0)
mode |= DC_NETCFG_FULLDUPLEX;
else
mode &= ~DC_NETCFG_FULLDUPLEX;
@@ -241,7 +236,7 @@ dcphy_service(struct mii_softc *sc, stru
case IFM_10_T:
DC_CLRBIT(dc_sc, DC_SIARESET, DC_SIA_RESET);
DC_CLRBIT(dc_sc, DC_10BTCTRL, 0x);
-   if ((ife->ifm_media & IFM_GMASK) == IFM_FDX)
+   if ((ife->ifm_media & IFM_FDX) != 0)
DC_SETBIT(dc_sc, DC_10BTCTRL, 0x7F3D);
else
DC_SETBIT(dc_sc, DC_10BTCTRL, 0x7F3F);
@@ -249,7 +244,7 @@ dcphy_service(struct mii_softc *sc, stru
DC_CLRBIT(dc_sc, DC_10BTCTRL, DC_TCTL_AUTONEGENBL);
mode &= ~DC_NETCFG_PORTSEL;
mode |= DC_NETCFG_SPEEDSEL;
-   if ((ife->ifm_media & IFM_GMASK) == IFM_FDX)
+   if ((ife->ifm_media & IFM_FDX) != 0)
mode |= DC_NETCFG_FULLDUPLEX;
else
mode &= ~DC_NETCFG_FULLDUPLEX;

Modified: head/sys/dev/dc/pnphy.c
==
--- head/sys/dev/dc/pnphy.c Fri Jan 14 19:57:28 2011(r217416)
+++ head/sys/dev/dc/pnphy.c Fri Jan 14 20:26:59 2011(r217417)
@@ -66,14 +66,6 @@ __FBSDID("$FreeBSD$");
 
 #include "miibus_if.h"
 
-#define DC_SETBIT(sc, reg, x)   \
-CSR_WRITE_4(sc, reg,\
-CSR_READ_4(sc, reg) | x)
-
-#define DC_CLRBIT(sc, reg, x)   \
-CSR_WRITE_4(sc, reg,\
-CSR_READ_4(sc, reg) & ~x)
-
 static int pnphy_probe(device_t);
 static int pnphy_attach(device_t);
 
@@ -170,23 +162,19 @@ pnphy_service(struct mii_softc *sc, stru
if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
break;
 
+   /*
+* Note that auto-negotiation is broken on this chip.
+*/
switch (IFM_SUBTYPE(ife->ifm_media)) {
-   case IFM_AUTO:
-   /* NWAY is busted on this chip */
-   case IFM_100_T4:
-   /*
-* XXX Not supported as a manual setting right now.
-*/
-   return (EINVAL);
case IFM_100_TX:
mii->mii_media_active = IFM_ETHER | IFM_100_TX;
-   if ((ife->ifm_media & IFM_GMASK) == IFM_FDX)
+   if ((ife->ifm_media & IFM_FDX) != 0)
mii->mii_media_active |= IFM_FDX;
MIIBUS_STATCHG(sc->mii_dev);
return (0);
case IFM_10_T:
mii->mii_media_active = IFM_ETHER | IFM_10_T;
-   if ((ife->ifm_media & IFM_GMASK) == IFM_FDX)
+   if ((ife->ifm_media & IFM_FDX) != 0)
mii->mii_media_active |= IFM_FDX;
MIIBUS_STATCHG(sc->mii_dev);
return (0);
@@ -226,15 +214,14 @@ pnphy_status(struct mii_softc *sc)
mii->mii_media_act

svn commit: r217418 - stable/8/sys/dev/mpt

2011-01-14 Thread Marius Strobl
Author: marius
Date: Fri Jan 14 20:28:11 2011
New Revision: 217418
URL: http://svn.freebsd.org/changeset/base/217418

Log:
  MFC: r217009
  
  Remove a redundant variable assignment found with the clang static analyzer.

Modified:
  stable/8/sys/dev/mpt/mpt_cam.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)

Modified: stable/8/sys/dev/mpt/mpt_cam.c
==
--- stable/8/sys/dev/mpt/mpt_cam.c  Fri Jan 14 20:26:59 2011
(r217417)
+++ stable/8/sys/dev/mpt/mpt_cam.c  Fri Jan 14 20:28:11 2011
(r217418)
@@ -2971,7 +2971,7 @@ mpt_fc_els_reply_handler(struct mpt_soft
}
if (tgt_req) {
mpt_tgt_state_t *tgt = MPT_TGT_STATE(mpt, tgt_req);
-   union ccb *ccb = tgt->ccb;
+   union ccb *ccb;
uint32_t ct_id;
 
/*
___
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: r217419 - stable/7/sys/dev/mpt

2011-01-14 Thread Marius Strobl
Author: marius
Date: Fri Jan 14 20:28:12 2011
New Revision: 217419
URL: http://svn.freebsd.org/changeset/base/217419

Log:
  MFC: r217009
  
  Remove a redundant variable assignment found with the clang static analyzer.

Modified:
  stable/7/sys/dev/mpt/mpt_cam.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/dev/mpt/mpt_cam.c
==
--- stable/7/sys/dev/mpt/mpt_cam.c  Fri Jan 14 20:28:11 2011
(r217418)
+++ stable/7/sys/dev/mpt/mpt_cam.c  Fri Jan 14 20:28:12 2011
(r217419)
@@ -2965,7 +2965,7 @@ mpt_fc_els_reply_handler(struct mpt_soft
}
if (tgt_req) {
mpt_tgt_state_t *tgt = MPT_TGT_STATE(mpt, tgt_req);
-   union ccb *ccb = tgt->ccb;
+   union ccb *ccb;
uint32_t ct_id;
 
/*
___
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: r217420 - stable/7/sys/net

2011-01-14 Thread Marius Strobl
Author: marius
Date: Fri Jan 14 20:30:17 2011
New Revision: 217420
URL: http://svn.freebsd.org/changeset/base/217420

Log:
  MFC: r217010
  
  Fix whitespace.

Modified:
  stable/7/sys/net/if_media.h
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/net/if_media.h
==
--- stable/7/sys/net/if_media.h Fri Jan 14 20:28:12 2011(r217419)
+++ stable/7/sys/net/if_media.h Fri Jan 14 20:30:17 2011(r217420)
@@ -36,7 +36,7 @@
  */
 
 #ifndef _NET_IF_MEDIA_H_
-#define _NET_IF_MEDIA_H_
+#define_NET_IF_MEDIA_H_
 
 /*
  * Prototypes and definitions for BSD/OS-compatible network interface
@@ -144,13 +144,12 @@ uint64_t  ifmedia_baudrate(int);
 #defineIFM_10G_LR  18  /* 10GBase-LR 1310nm 
Single-mode */
 #defineIFM_10G_SR  19  /* 10GBase-SR 850nm Multi-mode 
*/
 #defineIFM_10G_CX4 20  /* 10GBase CX4 copper */
-#define IFM_2500_SX21  /* 2500BaseSX - multi-mode fiber */
-#define IFM_10G_TWINAX 22  /* 10GBase Twinax copper */
-#define IFM_10G_TWINAX_LONG23  /* 10GBase Twinax Long copper */
-#define IFM_10G_LRM24  /* 10GBase-LRM 850nm Multi-mode */
-#define IFM_UNKNOWN25  /* media types not defined yet */
-#define IFM_10G_T  26  /* 10GBase-T - RJ45 */
-
+#defineIFM_2500_SX 21  /* 2500BaseSX - multi-mode 
fiber */
+#defineIFM_10G_TWINAX  22  /* 10GBase Twinax copper */
+#defineIFM_10G_TWINAX_LONG 23  /* 10GBase Twinax Long copper */
+#defineIFM_10G_LRM 24  /* 10GBase-LRM 850nm Multi-mode 
*/
+#defineIFM_UNKNOWN 25  /* media types not defined yet 
*/
+#defineIFM_10G_T   26  /* 10GBase-T - RJ45 */
 
 /* note 31 is the max! */
 
@@ -231,20 +230,20 @@ uint64_t  ifmedia_baudrate(int);
 /*
  * ATM
  */
-#define IFM_ATM0x00a0
-#define IFM_ATM_UNKNOWN3
-#define IFM_ATM_UTP_25 4
-#define IFM_ATM_TAXI_100   5
-#define IFM_ATM_TAXI_140   6
-#define IFM_ATM_MM_155 7
-#define IFM_ATM_SM_155 8
-#define IFM_ATM_UTP_1559
-#define IFM_ATM_MM_622 10
-#define IFM_ATM_SM_622 11
+#defineIFM_ATM 0x00a0
+#defineIFM_ATM_UNKNOWN 3
+#defineIFM_ATM_UTP_25  4
+#defineIFM_ATM_TAXI_1005
+#defineIFM_ATM_TAXI_1406
+#defineIFM_ATM_MM_155  7
+#defineIFM_ATM_SM_155  8
+#defineIFM_ATM_UTP_155 9
+#defineIFM_ATM_MM_622  10
+#defineIFM_ATM_SM_622  11
 #defineIFM_ATM_VIRTUAL 12
-#define IFM_ATM_SDH0x0100  /* SDH instead of SONET */
-#define IFM_ATM_NOSCRAMB   0x0200  /* no scrambling */
-#define IFM_ATM_UNASSIGNED 0x0400  /* unassigned cells */
+#defineIFM_ATM_SDH 0x0100  /* SDH instead of SONET 
*/
+#defineIFM_ATM_NOSCRAMB0x0200  /* no scrambling */
+#defineIFM_ATM_UNASSIGNED  0x0400  /* unassigned cells */
 
 /*
  * CARP Common Address Redundancy Protocol
@@ -294,22 +293,22 @@ uint64_t  ifmedia_baudrate(int);
 #defineIFM_STATUS_VALIDIFM_AVALID
 
 /* List of "status valid" bits, for ifconfig(8). */
-#define IFM_STATUS_VALID_LIST {
\
-IFM_AVALID,\
-0  \
+#defineIFM_STATUS_VALID_LIST { 
\
+   IFM_AVALID, \
+   0   \
 }
 
 /*
  * Macros to extract various bits of information from the media word.
  */
-#defineIFM_TYPE(x) ((x) & IFM_NMASK)
-#defineIFM_SUBTYPE(x)  ((x) & IFM_TMASK)
-#defineIFM_TYPE_OPTIONS(x) ((x) & IFM_OMASK)
-#defineIFM_INST(x) (((x) & IFM_IMASK) >> IFM_ISHIFT)
-#defineIFM_OPTIONS(x)  ((x) & (IFM_OMASK|IFM_GMASK))
-#defineIFM_MODE(x) ((x) & IFM_MMASK)
+#defineIFM_TYPE(x) ((x) & IFM_NMASK)
+#defineIFM_SUBTYPE(x)  ((x) & IFM_TMASK)
+#defineIFM_TYPE_OPTIONS(x) ((x) & IFM_OMASK)
+#defineIFM_INST(x) (((x) & IFM_IMASK) >> IFM_ISHIFT)
+#defineIFM_OPTIONS(x)  ((x) & (IFM_OMASK | IFM_GMASK))
+#defineIFM_MODE(x) ((x) & IFM_MMASK)
 
-#defineIFM_INST_MAXIFM_INST(IFM_IMASK)
+#define   

svn commit: r217421 - stable/8/sys/net

2011-01-14 Thread Marius Strobl
Author: marius
Date: Fri Jan 14 20:30:17 2011
New Revision: 217421
URL: http://svn.freebsd.org/changeset/base/217421

Log:
  MFC: r217010
  
  Fix whitespace.

Modified:
  stable/8/sys/net/if_media.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)

Modified: stable/8/sys/net/if_media.h
==
--- stable/8/sys/net/if_media.h Fri Jan 14 20:30:17 2011(r217420)
+++ stable/8/sys/net/if_media.h Fri Jan 14 20:30:17 2011(r217421)
@@ -36,7 +36,7 @@
  */
 
 #ifndef _NET_IF_MEDIA_H_
-#define _NET_IF_MEDIA_H_
+#define_NET_IF_MEDIA_H_
 
 /*
  * Prototypes and definitions for BSD/OS-compatible network interface
@@ -144,13 +144,12 @@ uint64_t  ifmedia_baudrate(int);
 #defineIFM_10G_LR  18  /* 10GBase-LR 1310nm 
Single-mode */
 #defineIFM_10G_SR  19  /* 10GBase-SR 850nm Multi-mode 
*/
 #defineIFM_10G_CX4 20  /* 10GBase CX4 copper */
-#define IFM_2500_SX21  /* 2500BaseSX - multi-mode fiber */
-#define IFM_10G_TWINAX 22  /* 10GBase Twinax copper */
-#define IFM_10G_TWINAX_LONG23  /* 10GBase Twinax Long copper */
-#define IFM_10G_LRM24  /* 10GBase-LRM 850nm Multi-mode */
-#define IFM_UNKNOWN25  /* media types not defined yet */
-#define IFM_10G_T  26  /* 10GBase-T - RJ45 */
-
+#defineIFM_2500_SX 21  /* 2500BaseSX - multi-mode 
fiber */
+#defineIFM_10G_TWINAX  22  /* 10GBase Twinax copper */
+#defineIFM_10G_TWINAX_LONG 23  /* 10GBase Twinax Long copper */
+#defineIFM_10G_LRM 24  /* 10GBase-LRM 850nm Multi-mode 
*/
+#defineIFM_UNKNOWN 25  /* media types not defined yet 
*/
+#defineIFM_10G_T   26  /* 10GBase-T - RJ45 */
 
 /* note 31 is the max! */
 
@@ -232,20 +231,20 @@ uint64_t  ifmedia_baudrate(int);
 /*
  * ATM
  */
-#define IFM_ATM0x00a0
-#define IFM_ATM_UNKNOWN3
-#define IFM_ATM_UTP_25 4
-#define IFM_ATM_TAXI_100   5
-#define IFM_ATM_TAXI_140   6
-#define IFM_ATM_MM_155 7
-#define IFM_ATM_SM_155 8
-#define IFM_ATM_UTP_1559
-#define IFM_ATM_MM_622 10
-#define IFM_ATM_SM_622 11
+#defineIFM_ATM 0x00a0
+#defineIFM_ATM_UNKNOWN 3
+#defineIFM_ATM_UTP_25  4
+#defineIFM_ATM_TAXI_1005
+#defineIFM_ATM_TAXI_1406
+#defineIFM_ATM_MM_155  7
+#defineIFM_ATM_SM_155  8
+#defineIFM_ATM_UTP_155 9
+#defineIFM_ATM_MM_622  10
+#defineIFM_ATM_SM_622  11
 #defineIFM_ATM_VIRTUAL 12
-#define IFM_ATM_SDH0x0100  /* SDH instead of SONET */
-#define IFM_ATM_NOSCRAMB   0x0200  /* no scrambling */
-#define IFM_ATM_UNASSIGNED 0x0400  /* unassigned cells */
+#defineIFM_ATM_SDH 0x0100  /* SDH instead of SONET 
*/
+#defineIFM_ATM_NOSCRAMB0x0200  /* no scrambling */
+#defineIFM_ATM_UNASSIGNED  0x0400  /* unassigned cells */
 
 /*
  * CARP Common Address Redundancy Protocol
@@ -295,22 +294,22 @@ uint64_t  ifmedia_baudrate(int);
 #defineIFM_STATUS_VALIDIFM_AVALID
 
 /* List of "status valid" bits, for ifconfig(8). */
-#define IFM_STATUS_VALID_LIST {
\
-IFM_AVALID,\
-0  \
+#defineIFM_STATUS_VALID_LIST { 
\
+   IFM_AVALID, \
+   0   \
 }
 
 /*
  * Macros to extract various bits of information from the media word.
  */
-#defineIFM_TYPE(x) ((x) & IFM_NMASK)
-#defineIFM_SUBTYPE(x)  ((x) & IFM_TMASK)
-#defineIFM_TYPE_OPTIONS(x) ((x) & IFM_OMASK)
-#defineIFM_INST(x) (((x) & IFM_IMASK) >> IFM_ISHIFT)
-#defineIFM_OPTIONS(x)  ((x) & (IFM_OMASK|IFM_GMASK))
-#defineIFM_MODE(x) ((x) & IFM_MMASK)
+#defineIFM_TYPE(x) ((x) & IFM_NMASK)
+#defineIFM_SUBTYPE(x)  ((x) & IFM_TMASK)
+#defineIFM_TYPE_OPTIONS(x) ((x) & IFM_OMASK)
+#defineIFM_INST(x) (((x) & IFM_IMASK) >> IFM_ISHIFT)
+#defineIFM_OPTIONS(x)  ((x) & (IFM_OMASK | IFM_GMASK))
+#defineIFM_MODE(x) ((x) & IFM_MMASK)
 
-#define   

svn commit: r217422 - in stable/8: sbin/ifconfig sys/net

2011-01-14 Thread Marius Strobl
Author: marius
Date: Fri Jan 14 20:43:21 2011
New Revision: 217422
URL: http://svn.freebsd.org/changeset/base/217422

Log:
  MFC: r217013
  
  Teach ifconfig(8) the handy shared option shortcut aliases the NetBSD
  counterpart also takes, i.e. "fdx" for "full-duplex", "flow" for
  "flowcontrol", "hdx" for "half-duplex" as well as "loop" and "loopback"
  for "hw-loopback".

Modified:
  stable/8/sbin/ifconfig/ifmedia.c
  stable/8/sys/net/if_media.h
Directory Properties:
  stable/8/sbin/ifconfig/   (props changed)
  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)

Modified: stable/8/sbin/ifconfig/ifmedia.c
==
--- stable/8/sbin/ifconfig/ifmedia.cFri Jan 14 20:30:17 2011
(r217421)
+++ stable/8/sbin/ifconfig/ifmedia.cFri Jan 14 20:43:21 2011
(r217422)
@@ -425,6 +425,9 @@ static struct ifmedia_description ifm_su
 static struct ifmedia_description ifm_shared_option_descriptions[] =
 IFM_SHARED_OPTION_DESCRIPTIONS;
 
+static struct ifmedia_description ifm_shared_option_aliases[] =
+IFM_SHARED_OPTION_ALIASES;
+
 struct ifmedia_type_to_subtype {
struct {
struct ifmedia_description *desc;
@@ -433,7 +436,7 @@ struct ifmedia_type_to_subtype {
struct {
struct ifmedia_description *desc;
int alias;
-   } options[3];
+   } options[4];
struct {
struct ifmedia_description *desc;
int alias;
@@ -452,6 +455,7 @@ static struct ifmedia_type_to_subtype if
},
{
{ &ifm_shared_option_descriptions[0], 0 },
+   { &ifm_shared_option_aliases[0], 1 },
{ &ifm_subtype_ethernet_option_descriptions[0], 0 },
{ NULL, 0 },
},
@@ -469,6 +473,7 @@ static struct ifmedia_type_to_subtype if
},
{
{ &ifm_shared_option_descriptions[0], 0 },
+   { &ifm_shared_option_aliases[0], 1 },
{ &ifm_subtype_tokenring_option_descriptions[0], 0 },
{ NULL, 0 },
},
@@ -486,6 +491,7 @@ static struct ifmedia_type_to_subtype if
},
{
{ &ifm_shared_option_descriptions[0], 0 },
+   { &ifm_shared_option_aliases[0], 1 },
{ &ifm_subtype_fddi_option_descriptions[0], 0 },
{ NULL, 0 },
},
@@ -503,6 +509,7 @@ static struct ifmedia_type_to_subtype if
},
{
{ &ifm_shared_option_descriptions[0], 0 },
+   { &ifm_shared_option_aliases[0], 1 },
{ &ifm_subtype_ieee80211_option_descriptions[0], 0 },
{ NULL, 0 },
},
@@ -522,6 +529,7 @@ static struct ifmedia_type_to_subtype if
},
{
{ &ifm_shared_option_descriptions[0], 0 },
+   { &ifm_shared_option_aliases[0], 1 },
{ &ifm_subtype_atm_option_descriptions[0], 0 },
{ NULL, 0 },
},

Modified: stable/8/sys/net/if_media.h
==
--- stable/8/sys/net/if_media.h Fri Jan 14 20:30:17 2011(r217421)
+++ stable/8/sys/net/if_media.h Fri Jan 14 20:43:21 2011(r217422)
@@ -596,6 +596,15 @@ struct ifmedia_description {
{ 0, NULL },\
 }
 
+#defineIFM_SHARED_OPTION_ALIASES { 
\
+   { IFM_FDX,  "fdx" },\
+   { IFM_HDX,  "hdx" },\
+   { IFM_FLOW, "flow" },   \
+   { IFM_LOOP, "loop" },   \
+   { IFM_LOOP, "loopback" },   \
+   { 0, NULL },\
+}
+
 /*
  * Baudrate descriptions for the various media types.
  */
___
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: r217423 - in stable/7: sbin/ifconfig sys/net

2011-01-14 Thread Marius Strobl
Author: marius
Date: Fri Jan 14 20:43:24 2011
New Revision: 217423
URL: http://svn.freebsd.org/changeset/base/217423

Log:
  MFC: r217013
  
  Teach ifconfig(8) the handy shared option shortcut aliases the NetBSD
  counterpart also takes, i.e. "fdx" for "full-duplex", "flow" for
  "flowcontrol", "hdx" for "half-duplex" as well as "loop" and "loopback"
  for "hw-loopback".

Modified:
  stable/7/sbin/ifconfig/ifmedia.c
  stable/7/sys/net/if_media.h
Directory Properties:
  stable/7/sbin/ifconfig/   (props changed)
  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/sbin/ifconfig/ifmedia.c
==
--- stable/7/sbin/ifconfig/ifmedia.cFri Jan 14 20:43:21 2011
(r217422)
+++ stable/7/sbin/ifconfig/ifmedia.cFri Jan 14 20:43:24 2011
(r217423)
@@ -416,6 +416,9 @@ static struct ifmedia_description ifm_su
 static struct ifmedia_description ifm_shared_option_descriptions[] =
 IFM_SHARED_OPTION_DESCRIPTIONS;
 
+static struct ifmedia_description ifm_shared_option_aliases[] =
+IFM_SHARED_OPTION_ALIASES;
+
 struct ifmedia_type_to_subtype {
struct {
struct ifmedia_description *desc;
@@ -424,7 +427,7 @@ struct ifmedia_type_to_subtype {
struct {
struct ifmedia_description *desc;
int alias;
-   } options[3];
+   } options[4];
struct {
struct ifmedia_description *desc;
int alias;
@@ -443,6 +446,7 @@ static struct ifmedia_type_to_subtype if
},
{
{ &ifm_shared_option_descriptions[0], 0 },
+   { &ifm_shared_option_aliases[0], 1 },
{ &ifm_subtype_ethernet_option_descriptions[0], 0 },
{ NULL, 0 },
},
@@ -460,6 +464,7 @@ static struct ifmedia_type_to_subtype if
},
{
{ &ifm_shared_option_descriptions[0], 0 },
+   { &ifm_shared_option_aliases[0], 1 },
{ &ifm_subtype_tokenring_option_descriptions[0], 0 },
{ NULL, 0 },
},
@@ -477,6 +482,7 @@ static struct ifmedia_type_to_subtype if
},
{
{ &ifm_shared_option_descriptions[0], 0 },
+   { &ifm_shared_option_aliases[0], 1 },
{ &ifm_subtype_fddi_option_descriptions[0], 0 },
{ NULL, 0 },
},
@@ -494,6 +500,7 @@ static struct ifmedia_type_to_subtype if
},
{
{ &ifm_shared_option_descriptions[0], 0 },
+   { &ifm_shared_option_aliases[0], 1 },
{ &ifm_subtype_ieee80211_option_descriptions[0], 0 },
{ NULL, 0 },
},
@@ -513,6 +520,7 @@ static struct ifmedia_type_to_subtype if
},
{
{ &ifm_shared_option_descriptions[0], 0 },
+   { &ifm_shared_option_aliases[0], 1 },
{ &ifm_subtype_atm_option_descriptions[0], 0 },
{ NULL, 0 },
},

Modified: stable/7/sys/net/if_media.h
==
--- stable/7/sys/net/if_media.h Fri Jan 14 20:43:21 2011(r217422)
+++ stable/7/sys/net/if_media.h Fri Jan 14 20:43:24 2011(r217423)
@@ -594,6 +594,15 @@ struct ifmedia_description {
{ 0, NULL },\
 }
 
+#defineIFM_SHARED_OPTION_ALIASES { 
\
+   { IFM_FDX,  "fdx" },\
+   { IFM_HDX,  "hdx" },\
+   { IFM_FLOW, "flow" },   \
+   { IFM_LOOP, "loop" },   \
+   { IFM_LOOP, "loopback" },   \
+   { 0, NULL },\
+}
+
 /*
  * Baudrate descriptions for the various media types.
  */
___
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: r217424 - in head/sys/amd64: ia32 linux32

2011-01-14 Thread Jung-uk Kim
Author: jkim
Date: Fri Jan 14 21:09:01 2011
New Revision: 217424
URL: http://svn.freebsd.org/changeset/base/217424

Log:
  Remove redundant, bogus, and even harmful uses of setting TS bit in CR0.
  It is done from fpstate_drop() when it is really necessary.
  
  Reviewed by:  kib
  MFC after:1 week

Modified:
  head/sys/amd64/ia32/ia32_signal.c
  head/sys/amd64/linux32/linux32_sysvec.c

Modified: head/sys/amd64/ia32/ia32_signal.c
==
--- head/sys/amd64/ia32/ia32_signal.c   Fri Jan 14 20:43:24 2011
(r217423)
+++ head/sys/amd64/ia32/ia32_signal.c   Fri Jan 14 21:09:01 2011
(r217424)
@@ -741,7 +741,6 @@ ia32_setregs(struct thread *td, struct i
regs->tf_gs = _ugssel;
regs->tf_flags = TF_HASSEGS;
 
-   load_cr0(rcr0() | CR0_MP | CR0_TS);
fpstate_drop(td);
 
/* Return via doreti so that we can change to a different %cs */

Modified: head/sys/amd64/linux32/linux32_sysvec.c
==
--- head/sys/amd64/linux32/linux32_sysvec.c Fri Jan 14 20:43:24 2011
(r217423)
+++ head/sys/amd64/linux32/linux32_sysvec.c Fri Jan 14 21:09:01 2011
(r217424)
@@ -865,7 +865,7 @@ exec_linux_setregs(struct thread *td, st
regs->tf_flags = TF_HASSEGS;
regs->tf_cs = _ucode32sel;
regs->tf_rbx = imgp->ps_strings;
-   load_cr0(rcr0() | CR0_MP | CR0_TS);
+
fpstate_drop(td);
 
/* Do full restore on return so that we can change to a different %cs */
___
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: r217425 - head/bin/sh

2011-01-14 Thread Jilles Tjoelker
Author: jilles
Date: Fri Jan 14 21:30:27 2011
New Revision: 217425
URL: http://svn.freebsd.org/changeset/base/217425

Log:
  sh: Make 'trap -l' look like 'kill -l'.

Modified:
  head/bin/sh/trap.c

Modified: head/bin/sh/trap.c
==
--- head/bin/sh/trap.c  Fri Jan 14 21:09:01 2011(r217424)
+++ head/bin/sh/trap.c  Fri Jan 14 21:30:27 2011(r217425)
@@ -134,7 +134,7 @@ printsignals(void)
outlen += 3;/* good enough */
}
++outlen;
-   if (outlen > 70 || n == sys_nsig - 1) {
+   if (outlen > 71 || n == sys_nsig - 1) {
out1str("\n");
outlen = 0;
} 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"


svn commit: r217426 - stable/8/sys/dev/usb/net

2011-01-14 Thread Pyun YongHyeon
Author: yongari
Date: Fri Jan 14 22:29:45 2011
New Revision: 217426
URL: http://svn.freebsd.org/changeset/base/217426

Log:
  MFC r215960,215962-215964,215966:
  r215960:
Apply GPIO configuration for all CICADA PHYs.
While I'm here show selected phymode to ease of debugging.
  
  r215962:
Move axe_reset() to axe_init().
  
  r215963:
Do not reinitialize controller if it's already running.
  
  r215964:
Make sure to change to currently selected media.
  
  r215966:
Do full controller initialization in axe_reset() for controllers
that require special configuration from EEPROM. This will put
controllers into known sane state.

Modified:
  stable/8/sys/dev/usb/net/if_axe.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)

Modified: stable/8/sys/dev/usb/net/if_axe.c
==
--- stable/8/sys/dev/usb/net/if_axe.c   Fri Jan 14 21:30:27 2011
(r217425)
+++ stable/8/sys/dev/usb/net/if_axe.c   Fri Jan 14 22:29:45 2011
(r217426)
@@ -536,8 +536,9 @@ axe_ax88178_init(struct axe_softc *sc)
}
 
if (bootverbose)
-   device_printf(sc->sc_ue.ue_dev, "EEPROM data : 0x%04x\n",
-   eeprom);
+   device_printf(sc->sc_ue.ue_dev,
+   "EEPROM data : 0x%04x, phymode : 0x%02x\n", eeprom,
+   phymode);
/* Program GPIOs depending on PHY hardware. */
switch (phymode) {
case AXE_PHY_MODE_MARVELL:
@@ -554,6 +555,8 @@ axe_ax88178_init(struct axe_softc *sc)
AXE_GPIO1_EN, hz / 32);
break;
case AXE_PHY_MODE_CICADA:
+   case AXE_PHY_MODE_CICADA_V2:
+   case AXE_PHY_MODE_CICADA_V2_ASIX:
if (gpio0 == 1)
AXE_GPIO_WRITE(AXE_GPIO_RELOAD_EEPROM | AXE_GPIO0 |
AXE_GPIO0_EN, hz / 32);
@@ -668,6 +671,12 @@ axe_reset(struct axe_softc *sc)
 
/* Wait a little while for the chip to get its brains in order. */
uether_pause(&sc->sc_ue, hz / 100);
+
+   /* Reinitialize controller to achieve full reset. */
+   if (sc->sc_flags & AXE_FLAG_178)
+   axe_ax88178_init(sc);
+   else if (sc->sc_flags & AXE_FLAG_772)
+   axe_ax88772_init(sc);
 }
 
 static void
@@ -1016,9 +1025,14 @@ axe_init(struct usb_ether *ue)
 
AXE_LOCK_ASSERT(sc, MA_OWNED);
 
+   if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+   return;
+
/* Cancel pending I/O */
axe_stop(ue);
 
+   axe_reset(sc);
+
/* Set MAC address. */
if (sc->sc_flags & (AXE_FLAG_178 | AXE_FLAG_772))
axe_cmd(sc, AXE_178_CMD_WRITE_NODEID, 0, 0, IF_LLADDR(ifp));
@@ -1066,6 +1080,8 @@ axe_init(struct usb_ether *ue)
usbd_xfer_set_stall(sc->sc_xfer[AXE_BULK_DT_WR]);
 
ifp->if_drv_flags |= IFF_DRV_RUNNING;
+   /* Switch to selected media. */
+   axe_ifmedia_upd(ifp);
axe_start(ue);
 }
 
@@ -1107,6 +1123,4 @@ axe_stop(struct usb_ether *ue)
 */
usbd_transfer_stop(sc->sc_xfer[AXE_BULK_DT_WR]);
usbd_transfer_stop(sc->sc_xfer[AXE_BULK_DT_RD]);
-
-   axe_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: r217427 - stable/8/sys/dev/usb/net

2011-01-14 Thread Pyun YongHyeon
Author: yongari
Date: Fri Jan 14 22:31:26 2011
New Revision: 217427
URL: http://svn.freebsd.org/changeset/base/217427

Log:
  MFC r215968:
Introduce new macro AXE_IS_178_FAMILY and AXE_IS_772. Include
AX88772A and AX88772B for future extension. While here add TX
buffer size for 178 family controllers.

Modified:
  stable/8/sys/dev/usb/net/if_axe.c
  stable/8/sys/dev/usb/net/if_axereg.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)

Modified: stable/8/sys/dev/usb/net/if_axe.c
==
--- stable/8/sys/dev/usb/net/if_axe.c   Fri Jan 14 22:29:45 2011
(r217426)
+++ stable/8/sys/dev/usb/net/if_axe.c   Fri Jan 14 22:31:26 2011
(r217427)
@@ -302,7 +302,7 @@ axe_miibus_readreg(device_t dev, int phy
axe_cmd(sc, AXE_CMD_MII_OPMODE_HW, 0, 0, NULL);
 
val = le16toh(val);
-   if ((sc->sc_flags & AXE_FLAG_772) != 0 && reg == MII_BMSR) {
+   if (AXE_IS_772(sc) && reg == MII_BMSR) {
/*
 * BMSR of AX88772 indicates that it supports extended
 * capability but the extended status register is
@@ -384,7 +384,7 @@ axe_miibus_statchg(device_t dev)
val = 0;
if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0)
val |= AXE_MEDIA_FULL_DUPLEX;
-   if (sc->sc_flags & (AXE_FLAG_178 | AXE_FLAG_772)) {
+   if (AXE_IS_178_FAMILY(sc)) {
val |= AXE_178_MEDIA_RX_EN | AXE_178_MEDIA_MAGIC;
if ((sc->sc_flags & AXE_FLAG_178) != 0)
val |= AXE_178_MEDIA_ENCK;
@@ -700,15 +700,18 @@ axe_attach_post(struct usb_ether *ue)
sc->sc_phyno = 0;
}
 
-   if (sc->sc_flags & AXE_FLAG_178)
+   if (sc->sc_flags & AXE_FLAG_178) {
axe_ax88178_init(sc);
-   else if (sc->sc_flags & AXE_FLAG_772)
+   sc->sc_tx_bufsz = 16 * 1024;
+   } else if (sc->sc_flags & AXE_FLAG_772) {
axe_ax88772_init(sc);
+   sc->sc_tx_bufsz = 8 * 1024;
+   }
 
/*
 * Get station address.
 */
-   if (sc->sc_flags & (AXE_FLAG_178 | AXE_FLAG_772))
+   if (AXE_IS_178_FAMILY(sc))
axe_cmd(sc, AXE_178_CMD_READ_NODEID, 0, 0, ue->ue_eaddr);
else
axe_cmd(sc, AXE_172_CMD_READ_NODEID, 0, 0, ue->ue_eaddr);
@@ -819,7 +822,7 @@ axe_bulk_read_callback(struct usb_xfer *
err = 0;
 
pc = usbd_xfer_get_frame(xfer, 0);
-   if (sc->sc_flags & (AXE_FLAG_772 | AXE_FLAG_178)) {
+   if (AXE_IS_178_FAMILY(sc)) {
while (pos < actlen) {
if ((pos + sizeof(hdr)) > actlen) {
/* too little data */
@@ -916,7 +919,7 @@ tr_setup:
if (m->m_pkthdr.len > MCLBYTES) {
m->m_pkthdr.len = MCLBYTES;
}
-   if (sc->sc_flags & (AXE_FLAG_772 | AXE_FLAG_178)) {
+   if (AXE_IS_178_FAMILY(sc)) {
 
hdr.len = htole16(m->m_pkthdr.len);
hdr.ilen = ~hdr.len;
@@ -955,7 +958,7 @@ tr_setup:
 
m_freem(m);
 
-   if (sc->sc_flags & (AXE_FLAG_772 | AXE_FLAG_178)) {
+   if (AXE_IS_178_FAMILY(sc)) {
if (pos > (AXE_BULK_BUF_SIZE - MCLBYTES - 
sizeof(hdr))) {
/* send out frame(s) */
break;
@@ -1034,16 +1037,16 @@ axe_init(struct usb_ether *ue)
axe_reset(sc);
 
/* Set MAC address. */
-   if (sc->sc_flags & (AXE_FLAG_178 | AXE_FLAG_772))
+   if (AXE_IS_178_FAMILY(sc))
axe_cmd(sc, AXE_178_CMD_WRITE_NODEID, 0, 0, IF_LLADDR(ifp));
else
axe_cmd(sc, AXE_172_CMD_WRITE_NODEID, 0, 0, IF_LLADDR(ifp));
 
/* Set transmitter IPG values */
-   if (sc->sc_flags & (AXE_FLAG_178 | AXE_FLAG_772)) {
+   if (AXE_IS_178_FAMILY(sc))
axe_cmd(sc, AXE_178_CMD_WRITE_IPG012, sc->sc_ipgs[2],
(sc->sc_ipgs[1] << 8) | (sc->sc_ipgs[0]), NULL);
-   } else {
+   else {
axe_cmd(sc, AXE_172_CMD_WRITE_IPG0, 0, sc->sc_ipgs[0], NULL);
axe_cmd(sc, AXE_172_CMD_WRITE_IPG1, 0, sc->sc_ipgs[1], NULL);
axe_cmd(sc, AXE_172_CMD_WRITE_IPG2, 0, sc->sc_ipgs[2], NULL);
@@ -1051,7 +1054,7 @@ axe_init(struct usb_ether *ue)
 
/* Enable receiver, set RX mode */
rxmode = (AXE_RXCMD_MULTICAST | AXE_RXCMD_ENABLE);
-   if (sc->sc_flags & (AXE_FLAG_178 | AXE_FLAG_772)) {
+   if (

svn commit: r217428 - stable/8/sys/dev/usb/net

2011-01-14 Thread Pyun YongHyeon
Author: yongari
Date: Fri Jan 14 22:33:12 2011
New Revision: 217428
URL: http://svn.freebsd.org/changeset/base/217428

Log:
  MFC r215969:
Add initial AX88772A support.
  
H/W donated by: Derrick Brashear (shadow <> gmail dot com)

Modified:
  stable/8/sys/dev/usb/net/if_axe.c
  stable/8/sys/dev/usb/net/if_axereg.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)

Modified: stable/8/sys/dev/usb/net/if_axe.c
==
--- stable/8/sys/dev/usb/net/if_axe.c   Fri Jan 14 22:31:26 2011
(r217427)
+++ stable/8/sys/dev/usb/net/if_axe.c   Fri Jan 14 22:33:12 2011
(r217428)
@@ -142,11 +142,11 @@ static const struct usb_device_id axe_de
AXE_DEV(ASIX, AX88172, 0),
AXE_DEV(ASIX, AX88178, AXE_FLAG_178),
AXE_DEV(ASIX, AX88772, AXE_FLAG_772),
-   AXE_DEV(ASIX, AX88772A, AXE_FLAG_772),
+   AXE_DEV(ASIX, AX88772A, AXE_FLAG_772A),
AXE_DEV(ATEN, UC210T, 0),
AXE_DEV(BELKIN, F5D5055, AXE_FLAG_178),
AXE_DEV(BILLIONTON, USB2AR, 0),
-   AXE_DEV(CISCOLINKSYS, USB200MV2, AXE_FLAG_772),
+   AXE_DEV(CISCOLINKSYS, USB200MV2, AXE_FLAG_772A),
AXE_DEV(COREGA, FETHER_USB2_TX, 0),
AXE_DEV(DLINK, DUBE100, 0),
AXE_DEV(DLINK, DUBE100B1, AXE_FLAG_772),
@@ -191,6 +191,7 @@ static void axe_ifmedia_sts(struct ifnet
 static int axe_cmd(struct axe_softc *, int, int, int, void *);
 static voidaxe_ax88178_init(struct axe_softc *);
 static voidaxe_ax88772_init(struct axe_softc *);
+static voidaxe_ax88772a_init(struct axe_softc *);
 static int axe_get_phyno(struct axe_softc *, int);
 
 static const struct usb_config axe_config[AXE_N_TRANSFER] = {
@@ -613,7 +614,6 @@ axe_ax88178_init(struct axe_softc *sc)
 
axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, 0, NULL);
 }
-#undef AXE_GPIO_WRITE
 
 static void
 axe_ax88772_init(struct axe_softc *sc)
@@ -657,6 +657,47 @@ axe_ax88772_init(struct axe_softc *sc)
 }
 
 static void
+axe_ax88772a_init(struct axe_softc *sc)
+{
+   struct usb_ether *ue;
+   uint16_t eeprom;
+
+   ue = &sc->sc_ue;
+   axe_cmd(sc, AXE_CMD_SROM_READ, 0, 0x0017, &eeprom);
+   eeprom = le16toh(eeprom);
+   /* Reload EEPROM. */
+   AXE_GPIO_WRITE(AXE_GPIO_RELOAD_EEPROM, hz / 32);
+   if (sc->sc_phyno == AXE_772_PHY_NO_EPHY) {
+   /* Manually select internal(embedded) PHY - MAC mode. */
+   axe_cmd(sc, AXE_CMD_SW_PHY_SELECT, 0, AXE_SW_PHY_SELECT_SS_ENB |
+   AXE_SW_PHY_SELECT_EMBEDDED | AXE_SW_PHY_SELECT_SS_MII,
+   NULL);
+   uether_pause(&sc->sc_ue, hz / 32);
+   } else {
+   /*
+* Manually select external PHY - MAC mode.
+* Reverse MII/RMII is for AX88772A PHY mode.
+*/
+   axe_cmd(sc, AXE_CMD_SW_PHY_SELECT, 0, AXE_SW_PHY_SELECT_SS_ENB |
+   AXE_SW_PHY_SELECT_EXT | AXE_SW_PHY_SELECT_SS_MII, NULL);
+   uether_pause(&sc->sc_ue, hz / 32);
+   }
+   /* Take PHY out of power down. */
+   axe_cmd(sc, AXE_CMD_SW_RESET_REG, 0, AXE_SW_RESET_IPPD |
+   AXE_SW_RESET_IPRL, NULL);
+   uether_pause(&sc->sc_ue, hz / 4);
+   axe_cmd(sc, AXE_CMD_SW_RESET_REG, 0, AXE_SW_RESET_IPRL, NULL);
+   uether_pause(&sc->sc_ue, hz);
+   axe_cmd(sc, AXE_CMD_SW_RESET_REG, 0, AXE_SW_RESET_CLEAR, NULL);
+   uether_pause(&sc->sc_ue, hz / 32);
+   axe_cmd(sc, AXE_CMD_SW_RESET_REG, 0, AXE_SW_RESET_IPRL, NULL);
+   uether_pause(&sc->sc_ue, hz / 32);
+   axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, 0, NULL);
+}
+
+#undef AXE_GPIO_WRITE
+
+static void
 axe_reset(struct axe_softc *sc)
 {
struct usb_config_descriptor *cd;
@@ -677,6 +718,8 @@ axe_reset(struct axe_softc *sc)
axe_ax88178_init(sc);
else if (sc->sc_flags & AXE_FLAG_772)
axe_ax88772_init(sc);
+   else if (sc->sc_flags & AXE_FLAG_772A)
+   axe_ax88772a_init(sc);
 }
 
 static void
@@ -706,6 +749,9 @@ axe_attach_post(struct usb_ether *ue)
} else if (sc->sc_flags & AXE_FLAG_772) {
axe_ax88772_init(sc);
sc->sc_tx_bufsz = 8 * 1024;
+   } else if (sc->sc_flags & AXE_FLAG_772A) {
+   axe_ax88772a_init(sc);
+   sc->sc_tx_bufsz = 8 * 1024;
}
 
/*
@@ -719,7 +765,13 @@ axe_attach_post(struct usb_ether *ue)
/*
 * Fetch IPG values.
 */
-   axe_cmd(sc, AXE_CMD_READ_IPG012, 0, 0, sc->sc_ipgs);
+   if (sc->sc_flags & AXE_FLAG_772A) {
+   /* Set IPG values. */
+   sc->sc_ipgs[0] = 0x15;
+   sc->sc_ipgs[1] = 0x16;
+   sc->sc_ipgs[2] = 0x1A;
+   } else
+  

svn commit: r217429 - stable/8/sys/dev/usb/net

2011-01-14 Thread Pyun YongHyeon
Author: yongari
Date: Fri Jan 14 22:36:33 2011
New Revision: 217429
URL: http://svn.freebsd.org/changeset/base/217429

Log:
  MFC r216284:
r184610 changed the way how TX frames are handled on AX88178 and
AX88772 controllers. ASIX added a new feature for AX88178/AX88772
controllers which allows combining multiple TX frames into a single
big frame. This was to overcome one of USB limitation where it
can't generate more than 8k interrupts/sec which in turn means USB
ethernet controllers can not send more than 8k packets per second.
Using ASIX's feature greatly enhanced TX performance(more than 3~4
times) compared to 7.x driver. However it seems r184610 removed
boundary checking for buffered frames which in turn caused
instability issues under certain conditions. In addition, using
ASIX's feature triggered another issue which made USB controller
hang under certain conditions. Restarting ethernet controller
didn't help under this hang condition and unplugging and replugging
the controller was the only solution. I believe there is a silicon
bug in TX frame combining feature on AX88178/AX88772 controllers.
  
To address these issues, reintroduce the boundary checking for both
AX88178 and AX88772 after copying a frame to USB buffer and do not
use ASIX's multiple frame combining feature. Instead, use USB
controller's multi-frame transmit capability to enhance TX
performance as suggested by Hans[1].
This should fix a long standing axe(4) instability issues reported
on AX88772 and AX88178 controllers. While I'm here remove
unnecessary TX frame length check since upper stack always
guarantee the size of a frame to be less than MCLBYTES.
  
Special thanks to Derrick Brashear who tried numerous patches
during last 4 months and waited real fix with patience. Without
this enthusiastic support, patience and H/W donation I couldn't fix
it since I was not able to trigger the issue on my box.
  
Suggested by:   hselasky [1]
Tested by:  Derrick Brashear (shadow <> gmail dot com>
H/W donated by: Derrick Brashear (shadow <> gmail dot com>
PR: usb/140883

Modified:
  stable/8/sys/dev/usb/net/if_axe.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)

Modified: stable/8/sys/dev/usb/net/if_axe.c
==
--- stable/8/sys/dev/usb/net/if_axe.c   Fri Jan 14 22:33:12 2011
(r217428)
+++ stable/8/sys/dev/usb/net/if_axe.c   Fri Jan 14 22:36:33 2011
(r217429)
@@ -200,7 +200,8 @@ static const struct usb_config axe_confi
.type = UE_BULK,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_OUT,
-   .bufsize = AXE_BULK_BUF_SIZE,
+   .frames = 16,
+   .bufsize = 16 * MCLBYTES,
.flags = {.pipe_bof = 1,.force_short_xfer = 1,},
.callback = axe_bulk_write_callback,
.timeout = 1,   /* 10 seconds */
@@ -939,7 +940,7 @@ axe_bulk_write_callback(struct usb_xfer 
struct ifnet *ifp = uether_getifp(&sc->sc_ue);
struct usb_page_cache *pc;
struct mbuf *m;
-   int pos;
+   int nframes, pos;
 
switch (USB_GET_STATE(xfer)) {
case USB_ST_TRANSFERRED:
@@ -956,40 +957,34 @@ tr_setup:
 */
return;
}
-   pos = 0;
-   pc = usbd_xfer_get_frame(xfer, 0);
-
-   while (1) {
 
+   for (nframes = 0; nframes < 16 &&
+   !IFQ_DRV_IS_EMPTY(&ifp->if_snd); nframes++) {
IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
-
-   if (m == NULL) {
-   if (pos > 0)
-   break;  /* send out data */
-   return;
-   }
-   if (m->m_pkthdr.len > MCLBYTES) {
-   m->m_pkthdr.len = MCLBYTES;
-   }
+   if (m == NULL)
+   break;
+   usbd_xfer_set_frame_offset(xfer, nframes * MCLBYTES,
+   nframes);
+   pos = 0;
+   pc = usbd_xfer_get_frame(xfer, nframes);
if (AXE_IS_178_FAMILY(sc)) {
-
hdr.len = htole16(m->m_pkthdr.len);
hdr.ilen = ~hdr.len;
-
usbd_copy_in(pc, pos, &hdr, sizeof(hdr));
-
pos += sizeof(hdr);
-
-   /*
-

svn commit: r217430 - stable/8/share/man/man4

2011-01-14 Thread Pyun YongHyeon
Author: yongari
Date: Fri Jan 14 22:58:08 2011
New Revision: 217430
URL: http://svn.freebsd.org/changeset/base/217430

Log:
  MFC r216131:
Document loader tunable hw.re.prefer_iomap.

Modified:
  stable/8/share/man/man4/re.4
Directory Properties:
  stable/8/share/man/man4/   (props changed)

Modified: stable/8/share/man/man4/re.4
==
--- stable/8/share/man/man4/re.4Fri Jan 14 22:36:33 2011
(r217429)
+++ stable/8/share/man/man4/re.4Fri Jan 14 22:58:08 2011
(r217430)
@@ -30,7 +30,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 27, 2010
+.Dd December 2, 2010
 .Dt RE 4
 .Os
 .Sh NAME
@@ -178,6 +178,11 @@ prompt before booting the kernel or stor
 .It Va hw.re.msi_disable
 This tunable disables MSI support on the Ethernet hardware.
 The default value is 0.
+.It Va hw.re.prefer_iomap
+This tunable controls which register mapping should be used on the
+specified device.
+A non-zero value enables I/O space register mapping.
+The default value is 0 to use memory space register mapping.
 .El
 .Sh DIAGNOSTICS
 .Bl -diag
___
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: r217431 - stable/7/share/man/man4

2011-01-14 Thread Pyun YongHyeon
Author: yongari
Date: Fri Jan 14 22:58:41 2011
New Revision: 217431
URL: http://svn.freebsd.org/changeset/base/217431

Log:
  MFC r216131:
Document loader tunable hw.re.prefer_iomap.

Modified:
  stable/7/share/man/man4/re.4
Directory Properties:
  stable/7/share/man/man4/   (props changed)

Modified: stable/7/share/man/man4/re.4
==
--- stable/7/share/man/man4/re.4Fri Jan 14 22:58:08 2011
(r217430)
+++ stable/7/share/man/man4/re.4Fri Jan 14 22:58:41 2011
(r217431)
@@ -30,7 +30,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 27, 2010
+.Dd December 2, 2010
 .Dt RE 4
 .Os
 .Sh NAME
@@ -178,6 +178,11 @@ prompt before booting the kernel or stor
 .It Va hw.re.msi_disable
 This tunable disables MSI support on the Ethernet hardware.
 The default value is 0.
+.It Va hw.re.prefer_iomap
+This tunable controls which register mapping should be used on the
+specified device.
+A non-zero value enables I/O space register mapping.
+The default value is 0 to use memory space register mapping.
 .El
 .Sh DIAGNOSTICS
 .Bl -diag
___
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: r217432 - in head/sys: fs/nfs fs/nfsserver nfs

2011-01-14 Thread Rick Macklem
Author: rmacklem
Date: Fri Jan 14 23:30:35 2011
New Revision: 217432
URL: http://svn.freebsd.org/changeset/base/217432

Log:
  Modify the experimental NFSv4 server so that it posts a SIGUSR2
  signal to the master nfsd daemon whenever the stable restart
  file has been modified. This will allow the master nfsd daemon
  to maintain an up to date backup copy of the file. This is
  enabled via the nfssvc() syscall, so that older nfsd daemons
  will not be signaled.
  
  Reviewed by:  jhb
  MFC after:1 week

Modified:
  head/sys/fs/nfs/nfs_var.h
  head/sys/fs/nfsserver/nfs_nfsdkrpc.c
  head/sys/fs/nfsserver/nfs_nfsdport.c
  head/sys/fs/nfsserver/nfs_nfsdstate.c
  head/sys/nfs/nfs_nfssvc.c
  head/sys/nfs/nfssvc.h

Modified: head/sys/fs/nfs/nfs_var.h
==
--- head/sys/fs/nfs/nfs_var.h   Fri Jan 14 22:58:41 2011(r217431)
+++ head/sys/fs/nfs/nfs_var.h   Fri Jan 14 23:30:35 2011(r217432)
@@ -573,6 +573,7 @@ int nfsvno_advlock(vnode_t, int, u_int64
 int nfsrv_v4rootexport(void *, struct ucred *, NFSPROC_T *);
 int nfsvno_testexp(struct nfsrv_descript *, struct nfsexstuff *);
 uint32_t nfsrv_hashfh(fhandle_t *);
+void nfsrv_backupstable(void);
 
 /* nfs_commonkrpc.c */
 int newnfs_nmcancelreqs(struct nfsmount *);

Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c
==
--- head/sys/fs/nfsserver/nfs_nfsdkrpc.cFri Jan 14 22:58:41 2011
(r217431)
+++ head/sys/fs/nfsserver/nfs_nfsdkrpc.cFri Jan 14 23:30:35 2011
(r217432)
@@ -97,6 +97,7 @@ static int nfs_proc(struct nfsrv_descrip
 
 extern u_long sb_max_adj;
 extern int newnfs_numnfsd;
+extern struct proc *nfsd_master_proc;
 
 /*
  * NFS server system calls
@@ -465,6 +466,7 @@ nfsrvd_init(int terminating)
NFSD_LOCK_ASSERT();
 
if (terminating) {
+   nfsd_master_proc = NULL;
NFSD_UNLOCK();
svcpool_destroy(nfsrvd_pool);
nfsrvd_pool = NULL;

Modified: head/sys/fs/nfsserver/nfs_nfsdport.c
==
--- head/sys/fs/nfsserver/nfs_nfsdport.cFri Jan 14 22:58:41 2011
(r217431)
+++ head/sys/fs/nfsserver/nfs_nfsdport.cFri Jan 14 23:30:35 2011
(r217432)
@@ -58,6 +58,10 @@ struct mtx nfs_cache_mutex;
 struct mtx nfs_v4root_mutex;
 struct nfsrvfh nfs_rootfh, nfs_pubfh;
 int nfs_pubfhset = 0, nfs_rootfhset = 0;
+struct proc *nfsd_master_proc = NULL;
+static pid_t nfsd_master_pid = (pid_t)-1;
+static char nfsd_master_comm[MAXCOMLEN + 1];
+static struct timeval nfsd_master_start;
 static uint32_t nfsv4_sysid = 0;
 
 static int nfssvc_srvcall(struct thread *, struct nfssvc_args *,
@@ -2905,6 +2909,7 @@ nfssvc_srvcall(struct thread *p, struct 
struct nameidata nd;
vnode_t vp;
int error = EINVAL;
+   struct proc *procp;
 
if (uap->flag & NFSSVC_PUBLICFH) {
NFSBZERO((caddr_t)&nfs_pubfh.nfsrvfh_data,
@@ -2975,6 +2980,14 @@ nfssvc_srvcall(struct thread *p, struct 
CAST_USER_ADDR_T(dumplocklist.ndllck_list), len);
free((caddr_t)dumplocks, M_TEMP);
}
+   } else if (uap->flag & NFSSVC_BACKUPSTABLE) {
+   procp = p->td_proc;
+   PROC_LOCK(procp);
+   nfsd_master_pid = procp->p_pid;
+   bcopy(procp->p_comm, nfsd_master_comm, MAXCOMLEN + 1);
+   nfsd_master_start = procp->p_stats->p_start;
+   nfsd_master_proc = procp;
+   PROC_UNLOCK(procp);
}
return (error);
 }
@@ -3030,6 +3043,32 @@ nfsrv_hashfh(fhandle_t *fhp)
return (hashval);
 }
 
+/*
+ * Signal the userland master nfsd to backup the stable restart file.
+ */
+void
+nfsrv_backupstable(void)
+{
+   struct proc *procp;
+
+   if (nfsd_master_proc != NULL) {
+   procp = pfind(nfsd_master_pid);
+   /* Try to make sure it is the correct process. */
+   if (procp == nfsd_master_proc &&
+   procp->p_stats->p_start.tv_sec ==
+   nfsd_master_start.tv_sec &&
+   procp->p_stats->p_start.tv_usec ==
+   nfsd_master_start.tv_usec &&
+   strcmp(procp->p_comm, nfsd_master_comm) == 0)
+   psignal(procp, SIGUSR2);
+   else
+   nfsd_master_proc = NULL;
+
+   if (procp != NULL)
+   PROC_UNLOCK(procp);
+   }
+}
+
 extern int (*nfsd_call_nfsd)(struct thread *, struct nfssvc_args *);
 
 /*

Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c
==
--- head/sys/fs/nfsserver/nfs_nfsdstate.c   Fri Jan 14 22:58:41 2011
(r217431)
+++ head/sys/fs/nfsserver/nfs_nfsdstate.c   Fri Jan 14 23:30

svn commit: r217435 - stable/8/sys/dev/re

2011-01-14 Thread Pyun YongHyeon
Author: yongari
Date: Sat Jan 15 00:32:15 2011
New Revision: 217435
URL: http://svn.freebsd.org/changeset/base/217435

Log:
  MFC r217296:
For re(4) controllers that uses new jumbo frame scheme(RTL8168C/D/E),
limit maximum RX buffer size to RE_RX_DESC_BUFLEN instead of
blindly configuring it to 16KB. Due to lack of documentation, re(4)
didn't allow jumbo frame on these controllers. However it seems
controller is confused with jumbo frame such that it can DMA the
received frame to wrong address instead of splitting it into
multiple RX buffers. Of course, this caused panic.
  
Since re(4) does not support jumbo frames on these controllers,
make controller drop frame that is longer than RE_RX_DESC_BUFLEN
sized frame. Fortunately RTL810x controllers, which do not support
jumbo frame, have no such issues but this change also limited
maximum RX buffer size allowed to RTL810x controllers. Allowing
16KB RX buffer for controllers that have no such capability is
meaningless.

Modified:
  stable/8/sys/dev/re/if_re.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)

Modified: stable/8/sys/dev/re/if_re.c
==
--- stable/8/sys/dev/re/if_re.c Sat Jan 15 00:23:57 2011(r217434)
+++ stable/8/sys/dev/re/if_re.c Sat Jan 15 00:32:15 2011(r217435)
@@ -2779,8 +2779,13 @@ re_init_locked(struct rl_softc *sc)
 * For 8169 gigE NICs, set the max allowed RX packet
 * size so we can receive jumbo frames.
 */
-   if (sc->rl_type == RL_8169)
-   CSR_WRITE_2(sc, RL_MAXRXPKTLEN, 16383);
+   if (sc->rl_type == RL_8169) {
+   if ((sc->rl_flags & (RL_FLAG_PCIE | RL_FLAG_NOJUMBO)) ==
+   (RL_FLAG_PCIE | RL_FLAG_NOJUMBO))
+   CSR_WRITE_2(sc, RL_MAXRXPKTLEN, RE_RX_DESC_BUFLEN);
+   else
+   CSR_WRITE_2(sc, RL_MAXRXPKTLEN, 16383);
+   }
 
if (sc->rl_testmode)
return;
___
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: r217436 - stable/7/sys/dev/re

2011-01-14 Thread Pyun YongHyeon
Author: yongari
Date: Sat Jan 15 00:34:50 2011
New Revision: 217436
URL: http://svn.freebsd.org/changeset/base/217436

Log:
  MFC r217296:
For re(4) controllers that uses new jumbo frame scheme(RTL8168C/D/E),
limit maximum RX buffer size to RE_RX_DESC_BUFLEN instead of
blindly configuring it to 16KB. Due to lack of documentation, re(4)
didn't allow jumbo frame on these controllers. However it seems
controller is confused with jumbo frame such that it can DMA the
received frame to wrong address instead of splitting it into
multiple RX buffers. Of course, this caused panic.
  
Since re(4) does not support jumbo frames on these controllers,
make controller drop frame that is longer than RE_RX_DESC_BUFLEN
sized frame. Fortunately RTL810x controllers, which do not support
jumbo frame, have no such issues but this change also limited
maximum RX buffer size allowed to RTL810x controllers. Allowing
16KB RX buffer for controllers that have no such capability is
meaningless.

Modified:
  stable/7/sys/dev/re/if_re.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/dev/re/if_re.c
==
--- stable/7/sys/dev/re/if_re.c Sat Jan 15 00:32:15 2011(r217435)
+++ stable/7/sys/dev/re/if_re.c Sat Jan 15 00:34:50 2011(r217436)
@@ -2773,8 +2773,13 @@ re_init_locked(struct rl_softc *sc)
 * For 8169 gigE NICs, set the max allowed RX packet
 * size so we can receive jumbo frames.
 */
-   if (sc->rl_type == RL_8169)
-   CSR_WRITE_2(sc, RL_MAXRXPKTLEN, 16383);
+   if (sc->rl_type == RL_8169) {
+   if ((sc->rl_flags & (RL_FLAG_PCIE | RL_FLAG_NOJUMBO)) ==
+   (RL_FLAG_PCIE | RL_FLAG_NOJUMBO))
+   CSR_WRITE_2(sc, RL_MAXRXPKTLEN, RE_RX_DESC_BUFLEN);
+   else
+   CSR_WRITE_2(sc, RL_MAXRXPKTLEN, 16383);
+   }
 
if (sc->rl_testmode)
return;
___
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: r217437 - in stable/8/sys/fs: nfs nfsserver

2011-01-14 Thread Rick Macklem
Author: rmacklem
Date: Sat Jan 15 01:03:26 2011
New Revision: 217437
URL: http://svn.freebsd.org/changeset/base/217437

Log:
  MFC: r216875
  Add support for shared vnode locks for the Read operation
  in the experimental NFSv4 server.

Modified:
  stable/8/sys/fs/nfs/nfs_commonsubs.c
  stable/8/sys/fs/nfsserver/nfs_nfsdstate.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)

Modified: stable/8/sys/fs/nfs/nfs_commonsubs.c
==
--- stable/8/sys/fs/nfs/nfs_commonsubs.cSat Jan 15 00:34:50 2011
(r217436)
+++ stable/8/sys/fs/nfs/nfs_commonsubs.cSat Jan 15 01:03:26 2011
(r217437)
@@ -109,7 +109,7 @@ struct nfsv4_opflag nfsv4_opflag[NFSV4OP
{ 1, 0, 0, 0, LK_EXCLUSIVE },   /* PutFH */
{ 1, 0, 0, 0, LK_EXCLUSIVE },   /* PutPubFH */
{ 1, 0, 0, 0, LK_EXCLUSIVE },   /* PutRootFH */
-   { 0, 1, 0, 0, LK_EXCLUSIVE },   /* Read */
+   { 0, 1, 0, 0, LK_SHARED },  /* Read */
{ 0, 1, 0, 0, LK_SHARED },  /* Readdir */
{ 0, 1, 0, 0, LK_SHARED },  /* ReadLink */
{ 0, 2, 1, 1, LK_EXCLUSIVE },   /* Remove */

Modified: stable/8/sys/fs/nfsserver/nfs_nfsdstate.c
==
--- stable/8/sys/fs/nfsserver/nfs_nfsdstate.c   Sat Jan 15 00:34:50 2011
(r217436)
+++ stable/8/sys/fs/nfsserver/nfs_nfsdstate.c   Sat Jan 15 01:03:26 2011
(r217437)
@@ -4217,7 +4217,7 @@ static int
 nfsrv_clientconflict(struct nfsclient *clp, int *haslockp, __unused vnode_t vp,
 NFSPROC_T *p)
 {
-   int gotlock;
+   int gotlock, lktype;
 
/*
 * If lease hasn't expired, we can't fix it.
@@ -4227,7 +4227,8 @@ nfsrv_clientconflict(struct nfsclient *c
return (0);
if (*haslockp == 0) {
NFSUNLOCKSTATE();
-   NFSVOPUNLOCK(vp, 0, p);
+   lktype = VOP_ISLOCKED(vp);
+   VOP_UNLOCK(vp, 0);
NFSLOCKV4ROOTMUTEX();
nfsv4_relref(&nfsv4rootfs_lock);
do {
@@ -4236,7 +4237,7 @@ nfsrv_clientconflict(struct nfsclient *c
} while (!gotlock);
NFSUNLOCKV4ROOTMUTEX();
*haslockp = 1;
-   NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY, p);
+   vn_lock(vp, lktype | LK_RETRY);
return (1);
}
NFSUNLOCKSTATE();
@@ -4278,7 +4279,7 @@ nfsrv_delegconflict(struct nfsstate *stp
 vnode_t vp)
 {
struct nfsclient *clp = stp->ls_clp;
-   int gotlock, error, retrycnt, zapped_clp;
+   int gotlock, error, lktype, retrycnt, zapped_clp;
nfsv4stateid_t tstateid;
fhandle_t tfh;
 
@@ -4391,7 +4392,8 @@ nfsrv_delegconflict(struct nfsstate *stp
 */
if (*haslockp == 0) {
NFSUNLOCKSTATE();
-   NFSVOPUNLOCK(vp, 0, p);
+   lktype = VOP_ISLOCKED(vp);
+   VOP_UNLOCK(vp, 0);
NFSLOCKV4ROOTMUTEX();
nfsv4_relref(&nfsv4rootfs_lock);
do {
@@ -4400,7 +4402,7 @@ nfsrv_delegconflict(struct nfsstate *stp
} while (!gotlock);
NFSUNLOCKV4ROOTMUTEX();
*haslockp = 1;
-   NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY, p);
+   vn_lock(vp, lktype | LK_RETRY);
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"


Re: svn commit: r217369 - in head/sys: cam/scsi sys

2011-01-14 Thread Bruce Evans

On Fri, 14 Jan 2011 m...@freebsd.org wrote:


On Thu, Jan 13, 2011 at 10:50 PM, Bruce Evans  wrote:

On Thu, 13 Jan 2011 m...@freebsd.org wrote:


There appear to be 330 uses of SYSCTL and QUAD on the same line in
CURRENT. ?This seems reasonable to change them to S64, U64 and X64 so
they correctly reflect the size they operate upon.

What do y'all think?


Now I suggest delaying this until they can be renamed to a type- generic
SYSCTL_INT() (would probably need to be spelled differently, SYSCTL_I()
say, even if SYSCTL_INT() was changed at the same time).


I'm torn on this one.  The compiler knows the type (unless, for
SYSCTL_INT, NULL/0 is used, but that is also a compile-time check),
but to interpret it requires the use of __builtin_foo which is a gcc
extension and not part of standard C.

Philosophically, while I like this kind of letting the compiler do the
work, if you want C++ you know where to find it.


Oops.  I think sizeof() and issigned() can be used to determine the type
well enough in functions and initialized data (do a fuller type check if
the compiler supports it), but I don't know how to do this in static
sysctl declarations (since sizeof() can't be used in cpp expressions).

Bruce___
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: r217369 - in head/sys: cam/scsi sys

2011-01-14 Thread Garrett Cooper
On Fri, Jan 14, 2011 at 6:42 PM, Bruce Evans  wrote:
> On Fri, 14 Jan 2011 m...@freebsd.org wrote:
>
>> On Thu, Jan 13, 2011 at 10:50 PM, Bruce Evans 
>> wrote:
>>>
>>> On Thu, 13 Jan 2011 m...@freebsd.org wrote:
>>>
 There appear to be 330 uses of SYSCTL and QUAD on the same line in
 CURRENT.  This seems reasonable to change them to S64, U64 and X64 so
 they correctly reflect the size they operate upon.

 What do y'all think?
>>>
>>> Now I suggest delaying this until they can be renamed to a type- generic
>>> SYSCTL_INT() (would probably need to be spelled differently, SYSCTL_I()
>>> say, even if SYSCTL_INT() was changed at the same time).
>>
>> I'm torn on this one.  The compiler knows the type (unless, for
>> SYSCTL_INT, NULL/0 is used, but that is also a compile-time check),
>> but to interpret it requires the use of __builtin_foo which is a gcc
>> extension and not part of standard C.
>>
>> Philosophically, while I like this kind of letting the compiler do the
>> work, if you want C++ you know where to find it.
>
> Oops.  I think sizeof() and issigned() can be used to determine the type
> well enough in functions and initialized data (do a fuller type check if
> the compiler supports it), but I don't know how to do this in static
> sysctl declarations (since sizeof() can't be used in cpp expressions).

Why not just create some dumb testcases that can be run at build
time to determine that for you?
-Garrett
___
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: r217369 - in head/sys: cam/scsi sys

2011-01-14 Thread Bruce Evans

On Fri, 14 Jan 2011 m...@freebsd.org wrote:


On Thu, Jan 13, 2011 at 9:56 PM, Bruce Evans  wrote:

Now with stricter type checking, even formats for integers are redundant.
The CTLTYPE now always matches the type, and the format should always
match the type. ?The space wasted for the format is 1 pointer plus the
string.


There are several issues here.  First, for OPAQUE types the string is
interpreted by sysctl(8) to know how to interpret the binary blob.
Second, anyone can still use SYSCTL_OID(... CTLTYPE_INT, ..., "QU")
and there's not a lot that can be done to check it.  Locally I have


The format would be ignored for CTLTYPEs that describe an integer, and
might be passed in a different way for SYSCTL_OID() (it might be attached
to one of the other strings).


another patch for the various sysctl_handle_foo that asserts the
CTLTYPE_FOO matches the handler, but looking around the FreeBSD code
there's plenty of hand-rolled instances that won't pass; some of these
come from a SYSCTL_PROC setup.  Perhaps we could start with a warning
message and upgrade to a KASSERT later.


SYSCTL_PROC() and SYSCTL_OPAQUE() will always have little structure.  I
think the format string is meaningless and unused for SYSCTL_PROC().
For SYSCTL_OPAQUE(), it is used to encode the type (just by name).  Only
5 types seem to be support, and there should be fewer:
- T,dev_t: dev_t isn't important any more, and the kernel doesn't even
  generate any T,dev_t's for sysctl(8) to handle.
- S,clockinfo: a historical mistake from 4.4BSD.  It would be more useful
  to print the fields (all 4 of them) in this struct separately.  Each
  sysctl took lots specialized of code in 4.4BSD, so it was easier to
  pack even non-closely related fields like the ones in clockinfo
  together.  Even if you struct members together, it is convenient to
  have them separated in a subtree of a node for the struct.  FreeBSD
  now has zillions more clock sysctls but doesn't pack any of the new
  ones into old or new structs.
- S,timeval: might be useful, but it is used a whole once
  (for kern.boottime).
- S,loadavg: from 4.4BSD.  Like S,clockinfo, but not so bad.  The fields
  belong together more.  They can now be handled better as an array,
  like kern.cp_time[s] but unlike kern.clockrate.  The only difference
  in sysctl(8) output would be removal of ornations for the struct
  (braces).  The ornations make the output harder to filter, as do
  separate tokens, but separate tokens are natural for arrays.  The
  field separator for arrays seems to be a space and that is better
  than a comma.  For S_loadavg, the field separator is also a space
  and there are no field descriptors, but for S_clockinfo the ornations
  are very hard to parse -- there are commas in the field separators,
  and "="
Thirdly, at the moment sysctl(8) doesn't fetch the access flags and
type specifier and only looks at the string.  This is also fixable.


It seems to use CTLTYPE* for parsing user values only.  Is `kind' fetched
for writing (to the kernel) but not for reading?

Bruce___
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: r217369 - in head/sys: cam/scsi sys

2011-01-14 Thread Bruce Evans

On Fri, 14 Jan 2011, Garrett Cooper wrote:


On Fri, Jan 14, 2011 at 6:42 PM, Bruce Evans  wrote:

On Fri, 14 Jan 2011 m...@freebsd.org wrote:


On Thu, Jan 13, 2011 at 10:50 PM, Bruce Evans 
wrote:


On Thu, 13 Jan 2011 m...@freebsd.org wrote:


There appear to be 330 uses of SYSCTL and QUAD on the same line in
CURRENT. ?This seems reasonable to change them to S64, U64 and X64 so
they correctly reflect the size they operate upon.

What do y'all think?


Now I suggest delaying this until they can be renamed to a type- generic
SYSCTL_INT() (would probably need to be spelled differently, SYSCTL_I()
say, even if SYSCTL_INT() was changed at the same time).


I'm torn on this one. ?The compiler knows the type (unless, for
SYSCTL_INT, NULL/0 is used, but that is also a compile-time check),
but to interpret it requires the use of __builtin_foo which is a gcc
extension and not part of standard C.

Philosophically, while I like this kind of letting the compiler do the
work, if you want C++ you know where to find it.


Oops. ?I think sizeof() and issigned() can be used to determine the type
well enough in functions and initialized data (do a fuller type check if
the compiler supports it), but I don't know how to do this in static
sysctl declarations (since sizeof() can't be used in cpp expressions).


   Why not just create some dumb testcases that can be run at build
time to determine that for you?


Well, how?  You are given SYSCTL_I(&var, ...) and have to convert this
to what is now in SYSCTL_INT(), using only the type of var, in hundreds
or thousands of files.  I don't even know how to do this with a test
case for each file, short of parsing all the files.  Oops, I do know
how to translate from sizeof(var) to CTLTYPE_INT or CTLTYPE_UINT.
That's just (sizeof(var) == sizeof(int) ? CTLTYPE_INT : ...).  The
signness is harder (might need gnu typeof(), but not the recent type
checking attributes).  This won't convert from SYSCTL_I() existing
SYSCTL_INT() (the switch on the size would have to be in an ifdef for
that, but sizeof() doesn't work in ifdefs), but it works for generating
CTLTYPE_* internally SYSCTL_I().  The difficulty is converting from a
bare variable `var' to an integer representing the signedness of its
type, without using an unportability like typeof().  With typeof(), this
is:

/* Only works for arithmetic types: */
#define isinteger(var)  ((typeof(var))0.1 == 0)
#define issigned(var)   ((typeof(var))-1 < 0)
...

Bruce___
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"