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

2013-03-04 Thread Olivier Houchard
Author: cognet
Date: Mon Mar  4 10:41:54 2013
New Revision: 247776
URL: http://svnweb.freebsd.org/changeset/base/247776

Log:
  If we're using a PIPT L2 cache, only merge 2 segments if both the virtual
  and the physical addreses are contiguous.
  
  Submitted by: Thomas Skibo thomassk...@sbcglobal.net

Modified:
  head/sys/arm/arm/busdma_machdep-v6.c

Modified: head/sys/arm/arm/busdma_machdep-v6.c
==
--- head/sys/arm/arm/busdma_machdep-v6.cMon Mar  4 09:35:50 2013
(r247775)
+++ head/sys/arm/arm/busdma_machdep-v6.cMon Mar  4 10:41:54 2013
(r247776)
@@ -1007,6 +1007,9 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm
} else {
sl = map-slist[map-sync_count - 1];
if (map-sync_count == 0 ||
+#ifdef ARM_L2_PIPT
+   curaddr != sl-busaddr + sl-datacount ||
+#endif
vaddr != sl-vaddr + sl-datacount) {
if (++map-sync_count  dmat-nsegments)
goto cleanup;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r247777 - in head/sys: conf kern netinet sys

2013-03-04 Thread Davide Italiano
Author: davide
Date: Mon Mar  4 11:09:56 2013
New Revision: 24
URL: http://svnweb.freebsd.org/changeset/base/24

Log:
  - Make callout(9) tickless, relying on eventtimers(4) as backend for
  precise time event generation. This greatly improves granularity of
  callouts which are not anymore constrained to wait next tick to be
  scheduled.
  - Extend the callout KPI introducing a set of callout_reset_sbt* functions,
  which take a sbintime_t as timeout argument. The new KPI also offers a
  way for consumers to specify precision tolerance they allow, so that
  callout can coalesce events and reduce number of interrupts as well as
  potentially avoid scheduling a SWI thread.
  - Introduce support for dispatching callouts directly from hardware
  interrupt context, specifying an additional flag. This feature should be
  used carefully, as long as interrupt context has some limitations
  (e.g. no sleeping locks can be held).
  - Enhance mechanisms to gather informations about callwheel, introducing
  a new sysctl to obtain stats.
  
  This change breaks the KBI. struct callout fields has been changed, in
  particular 'int ticks' (4 bytes) has been replaced with 'sbintime_t'
  (8 bytes) and another 'sbintime_t' field was added for precision.
  
  Together with:mav
  Reviewed by:  attilio, bde, luigi, phk
  Sponsored by: Google Summer of Code 2012, iXsystems inc.
  Tested by:flo (amd64, sparc64), marius (sparc64), ian (arm),
markj (amd64), mav, Fabian Keil

Modified:
  head/sys/conf/NOTES
  head/sys/conf/options
  head/sys/kern/kern_clock.c
  head/sys/kern/kern_clocksource.c
  head/sys/kern/kern_tc.c
  head/sys/kern/kern_timeout.c
  head/sys/kern/subr_param.c
  head/sys/netinet/tcp_timer.c
  head/sys/sys/_callout.h
  head/sys/sys/callout.h
  head/sys/sys/systm.h
  head/sys/sys/time.h

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Mon Mar  4 10:41:54 2013(r247776)
+++ head/sys/conf/NOTES Mon Mar  4 11:09:56 2013(r24)
@@ -259,6 +259,8 @@ options SX_NOINLINE
 
 # SMP Debugging Options:
 #
+# CALLOUT_PROFILING enables rudimentary profiling of the callwheel data
+#structure used as backend in callout(9).
 # PREEMPTION allows the threads that are in the kernel to be preempted by
 #higher priority [interrupt] threads.  It helps with interactivity
 #and allows interrupt threads to run sooner rather than waiting.
@@ -297,6 +299,9 @@ options LOCK_PROFILING
 optionsMPROF_BUFFERS=1536
 optionsMPROF_HASH_SIZE=1543
 
+# Profiling for the callout(9) backend.
+optionsCALLOUT_PROFILING
+
 # Profiling for internal hash tables.
 optionsSLEEPQUEUE_PROFILING
 optionsTURNSTILE_PROFILING

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Mon Mar  4 10:41:54 2013(r247776)
+++ head/sys/conf/options   Mon Mar  4 11:09:56 2013(r24)
@@ -68,6 +68,7 @@ TEXTDUMP_VERBOSE  opt_ddb.h
 ADAPTIVE_LOCKMGRS
 ALQ
 AUDIT  opt_global.h
+CALLOUT_PROFILING
 CAPABILITIES   opt_capsicum.h
 CAPABILITY_MODEopt_capsicum.h
 COMPAT_43  opt_compat.h

Modified: head/sys/kern/kern_clock.c
==
--- head/sys/kern/kern_clock.c  Mon Mar  4 10:41:54 2013(r247776)
+++ head/sys/kern/kern_clock.c  Mon Mar  4 11:09:56 2013(r24)
@@ -460,7 +460,7 @@ hardclock_cpu(int usermode)
if (td-td_intr_frame != NULL)
PMC_SOFT_CALL_TF( , , clock, hard, td-td_intr_frame);
 #endif
-   callout_tick();
+   callout_process(sbinuptime());
 }
 
 /*
@@ -550,7 +550,6 @@ hardclock_cnt(int cnt, int usermode)
if (td-td_intr_frame != NULL)
PMC_SOFT_CALL_TF( , , clock, hard, td-td_intr_frame);
 #endif
-   callout_tick();
/* We are in charge to handle this tick duty. */
if (newticks  0) {
/* Dangerous and no need to call these things concurrently. */

Modified: head/sys/kern/kern_clocksource.c
==
--- head/sys/kern/kern_clocksource.cMon Mar  4 10:41:54 2013
(r247776)
+++ head/sys/kern/kern_clocksource.cMon Mar  4 11:09:56 2013
(r24)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2010-2012 Alexander Motin m...@freebsd.org
+ * Copyright (c) 2010-2013 Alexander Motin m...@freebsd.org
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -37,6 +37,7 @@ __FBSDID($FreeBSD$);
 #include sys/param.h
 #include sys/systm.h
 #include sys/bus.h
+#include sys/limits.h
 #include sys/lock.h
 #include sys/kdb.h
 #include sys/ktr.h
@@ -63,17 +64,14 @@ int cpu_can_deep_sleep = 0; /* C3 stat
 int

svn commit: r247778 - head/sys/kern

2013-03-04 Thread Davide Italiano
Author: davide
Date: Mon Mar  4 11:22:19 2013
New Revision: 247778
URL: http://svnweb.freebsd.org/changeset/base/247778

Log:
  MFcalloutng (r244355):
  Make loadavg calculation callout direct. There are several reasons for it:
   - it is very simple and doesn't worth context switch to SWI;
   - since SWI is no longer used here, we can remove twelve years old hack,
  excluding this SWI from from the loadavg statistics;
   - it fixes problem when eventtimer (HPET) shares interrupt with some other
  device, and that interrupt thread counted as permanent loadavg of 1; now
  loadavg accounted before that interrupt thread is scheduled.
  
  Sponsored by: Google Summer of Code 2012, iXsystems inc.
  Tested by:flo, marius, ian, Fabian Keil, markj

Modified:
  head/sys/kern/kern_intr.c
  head/sys/kern/kern_synch.c

Modified: head/sys/kern/kern_intr.c
==
--- head/sys/kern/kern_intr.c   Mon Mar  4 11:09:56 2013(r24)
+++ head/sys/kern/kern_intr.c   Mon Mar  4 11:22:19 2013(r247778)
@@ -1103,7 +1103,6 @@ int
 swi_add(struct intr_event **eventp, const char *name, driver_intr_t handler,
void *arg, int pri, enum intr_type flags, void **cookiep)
 {
-   struct thread *td;
struct intr_event *ie;
int error;
 
@@ -1125,15 +1124,7 @@ swi_add(struct intr_event **eventp, cons
}
error = intr_event_add_handler(ie, name, NULL, handler, arg,
PI_SWI(pri), flags, cookiep);
-   if (error)
-   return (error);
-   if (pri == SWI_CLOCK) {
-   td = ie-ie_thread-it_thread;
-   thread_lock(td);
-   td-td_flags |= TDF_NOLOAD;
-   thread_unlock(td);
-   }
-   return (0);
+   return (error);
 }
 
 /*

Modified: head/sys/kern/kern_synch.c
==
--- head/sys/kern/kern_synch.c  Mon Mar  4 11:09:56 2013(r24)
+++ head/sys/kern/kern_synch.c  Mon Mar  4 11:22:19 2013(r247778)
@@ -560,8 +560,9 @@ loadav(void *arg)
 * random variation to avoid synchronisation with processes that
 * run at regular intervals.
 */
-   callout_reset(loadav_callout, hz * 4 + (int)(random() % (hz * 2 + 1)),
-   loadav, NULL);
+   callout_reset_sbt(loadav_callout,
+   tick_sbt * (hz * 4 + (int)(random() % (hz * 2 + 1))), 0,
+   loadav, NULL, C_DIRECT_EXEC | C_HARDCLOCK);
 }
 
 /* ARGSUSED */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r247779 - in head: contrib/libyaml lib lib/libyaml share/mk tools

2013-03-04 Thread Baptiste Daroussin
Author: bapt
Date: Mon Mar  4 11:27:41 2013
New Revision: 247779
URL: http://svnweb.freebsd.org/changeset/base/247779

Log:
  Import libyaml as libbsdyml (private brand name)
  
  LibYAML is a YAML 1.1 parser and emitter under MIT license which will
  soon be used by the pkg boostrap (usr.bin/pkg) and bhyve
  
  Reviewed by:  roberto, antoine

Added:
  head/contrib/libyaml/
 - copied from r247775, vendor/libyaml/dist/
  head/lib/libyaml/
  head/lib/libyaml/Makefile   (contents, props changed)
  head/lib/libyaml/config.h   (contents, props changed)
Modified:
  head/lib/Makefile
  head/share/mk/bsd.libnames.mk
  head/tools/make_libdeps.sh

Modified: head/lib/Makefile
==
--- head/lib/Makefile   Mon Mar  4 11:22:19 2013(r247778)
+++ head/lib/Makefile   Mon Mar  4 11:27:41 2013(r247779)
@@ -119,6 +119,7 @@ SUBDIR= ${SUBDIR_ORDERED} \
${_libvmmapi} \
libwrap \
liby \
+   libyaml \
libz \
${_atf} \
${_bind} \

Added: head/lib/libyaml/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libyaml/Makefile   Mon Mar  4 11:27:41 2013(r247779)
@@ -0,0 +1,23 @@
+# $FreeBSD$
+
+LIBYAML=   ${.CURDIR}/../../contrib/libyaml
+
+LIB=   bsdyml
+SHLIB_MAJOR=   0
+INCS=  bsdyml.h
+SRCS=  api.c dumper.c emitter.c loader.c \
+   parser.c reader.c scanner.c writer.c
+
+.PATH: ${LIBYAML}/src ${LIBYAML}/include
+CLEANFILES=bsdyml.h
+
+WARNS?=1
+CFLAGS+=   -I${LIBYAML}/include \
+   -I${LIBYAML} \
+   -I${.CURDIR} \
+   -DHAVE_CONFIG_H
+
+bsdyml.h: yaml.h
+   cp -f ${.ALLSRC} ${.TARGET}
+
+.include bsd.lib.mk

Added: head/lib/libyaml/config.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libyaml/config.h   Mon Mar  4 11:27:41 2013(r247779)
@@ -0,0 +1,83 @@
+/* $FreeBSD$ */
+
+/* config.h.  Generated from config.h.in by configure.  */
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to 1 if you have the dlfcn.h header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the inttypes.h header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the memory.h header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the stdint.h header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the stdlib.h header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the strings.h header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the string.h header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the sys/stat.h header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the sys/types.h header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the unistd.h header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#define LT_OBJDIR .libs/
+
+/* Name of package */
+#define PACKAGE yaml
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT http://pyyaml.org/newticket?component=libyaml;
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME yaml
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING yaml 0.1.4
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME yaml
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL 
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION 0.1.4
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION 0.1.4
+
+/* Define the major version number. */
+#define YAML_VERSION_MAJOR 0
+
+/* Define the minor version number. */
+#define YAML_VERSION_MINOR 1
+
+/* Define the patch version number. */
+#define YAML_VERSION_PATCH 4
+
+/* Define the version string. */
+#define YAML_VERSION_STRING 0.1.4
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `unsigned int' if sys/types.h does not define. */
+/* #undef size_t */

Modified: head/share/mk/bsd.libnames.mk
==
--- head/share/mk/bsd.libnames.mk   Mon Mar  4 11:22:19 2013
(r247778)
+++ head/share/mk/bsd.libnames.mk   Mon Mar  4 11:27:41 2013
(r247779)
@@ -25,6 +25,7 @@ LIBBIND9?=${DESTDIR}${LIBDIR}/libbind9.
 .endif
 LIBBLUETOOTH?= ${DESTDIR}${LIBDIR}/libbluetooth.a
 LIBBSDXML?=${DESTDIR}${LIBDIR}/libbsdxml.a
+LIBBSDYML?=

svn commit: r247780 - head/usr.sbin/tzsetup

2013-03-04 Thread Devin Teske
Author: dteske
Date: Mon Mar  4 11:34:31 2013
New Revision: 247780
URL: http://svnweb.freebsd.org/changeset/base/247780

Log:
  Fix VERBOSE reporting on results when removing _PATH_LOCALTIME for UTC option.
  
  PR:   bin/164976
  Submitted by: dteske

Modified:
  head/usr.sbin/tzsetup/tzsetup.c

Modified: head/usr.sbin/tzsetup/tzsetup.c
==
--- head/usr.sbin/tzsetup/tzsetup.c Mon Mar  4 11:27:41 2013
(r247779)
+++ head/usr.sbin/tzsetup/tzsetup.c Mon Mar  4 11:34:31 2013
(r247780)
@@ -703,8 +703,13 @@ install_zoneinfo_file(const char *zonein
return (DITEM_FAILURE | DITEM_RECREATE);
}
 #ifdef VERBOSE
+   snprintf(title, sizeof(title), Done);
snprintf(prompt, sizeof(prompt),
Removed %s, path_localtime);
+   if (usedialog)
+   dialog_msgbox(title, prompt, 8, 72, 1);
+   else
+   fprintf(stderr, %s\n, prompt);
 #endif
return (DITEM_LEAVE_MENU);
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


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

2013-03-04 Thread Davide Italiano
Author: davide
Date: Mon Mar  4 11:51:46 2013
New Revision: 247783
URL: http://svnweb.freebsd.org/changeset/base/247783

Log:
  MFcalloutng:
  Convert sleepqueue(9) bits to the new callout KPI. Take advantage of
  the possibility to run callback directly from hw interrupt context.
  
  Sponsored by: Google Summer of Code 2012, iXsystems inc.
  Tested by:flo, marius, ian, markj, Fabian Keil

Modified:
  head/sys/kern/subr_sleepqueue.c
  head/sys/sys/sleepqueue.h

Modified: head/sys/kern/subr_sleepqueue.c
==
--- head/sys/kern/subr_sleepqueue.c Mon Mar  4 11:43:20 2013
(r247782)
+++ head/sys/kern/subr_sleepqueue.c Mon Mar  4 11:51:46 2013
(r247783)
@@ -361,7 +361,8 @@ sleepq_add(void *wchan, struct lock_obje
  * sleep queue after timo ticks if the thread has not already been awakened.
  */
 void
-sleepq_set_timeout(void *wchan, int timo)
+sleepq_set_timeout_sbt(void *wchan, sbintime_t sbt, sbintime_t pr,
+int flags)
 {
struct sleepqueue_chain *sc;
struct thread *td;
@@ -372,7 +373,8 @@ sleepq_set_timeout(void *wchan, int timo
MPASS(TD_ON_SLEEPQ(td));
MPASS(td-td_sleepqueue == NULL);
MPASS(wchan != NULL);
-   callout_reset_curcpu(td-td_slpcallout, timo, sleepq_timeout, td);
+   callout_reset_sbt_on(td-td_slpcallout, sbt, pr,
+   sleepq_timeout, td, PCPU_GET(cpuid), flags | C_DIRECT_EXEC);
 }
 
 /*

Modified: head/sys/sys/sleepqueue.h
==
--- head/sys/sys/sleepqueue.h   Mon Mar  4 11:43:20 2013(r247782)
+++ head/sys/sys/sleepqueue.h   Mon Mar  4 11:51:46 2013(r247783)
@@ -108,7 +108,10 @@ struct sleepqueue *sleepq_lookup(void *w
 void   sleepq_release(void *wchan);
 void   sleepq_remove(struct thread *td, void *wchan);
 intsleepq_signal(void *wchan, int flags, int pri, int queue);
-void   sleepq_set_timeout(void *wchan, int timo);
+void   sleepq_set_timeout_sbt(void *wchan, sbintime_t sbt,
+   sbintime_t pr, int flags);
+#definesleepq_set_timeout(wchan, timo) 
\
+sleepq_set_timeout_sbt((wchan), (tick_sbt * (timo)), 0, C_HARDCLOCK)
 u_int  sleepq_sleepcnt(void *wchan, int queue);
 intsleepq_timedwait(void *wchan, int pri);
 intsleepq_timedwait_sig(void *wchan, int pri);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r247784 - head/sys/sys

2013-03-04 Thread Davide Italiano
Author: davide
Date: Mon Mar  4 11:55:32 2013
New Revision: 247784
URL: http://svnweb.freebsd.org/changeset/base/247784

Log:
  Style fix: remove useless braces. Sorry, my bad.
  
  Submitted by: bde

Modified:
  head/sys/sys/sleepqueue.h

Modified: head/sys/sys/sleepqueue.h
==
--- head/sys/sys/sleepqueue.h   Mon Mar  4 11:51:46 2013(r247783)
+++ head/sys/sys/sleepqueue.h   Mon Mar  4 11:55:32 2013(r247784)
@@ -111,7 +111,7 @@ int sleepq_signal(void *wchan, int flags
 void   sleepq_set_timeout_sbt(void *wchan, sbintime_t sbt,
sbintime_t pr, int flags);
 #definesleepq_set_timeout(wchan, timo) 
\
-sleepq_set_timeout_sbt((wchan), (tick_sbt * (timo)), 0, C_HARDCLOCK)
+sleepq_set_timeout_sbt((wchan), tick_sbt * (timo), 0, C_HARDCLOCK)
 u_int  sleepq_sleepcnt(void *wchan, int queue);
 intsleepq_timedwait(void *wchan, int pri);
 intsleepq_timedwait_sig(void *wchan, int pri);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


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

2013-03-04 Thread Davide Italiano
Author: davide
Date: Mon Mar  4 12:20:48 2013
New Revision: 247785
URL: http://svnweb.freebsd.org/changeset/base/247785

Log:
  MFcalloutng:
  Extend condvar(9) KPI introducing sbt variant of cv_timedwait. This
  rely on the previously committed sleepq_set_timeout_sbt().
  
  Sponsored by: Google Summer of Code 2012, iXsystems inc.
  Tested by:flo, marius, ian, markj, Fabian Keil

Modified:
  head/sys/kern/kern_condvar.c
  head/sys/sys/condvar.h

Modified: head/sys/kern/kern_condvar.c
==
--- head/sys/kern/kern_condvar.cMon Mar  4 11:55:32 2013
(r247784)
+++ head/sys/kern/kern_condvar.cMon Mar  4 12:20:48 2013
(r247785)
@@ -270,12 +270,13 @@ _cv_wait_sig(struct cv *cvp, struct lock
 }
 
 /*
- * Wait on a condition variable for at most timo/hz seconds.  Returns 0 if the
- * process was resumed by cv_signal or cv_broadcast, EWOULDBLOCK if the timeout
- * expires.
+ * Wait on a condition variable for (at most) the value specified in sbt
+ * argument. Returns 0 if the process was resumed by cv_signal or cv_broadcast,
+ * EWOULDBLOCK if the timeout expires.
  */
 int
-_cv_timedwait(struct cv *cvp, struct lock_object *lock, int timo)
+_cv_timedwait_sbt(struct cv *cvp, struct lock_object *lock, sbintime_t sbt,
+sbintime_t pr, int flags)
 {
WITNESS_SAVE_DECL(lock_witness);
struct lock_class *class;
@@ -311,7 +312,7 @@ _cv_timedwait(struct cv *cvp, struct loc
DROP_GIANT();
 
sleepq_add(cvp, lock, cvp-cv_description, SLEEPQ_CONDVAR, 0);
-   sleepq_set_timeout(cvp, timo);
+   sleepq_set_timeout_sbt(cvp, sbt, pr, flags);
if (lock != Giant.lock_object) {
if (class-lc_flags  LC_SLEEPABLE)
sleepq_release(cvp);
@@ -336,13 +337,15 @@ _cv_timedwait(struct cv *cvp, struct loc
 }
 
 /*
- * Wait on a condition variable for at most timo/hz seconds, allowing
- * interruption by signals.  Returns 0 if the thread was resumed by cv_signal
- * or cv_broadcast, EWOULDBLOCK if the timeout expires, and EINTR or ERESTART 
if
- * a signal was caught.
+ * Wait on a condition variable for (at most) the value specified in sbt 
+ * argument, allowing interruption by signals.
+ * Returns 0 if the thread was resumed by cv_signal or cv_broadcast,
+ * EWOULDBLOCK if the timeout expires, and EINTR or ERESTART if a signal
+ * was caught.
  */
 int
-_cv_timedwait_sig(struct cv *cvp, struct lock_object *lock, int timo)
+_cv_timedwait_sig_sbt(struct cv *cvp, struct lock_object *lock,
+sbintime_t sbt, sbintime_t pr, int flags)
 {
WITNESS_SAVE_DECL(lock_witness);
struct lock_class *class;
@@ -379,7 +382,7 @@ _cv_timedwait_sig(struct cv *cvp, struct
 
sleepq_add(cvp, lock, cvp-cv_description, SLEEPQ_CONDVAR |
SLEEPQ_INTERRUPTIBLE, 0);
-   sleepq_set_timeout(cvp, timo);
+   sleepq_set_timeout_sbt(cvp, sbt, pr, flags);
if (lock != Giant.lock_object) {
if (class-lc_flags  LC_SLEEPABLE)
sleepq_release(cvp);

Modified: head/sys/sys/condvar.h
==
--- head/sys/sys/condvar.h  Mon Mar  4 11:55:32 2013(r247784)
+++ head/sys/sys/condvar.h  Mon Mar  4 12:20:48 2013(r247785)
@@ -55,8 +55,10 @@ void cv_destroy(struct cv *cvp);
 void   _cv_wait(struct cv *cvp, struct lock_object *lock);
 void   _cv_wait_unlock(struct cv *cvp, struct lock_object *lock);
 int_cv_wait_sig(struct cv *cvp, struct lock_object *lock);
-int_cv_timedwait(struct cv *cvp, struct lock_object *lock, int timo);
-int_cv_timedwait_sig(struct cv *cvp, struct lock_object *lock, int timo);
+int_cv_timedwait_sbt(struct cv *cvp, struct lock_object *lock,
+   sbintime_t sbt, sbintime_t pr, int flags);
+int_cv_timedwait_sig_sbt(struct cv *cvp, struct lock_object *lock,
+   sbintime_t sbt, sbintime_t pr, int flags);
 
 void   cv_signal(struct cv *cvp);
 void   cv_broadcastpri(struct cv *cvp, int pri);
@@ -68,9 +70,15 @@ void cv_broadcastpri(struct cv *cvp, int
 #definecv_wait_sig(cvp, lock)  
\
_cv_wait_sig((cvp), (lock)-lock_object)
 #definecv_timedwait(cvp, lock, timo)   
\
-   _cv_timedwait((cvp), (lock)-lock_object, (timo))
+   _cv_timedwait_sbt((cvp), (lock)-lock_object,  \
+   tick_sbt * (timo), 0, C_HARDCLOCK)
+#definecv_timedwait_sbt(cvp, lock, sbt, pr, flags) 
\
+   _cv_timedwait_sbt((cvp), (lock)-lock_object, (sbt), (pr), (flags))
 #definecv_timedwait_sig(cvp, lock, timo)   
\
-   _cv_timedwait_sig((cvp), (lock)-lock_object, (timo))
+   _cv_timedwait_sig_sbt((cvp), (lock)-lock_object,  \
+   tick_sbt * (timo), 0, C_HARDCLOCK)
+#define

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

2013-03-04 Thread Davide Italiano
Author: davide
Date: Mon Mar  4 12:48:41 2013
New Revision: 247787
URL: http://svnweb.freebsd.org/changeset/base/247787

Log:
  MFcalloutng:
  Introduce sbt variants of msleep(), msleep_spin(), pause(), tsleep() in
  the KPI, allowing to specify timeout in 'sbintime_t' rather than ticks.
  
  Sponsored by: Google Summer of Code 2012, iXsystems inc.
  Tested by:flo, marius, ian, markj, Fabian Keil

Modified:
  head/sys/kern/kern_synch.c
  head/sys/sys/mutex.h
  head/sys/sys/rwlock.h
  head/sys/sys/sx.h
  head/sys/sys/systm.h

Modified: head/sys/kern/kern_synch.c
==
--- head/sys/kern/kern_synch.c  Mon Mar  4 12:33:40 2013(r247786)
+++ head/sys/kern/kern_synch.c  Mon Mar  4 12:48:41 2013(r247787)
@@ -146,12 +146,12 @@ sleepinit(void)
  */
 int
 _sleep(void *ident, struct lock_object *lock, int priority,
-const char *wmesg, int timo)
+const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags)
 {
struct thread *td;
struct proc *p;
struct lock_class *class;
-   int catch, flags, lock_state, pri, rval;
+   int catch, lock_state, pri, rval, sleepq_flags;
WITNESS_SAVE_DECL(lock_witness);
 
td = curthread;
@@ -162,7 +162,7 @@ _sleep(void *ident, struct lock_object *
 #endif
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, lock,
Sleeping on \%s\, wmesg);
-   KASSERT(timo != 0 || mtx_owned(Giant) || lock != NULL,
+   KASSERT(sbt != 0 || mtx_owned(Giant) || lock != NULL,
(sleeping without a lock));
KASSERT(p != NULL, (msleep1));
KASSERT(ident != NULL  TD_IS_RUNNING(td), (msleep));
@@ -199,13 +199,13 @@ _sleep(void *ident, struct lock_object *
sleepq_remove(td, td-td_wchan);
 
if (ident == pause_wchan)
-   flags = SLEEPQ_PAUSE;
+   sleepq_flags = SLEEPQ_PAUSE;
else
-   flags = SLEEPQ_SLEEP;
+   sleepq_flags = SLEEPQ_SLEEP;
if (catch)
-   flags |= SLEEPQ_INTERRUPTIBLE;
+   sleepq_flags |= SLEEPQ_INTERRUPTIBLE;
if (priority  PBDRY)
-   flags |= SLEEPQ_STOP_ON_BDRY;
+   sleepq_flags |= SLEEPQ_STOP_ON_BDRY;
 
sleepq_lock(ident);
CTR5(KTR_PROC, sleep: thread %ld (pid %ld, %s) on %s (%p),
@@ -231,18 +231,18 @@ _sleep(void *ident, struct lock_object *
 * stopped, then td will no longer be on a sleep queue upon
 * return from cursig().
 */
-   sleepq_add(ident, lock, wmesg, flags, 0);
-   if (timo)
-   sleepq_set_timeout(ident, timo);
+   sleepq_add(ident, lock, wmesg, sleepq_flags, 0);
+   if (sbt != 0)
+   sleepq_set_timeout_sbt(ident, sbt, pr, flags);
if (lock != NULL  class-lc_flags  LC_SLEEPABLE) {
sleepq_release(ident);
WITNESS_SAVE(lock, lock_witness);
lock_state = class-lc_unlock(lock);
sleepq_lock(ident);
}
-   if (timo  catch)
+   if (sbt != 0  catch)
rval = sleepq_timedwait_sig(ident, pri);
-   else if (timo)
+   else if (sbt != 0)
rval = sleepq_timedwait(ident, pri);
else if (catch)
rval = sleepq_wait_sig(ident, pri);
@@ -263,7 +263,8 @@ _sleep(void *ident, struct lock_object *
 }
 
 int
-msleep_spin(void *ident, struct mtx *mtx, const char *wmesg, int timo)
+msleep_spin_sbt(void *ident, struct mtx *mtx, const char *wmesg,
+sbintime_t sbt, sbintime_t pr, int flags)
 {
struct thread *td;
struct proc *p;
@@ -301,8 +302,8 @@ msleep_spin(void *ident, struct mtx *mtx
 * We put ourselves on the sleep queue and start our timeout.
 */
sleepq_add(ident, mtx-lock_object, wmesg, SLEEPQ_SLEEP, 0);
-   if (timo)
-   sleepq_set_timeout(ident, timo);
+   if (sbt != 0)
+   sleepq_set_timeout_sbt(ident, sbt, pr, flags);
 
/*
 * Can't call ktrace with any spin locks held so it can lock the
@@ -324,7 +325,7 @@ msleep_spin(void *ident, struct mtx *mtx
wmesg);
sleepq_lock(ident);
 #endif
-   if (timo)
+   if (sbt != 0)
rval = sleepq_timedwait(ident, 0);
else {
sleepq_wait(ident, 0);
@@ -348,28 +349,30 @@ msleep_spin(void *ident, struct mtx *mtx
  * to a timo value of one.
  */
 int
-pause(const char *wmesg, int timo)
+pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags)
 {
-   KASSERT(timo = 0, (pause: timo must be = 0));
+   int sbt_sec;
+
+   sbt_sec = sbintime_getsec(sbt);
+   KASSERT(sbt_sec = 0, (pause: timo must be = 0));
 
/* silently convert invalid timeouts */
-   if (timo  1)
-   timo = 1;
+   if (sbt == 0)
+   sbt = tick_sbt;
 
if (cold) {
/*
-* We delay one HZ at a time to avoid 

svn commit: r247788 - head/sys/vm

2013-03-04 Thread Attilio Rao
Author: attilio
Date: Mon Mar  4 13:10:59 2013
New Revision: 247788
URL: http://svnweb.freebsd.org/changeset/base/247788

Log:
  Merge from vmcontention:
  As vm objects are type-stable there is no need to initialize the
  resident splay tree pointer and the cache splay tree pointer in
  _vm_object_allocate() but this could be done in the init UMA zone
  handler.
  
  The destructor UMA zone handler, will further check if the condition is
  retained at every destruction and catch for bugs.
  
  Sponsored by: EMC / Isilon storage division
  Submitted by: alc

Modified:
  head/sys/vm/vm_object.c

Modified: head/sys/vm/vm_object.c
==
--- head/sys/vm/vm_object.c Mon Mar  4 12:48:41 2013(r247787)
+++ head/sys/vm/vm_object.c Mon Mar  4 13:10:59 2013(r247788)
@@ -165,8 +165,9 @@ vm_object_zdtor(void *mem, int size, voi
 
object = (vm_object_t)mem;
KASSERT(TAILQ_EMPTY(object-memq),
-   (object %p has resident pages,
-   object));
+   (object %p has resident pages in its memq, object));
+   KASSERT(object-root == NULL,
+   (object %p has resident pages in its tree, object));
 #if VM_NRESERVLEVEL  0
KASSERT(LIST_EMPTY(object-rvq),
(object %p has reservations,
@@ -197,9 +198,11 @@ vm_object_zinit(void *mem, int size, int
mtx_init(object-mtx, vm object, NULL, MTX_DEF | MTX_DUPOK);
 
/* These are true for any object that has been freed */
+   object-root = NULL;
object-paging_in_progress = 0;
object-resident_page_count = 0;
object-shadow_count = 0;
+   object-cache = NULL;
return (0);
 }
 
@@ -210,7 +213,6 @@ _vm_object_allocate(objtype_t type, vm_p
TAILQ_INIT(object-memq);
LIST_INIT(object-shadow_head);
 
-   object-root = NULL;
object-type = type;
switch (type) {
case OBJT_DEAD:
@@ -247,7 +249,6 @@ _vm_object_allocate(objtype_t type, vm_p
 #if VM_NRESERVLEVEL  0
LIST_INIT(object-rvq);
 #endif
-   object-cache = NULL;
 
mtx_lock(vm_object_list_mtx);
TAILQ_INSERT_TAIL(vm_object_list, object, object_list);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r247791 - head/share/man/man7

2013-03-04 Thread Eitan Adler
Author: eadler
Date: Mon Mar  4 13:57:46 2013
New Revision: 247791
URL: http://svnweb.freebsd.org/changeset/base/247791

Log:
  Modernize some portions of the ports man page.
  Stop documenting other operating systems's default patha
  
  Approved by:  bcr (mentor)

Modified:
  head/share/man/man7/ports.7

Modified: head/share/man/man7/ports.7
==
--- head/share/man/man7/ports.7 Mon Mar  4 13:17:52 2013(r247790)
+++ head/share/man/man7/ports.7 Mon Mar  4 13:57:46 2013(r247791)
@@ -490,27 +490,17 @@ single file
 .Bl -tag -width .Pa /usr/ports/Mk/bsd.port.mk -compact
 .It Pa /usr/ports
 The default ports directory
-.No ( Fx
-and
-.Ox ) .
-.It Pa /usr/pkgsrc
-The default ports directory
-.Pq Nx .
 .It Pa /usr/ports/Mk/bsd.port.mk
 The big Kahuna.
 .El
 .Sh SEE ALSO
 .Xr make 1 ,
-.Xr pkg_add 1 ,
-.Xr pkg_create 1 ,
-.Xr pkg_delete 1 ,
-.Xr pkg_info 1 ,
-.Xr pkg_version 1
+.Xr pkg 8 ,
+.Xr portsnap 8
 .Pp
 The following are part of the ports collection:
 .Pp
 .Xr portaudit 1 ,
-.Xr portcheckout 1 ,
 .Xr portlint 1
 .Rs
 .%B The FreeBSD Handbook
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r247792 - head/sys/dev/syscons

2013-03-04 Thread Davide Italiano
Author: davide
Date: Mon Mar  4 14:00:58 2013
New Revision: 247792
URL: http://svnweb.freebsd.org/changeset/base/247792

Log:
  MFcalloutng (r244249, r244306 by mav):
  - Switch syscons from timeout() to callout_reset_flags() and specify that
  precision is not important there -- anything from 20 to 30Hz will be fine.
  - Reduce syscons refresh rate to 1-2Hz when console is in graphics mode
  and there is nothing to do except some polling for keyboard.  Text mode
  refresh would also be nice to have adaptive, but this change at least
  should help laptop users who running X.
  
  Sponsored by: Google Summer of Code 2012, iXsystems inc.
  Tested by:flo, marius, ian, markj, Fabian Keil

Modified:
  head/sys/dev/syscons/syscons.c
  head/sys/dev/syscons/syscons.h

Modified: head/sys/dev/syscons/syscons.c
==
--- head/sys/dev/syscons/syscons.c  Mon Mar  4 13:57:46 2013
(r247791)
+++ head/sys/dev/syscons/syscons.c  Mon Mar  4 14:00:58 2013
(r247792)
@@ -506,6 +506,8 @@ sc_attach_unit(int unit, int flags)
 
 sc = sc_get_softc(unit, flags  SC_KERNEL_CONSOLE);
 sc-config = flags;
+callout_init(sc-ctimeout, 0);
+callout_init(sc-cblink, 0);
 scp = sc_get_stat(sc-dev[0]);
 if (sc_console == NULL)/* sc_console_unit  0 */
sc_console = scp;
@@ -1831,13 +1833,11 @@ static void
 scrn_timer(void *arg)
 {
 #ifndef PC98
-static int kbd_interval = 0;
+static time_t kbd_time_stamp = 0;
 #endif
-struct timeval tv;
 sc_softc_t *sc;
 scr_stat *scp;
-int again;
-int s;
+int again, rate;
 
 again = (arg != NULL);
 if (arg != NULL)
@@ -1847,18 +1847,18 @@ scrn_timer(void *arg)
 else
return;
 
+/* find the vty to update */
+scp = sc-cur_scp;
+
 /* don't do anything when we are performing some I/O operations */
-if (suspend_in_progress || sc-font_loading_in_progress) {
-   if (again)
-   timeout(scrn_timer, sc, hz / 10);
-   return;
-}
-s = spltty();
+if (suspend_in_progress || sc-font_loading_in_progress)
+   goto done;
 
 #ifndef PC98
 if ((sc-kbd == NULL)  (sc-config  SC_AUTODETECT_KBD)) {
/* try to allocate a keyboard automatically */
-   if (++kbd_interval = 25) {
+   if (kbd_time_stamp != time_uptime) {
+   kbd_time_stamp = time_uptime;
sc-keyboard = sc_allocate_keyboard(sc, -1);
if (sc-keyboard = 0) {
sc-kbd = kbd_get_keyboard(sc-keyboard);
@@ -1867,25 +1867,20 @@ scrn_timer(void *arg)
update_kbd_state(sc-cur_scp, sc-cur_scp-status,
 LOCK_MASK);
}
-   kbd_interval = 0;
}
 }
 #endif /* PC98 */
 
-/* find the vty to update */
-scp = sc-cur_scp;
-
 /* should we stop the screen saver? */
-getmicrouptime(tv);
 if (debugger  0 || panicstr || shutdown_in_progress)
sc_touch_scrn_saver();
 if (run_scrn_saver) {
-   if (tv.tv_sec  sc-scrn_time_stamp + scrn_blank_time)
+   if (time_uptime  sc-scrn_time_stamp + scrn_blank_time)
sc-flags |= SC_SCRN_IDLE;
else
sc-flags = ~SC_SCRN_IDLE;
 } else {
-   sc-scrn_time_stamp = tv.tv_sec;
+   sc-scrn_time_stamp = time_uptime;
sc-flags = ~SC_SCRN_IDLE;
if (scrn_blank_time  0)
run_scrn_saver = TRUE;
@@ -1898,12 +1893,8 @@ scrn_timer(void *arg)
 
 /* should we just return ? */
 if (sc-blink_in_progress || sc-switch_in_progress
-   || sc-write_in_progress) {
-   if (again)
-   timeout(scrn_timer, sc, hz / 10);
-   splx(s);
-   return;
-}
+   || sc-write_in_progress)
+   goto done;
 
 /* Update the screen */
 scp = sc-cur_scp; /* cur_scp may have changed... */
@@ -1917,9 +1908,19 @@ scrn_timer(void *arg)
(*current_saver)(sc, TRUE);
 #endif
 
-if (again)
-   timeout(scrn_timer, sc, hz / 25);
-splx(s);
+done:
+if (again) {
+   /*
+* Use reduced refresh rate if we are in graphics and that is not a
+* graphical screen saver.  In such case we just have nothing to do.
+*/
+   if (ISGRAPHSC(scp)  !(sc-flags  SC_SCRN_BLANKED))
+   rate = 2;
+   else
+   rate = 30;
+   callout_reset_sbt(sc-ctimeout, SBT_1S / rate, 0,
+   scrn_timer, sc, C_PREL(1));
+}
 }
 
 static int
@@ -3863,7 +3864,8 @@ blink_screen(void *arg)
(*scp-rndr-draw)(scp, 0, scp-xsize*scp-ysize, 
   scp-sc-blink_in_progress  1);
scp-sc-blink_in_progress--;
-   timeout(blink_screen, scp, hz / 10);
+   callout_reset_sbt(scp-sc-cblink, SBT_1S / 15, 0,
+   blink_screen, scp, C_PREL(0));
 }
 }
 

Modified: head/sys/dev/syscons/syscons.h
==
--- head/sys/dev/syscons/syscons.h  

Re: svn commit: r247792 - head/sys/dev/syscons

2013-03-04 Thread Luigi Rizzo
On Mon, Mar 04, 2013 at 02:00:59PM +, Davide Italiano wrote:
 Author: davide
 Date: Mon Mar  4 14:00:58 2013
 New Revision: 247792
 URL: http://svnweb.freebsd.org/changeset/base/247792
 
 Log:
   MFcalloutng (r244249, r244306 by mav):
   - Switch syscons from timeout() to callout_reset_flags() and specify that
   precision is not important there -- anything from 20 to 30Hz will be fine.
   - Reduce syscons refresh rate to 1-2Hz when console is in graphics mode
   and there is nothing to do except some polling for keyboard.  Text mode

just to understand, how does this 1-2Hz affect the respose to keypresses ?
does it mean it takes 0.5..1s to see the keypress ?

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


Re: svn commit: r247792 - head/sys/dev/syscons

2013-03-04 Thread Alexander Motin
On 04.03.2013 16:42, Luigi Rizzo wrote:
 On Mon, Mar 04, 2013 at 02:00:59PM +, Davide Italiano wrote:
 Author: davide
 Date: Mon Mar  4 14:00:58 2013
 New Revision: 247792
 URL: http://svnweb.freebsd.org/changeset/base/247792

 Log:
   MFcalloutng (r244249, r244306 by mav):
   - Switch syscons from timeout() to callout_reset_flags() and specify that
   precision is not important there -- anything from 20 to 30Hz will be fine.
   - Reduce syscons refresh rate to 1-2Hz when console is in graphics mode
   and there is nothing to do except some polling for keyboard.  Text mode
 
 just to understand, how does this 1-2Hz affect the respose to keypresses ?
 does it mean it takes 0.5..1s to see the keypress ?

No, it is a polling for keyboard presence, and its rate already limited
to 1Hz by comparing kbd_time_stamp to time_uptime there.

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


svn commit: r247793 - head/sys/kern

2013-03-04 Thread Davide Italiano
Author: davide
Date: Mon Mar  4 15:03:52 2013
New Revision: 247793
URL: http://svnweb.freebsd.org/changeset/base/247793

Log:
  Fix build with DIAGNOSTIC/CALLOUT_PROFILING options turned on.
  
  Reported by:  kib, David Wolfskill david at catwhisker dot org
  Pointy-hat to:davide

Modified:
  head/sys/kern/kern_timeout.c

Modified: head/sys/kern/kern_timeout.c
==
--- head/sys/kern/kern_timeout.cMon Mar  4 14:00:58 2013
(r247792)
+++ head/sys/kern/kern_timeout.cMon Mar  4 15:03:52 2013
(r247793)
@@ -601,7 +601,7 @@ softclock_call_cc(struct callout *c, str
sbintime_t new_time;
 #endif
 #if defined(DIAGNOSTIC) || defined(CALLOUT_PROFILING) 
-   sbintime_t bt1, bt2;
+   sbintime_t sbt1, sbt2;
struct timespec ts2;
static sbintime_t maxdt = 2 * SBT_1MS;  /* 2 msec */
static timeout_t *lastfunc;
@@ -655,7 +655,7 @@ softclock_call_cc(struct callout *c, str
CTR3(KTR_CALLOUT, callout %p func %p arg %p,
c, c_func, c_arg);
}
-#ifdef DIAGNOSTIC
+#if defined(DIAGNOSTIC) || defined(CALLOUT_PROFILING)
sbt1 = sbinuptime();
 #endif
THREAD_NO_SLEEPING();
@@ -663,17 +663,17 @@ softclock_call_cc(struct callout *c, str
c_func(c_arg);
SDT_PROBE(callout_execute, kernel, , callout_end, c, 0, 0, 0, 0);
THREAD_SLEEPING_OK();
-#ifdef DIAGNOSTIC
-   bt2 = sbinuptime();
-   bt2 -= bt1;
-   if (bt2  maxdt) {
-   if (lastfunc != c_func || bt2  maxdt * 2) {
-   ts2 = sbttots(bt2);
+#if defined(DIAGNOSTIC) || defined(CALLOUT_PROFILING)
+   sbt2 = sbinuptime();
+   sbt2 -= sbt1;
+   if (sbt2  maxdt) {
+   if (lastfunc != c_func || sbt2  maxdt * 2) {
+   ts2 = sbttots(sbt2);
printf(
Expensive timeout(9) function: %p(%p) %jd.%09ld s\n,
c_func, c_arg, (intmax_t)ts2.tv_sec, ts2.tv_nsec);
}
-   maxdt = bt2;
+   maxdt = sbt2;
lastfunc = c_func;
}
 #endif
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r247797 - head/sys/kern

2013-03-04 Thread Davide Italiano
Author: davide
Date: Mon Mar  4 15:57:41 2013
New Revision: 247797
URL: http://svnweb.freebsd.org/changeset/base/247797

Log:
  MFcalloutng:
  kern_nanosleep() is now converted to use tsleep_sbt(). With this change
  nanosleep() and usleep() can handle sub-tick precision for timeouts.
  Also, try to help coalesce of events passing as argument to tsleep_bt()
  a precision value calculated as a percentage of the sleep time.
  This percentage is default 5%, but it can tuned according to users
  need via the sysctl interface.
  
  Sponsored by: Google Summer of Code 2012, iXsystems inc.
  Tested by:flo, marius, ian, markj, Fabian Keil

Modified:
  head/sys/kern/kern_time.c

Modified: head/sys/kern/kern_time.c
==
--- head/sys/kern/kern_time.c   Mon Mar  4 15:34:59 2013(r247796)
+++ head/sys/kern/kern_time.c   Mon Mar  4 15:57:41 2013(r247797)
@@ -43,6 +43,7 @@ __FBSDID($FreeBSD$);
 #include sys/resourcevar.h
 #include sys/signalvar.h
 #include sys/kernel.h
+#include sys/sleepqueue.h
 #include sys/syscallsubr.h
 #include sys/sysctl.h
 #include sys/sysent.h
@@ -481,38 +482,37 @@ static int nanowait;
 int
 kern_nanosleep(struct thread *td, struct timespec *rqt, struct timespec *rmt)
 {
-   struct timespec ts, ts2, ts3;
-   struct timeval tv;
+   struct timespec ts;
+   sbintime_t sbt, sbtt, prec, tmp;
int error;
 
if (rqt-tv_nsec  0 || rqt-tv_nsec = 10)
return (EINVAL);
if (rqt-tv_sec  0 || (rqt-tv_sec == 0  rqt-tv_nsec == 0))
return (0);
-   getnanouptime(ts);
-   timespecadd(ts, rqt);
-   TIMESPEC_TO_TIMEVAL(tv, rqt);
-   for (;;) {
-   error = tsleep(nanowait, PWAIT | PCATCH, nanslp,
-   tvtohz(tv));
-   getnanouptime(ts2);
-   if (error != EWOULDBLOCK) {
-   if (error == ERESTART)
-   error = EINTR;
-   if (rmt != NULL) {
-   timespecsub(ts, ts2);
-   if (ts.tv_sec  0)
-   timespecclear(ts);
-   *rmt = ts;
-   }
-   return (error);
+   tmp = tstosbt(*rqt);
+   prec = tmp;
+   prec = tc_precexp;
+   if (TIMESEL(sbt, tmp))
+   sbt += tc_tick_sbt;
+   sbt += tmp;
+   error = tsleep_sbt(nanowait, PWAIT | PCATCH, nanslp, sbt, prec,
+   C_ABSOLUTE);
+   if (error != EWOULDBLOCK) {
+   if (error == ERESTART)
+   error = EINTR;
+   TIMESEL(sbtt, tmp);
+   if (rmt != NULL) {
+   ts = sbttots(sbt - sbtt);
+   if (ts.tv_sec  0)
+   timespecclear(ts);
+   *rmt = ts;
}
-   if (timespeccmp(ts2, ts, =))
+   if (sbtt = sbt)
return (0);
-   ts3 = ts;
-   timespecsub(ts3, ts2);
-   TIMESPEC_TO_TIMEVAL(tv, ts3);
+   return (error);
}
+   return (0);
 }
 
 #ifndef _SYS_SYSPROTO_H_
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r247798 - head/sys/kern

2013-03-04 Thread Davide Italiano
Author: davide
Date: Mon Mar  4 16:07:55 2013
New Revision: 247798
URL: http://svnweb.freebsd.org/changeset/base/247798

Log:
  MFcalloutng (r244255 by mav, with minor changes):
  Specify that syslog doesn't need exactly 5 wakeups per second.
  
  Sponsored by: Google Summer of Code 2012, iXsystems inc.
  Tested by:flo, marius, ian, markj, Fabian Keil

Modified:
  head/sys/kern/subr_log.c

Modified: head/sys/kern/subr_log.c
==
--- head/sys/kern/subr_log.cMon Mar  4 15:57:41 2013(r247797)
+++ head/sys/kern/subr_log.cMon Mar  4 16:07:55 2013(r247798)
@@ -117,8 +117,8 @@ logopen(struct cdev *dev, int flags, int
return (EBUSY);
}
log_open = 1;
-   callout_reset(logsoftc.sc_callout, hz / log_wakeups_per_second,
-   logtimeout, NULL);
+   callout_reset_sbt(logsoftc.sc_callout,
+   SBT_1S / log_wakeups_per_second, 0, logtimeout, NULL, C_PREL(1));
mtx_unlock(msgbuf_lock);
 
fsetown(td-td_proc-p_pid, logsoftc.sc_sigio);/* signal 
process only */
@@ -233,22 +233,21 @@ logtimeout(void *arg)
 
if (!log_open)
return;
-   if (log_wakeups_per_second  1) {
-   printf(syslog wakeup is less than one.  Adjusting to 1.\n);
-   log_wakeups_per_second = 1;
-   }
-   if (msgbuftrigger == 0) {
-   callout_schedule(logsoftc.sc_callout,
-   hz / log_wakeups_per_second);
-   return;
-   }
+   if (msgbuftrigger == 0)
+   goto done;
msgbuftrigger = 0;
selwakeuppri(logsoftc.sc_selp, LOG_RDPRI);
KNOTE_LOCKED(logsoftc.sc_selp.si_note, 0);
if ((logsoftc.sc_state  LOG_ASYNC)  logsoftc.sc_sigio != NULL)
pgsigio(logsoftc.sc_sigio, SIGIO, 0);
cv_broadcastpri(log_wakeup, LOG_RDPRI);
-   callout_schedule(logsoftc.sc_callout, hz / log_wakeups_per_second);
+done:
+   if (log_wakeups_per_second  1) {
+   printf(syslog wakeup is less than one.  Adjusting to 1.\n);
+   log_wakeups_per_second = 1;
+   }
+   callout_reset_sbt(logsoftc.sc_callout,
+   SBT_1S / log_wakeups_per_second, 0, logtimeout, NULL, C_PREL(1));
 }
 
 /*ARGSUSED*/
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r247799 - head/sys/dev/random

2013-03-04 Thread Davide Italiano
Author: davide
Date: Mon Mar  4 16:16:23 2013
New Revision: 247799
URL: http://svnweb.freebsd.org/changeset/base/247799

Log:
  MFcalloutng (r236314 by mav):
  Specify that wakeup rate of 7.5-10Hz is enough for yarrow harvesting
  thread.
  
  Sponsored by: Google Summer of Code 2012, iXsystems inc.
  Tested by:flo, marius, ian, markj, Fabian Keil

Modified:
  head/sys/dev/random/randomdev_soft.c

Modified: head/sys/dev/random/randomdev_soft.c
==
--- head/sys/dev/random/randomdev_soft.cMon Mar  4 16:07:55 2013
(r247798)
+++ head/sys/dev/random/randomdev_soft.cMon Mar  4 16:16:23 2013
(r247799)
@@ -242,10 +242,10 @@ random_kthread(void *arg __unused)
local_count = 0;
 
/* Process until told to stop */
+   mtx_lock_spin(harvest_mtx);
for (; random_kthread_control = 0;) {
 
/* Cycle through all the entropy sources */
-   mtx_lock_spin(harvest_mtx);
for (source = RANDOM_START; source  ENTROPYSOURCE; source++) {
/*
 * Drain entropy source records into a thread-local
@@ -270,7 +270,6 @@ random_kthread(void *arg __unused)
emptyfifo.count += local_count;
local_count = 0;
}
-   mtx_unlock_spin(harvest_mtx);
 
KASSERT(local_count == 0, (random_kthread: local_count %d,
local_count));
@@ -283,9 +282,11 @@ random_kthread(void *arg __unused)
random_kthread_control = 0;
 
/* Work done, so don't belabour the issue */
-   pause(-, hz / 10);
+   msleep_spin_sbt(random_kthread_control, harvest_mtx,
+   -, SBT_1S / 10, 0, C_PREL(1));
 
}
+   mtx_unlock_spin(harvest_mtx);
 
random_set_wakeup_exit(random_kthread_control);
/* NOTREACHED */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r247800 - head/sys/kern

2013-03-04 Thread Davide Italiano
Author: davide
Date: Mon Mar  4 16:25:12 2013
New Revision: 247800
URL: http://svnweb.freebsd.org/changeset/base/247800

Log:
  MFcalloutng (r244251 with minor changes):
  Specify that precision of 0.5s is enough for resource limitation.
  
  Sponsored by: Google Summer of Code 2012, iXsystems inc.
  Tested by:flo, marius, ian, markj, Fabian Keil

Modified:
  head/sys/kern/kern_resource.c

Modified: head/sys/kern/kern_resource.c
==
--- head/sys/kern/kern_resource.c   Mon Mar  4 16:16:23 2013
(r247799)
+++ head/sys/kern/kern_resource.c   Mon Mar  4 16:25:12 2013
(r247800)
@@ -645,7 +645,8 @@ lim_cb(void *arg)
}
}
if ((p-p_flag  P_WEXIT) == 0)
-   callout_reset(p-p_limco, hz, lim_cb, p);
+   callout_reset_sbt(p-p_limco, SBT_1S, 0,
+   lim_cb, p, C_PREL(1));
 }
 
 int
@@ -697,7 +698,8 @@ kern_proc_setrlimit(struct thread *td, s
case RLIMIT_CPU:
if (limp-rlim_cur != RLIM_INFINITY 
p-p_cpulimit == RLIM_INFINITY)
-   callout_reset(p-p_limco, hz, lim_cb, p);
+   callout_reset_sbt(p-p_limco, SBT_1S, 0,
+   lim_cb, p, C_PREL(1));
p-p_cpulimit = limp-rlim_cur;
break;
case RLIMIT_DATA:
@@ -1137,7 +1139,8 @@ lim_fork(struct proc *p1, struct proc *p
p2-p_limit = lim_hold(p1-p_limit);
callout_init_mtx(p2-p_limco, p2-p_mtx, 0);
if (p1-p_cpulimit != RLIM_INFINITY)
-   callout_reset(p2-p_limco, hz, lim_cb, p2);
+   callout_reset_sbt(p2-p_limco, SBT_1S, 0,
+   lim_cb, p2, C_PREL(1));
 }
 
 void
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r247801 - head/sys/kern

2013-03-04 Thread Davide Italiano
Author: davide
Date: Mon Mar  4 16:41:27 2013
New Revision: 247801
URL: http://svnweb.freebsd.org/changeset/base/247801

Log:
  MFcalloutng:
  Fix kern_select() and sys_poll() so that they can handle sub-tick
  precision for timeouts (in the same fashion it was done for nanosleep()
  in r247797).
  
  Sponsored by: Google Summer of Code 2012, iXsystems inc.
  Tested by:flo, marius, ian, markj, Fabian Keil

Modified:
  head/sys/kern/sys_generic.c

Modified: head/sys/kern/sys_generic.c
==
--- head/sys/kern/sys_generic.c Mon Mar  4 16:25:12 2013(r247800)
+++ head/sys/kern/sys_generic.c Mon Mar  4 16:41:27 2013(r247801)
@@ -103,7 +103,7 @@ static int  dofilewrite(struct thread *, 
off_t, int);
 static voiddoselwakeup(struct selinfo *, int);
 static voidseltdinit(struct thread *);
-static int seltdwait(struct thread *, int);
+static int seltdwait(struct thread *, sbintime_t, sbintime_t);
 static voidseltdclear(struct thread *);
 
 /*
@@ -950,9 +950,10 @@ kern_select(struct thread *td, int nd, f
 */
fd_mask s_selbits[howmany(2048, NFDBITS)];
fd_mask *ibits[3], *obits[3], *selbits, *sbp;
-   struct timeval atv, rtv, ttv;
-   int error, lf, ndu, timo;
+   struct timeval rtv;
+   sbintime_t asbt, precision, rsbt;
u_int nbufbytes, ncpbytes, ncpubytes, nfdbits;
+   int error, lf, ndu;
 
if (nd  0)
return (EINVAL);
@@ -1042,35 +1043,29 @@ kern_select(struct thread *td, int nd, f
if (nbufbytes != 0)
bzero(selbits, nbufbytes / 2);
 
+   precision = 0;
if (tvp != NULL) {
-   atv = *tvp;
-   if (itimerfix(atv)) {
+   rtv = *tvp;
+   if (rtv.tv_sec  0 || rtv.tv_usec  0 ||
+   rtv.tv_usec = 100) {
error = EINVAL;
goto done;
}
-   getmicrouptime(rtv);
-   timevaladd(atv, rtv);
-   } else {
-   atv.tv_sec = 0;
-   atv.tv_usec = 0;
-   }
-   timo = 0;
+   rsbt = tvtosbt(rtv);
+   precision = rsbt;
+   precision = tc_precexp;
+   if (TIMESEL(asbt, rsbt))
+   asbt += tc_tick_sbt;
+   asbt += rsbt;
+   } else
+   asbt = -1;
seltdinit(td);
/* Iterate until the timeout expires or descriptors become ready. */
for (;;) {
error = selscan(td, ibits, obits, nd);
if (error || td-td_retval[0] != 0)
break;
-   if (atv.tv_sec || atv.tv_usec) {
-   getmicrouptime(rtv);
-   if (timevalcmp(rtv, atv, =))
-   break;
-   ttv = atv;
-   timevalsub(ttv, rtv);
-   timo = ttv.tv_sec  24 * 60 * 60 ?
-   24 * 60 * 60 * hz : tvtohz(ttv);
-   }
-   error = seltdwait(td, timo);
+   error = seltdwait(td, asbt, precision);
if (error)
break;
error = selrescan(td, ibits, obits);
@@ -1278,9 +1273,9 @@ sys_poll(td, uap)
 {
struct pollfd *bits;
struct pollfd smallbits[32];
-   struct timeval atv, rtv, ttv;
-   int error, timo;
+   sbintime_t asbt, precision, rsbt;
u_int nfds;
+   int error;
size_t ni;
 
nfds = uap-nfds;
@@ -1294,36 +1289,27 @@ sys_poll(td, uap)
error = copyin(uap-fds, bits, ni);
if (error)
goto done;
+   precision = 0;
if (uap-timeout != INFTIM) {
-   atv.tv_sec = uap-timeout / 1000;
-   atv.tv_usec = (uap-timeout % 1000) * 1000;
-   if (itimerfix(atv)) {
+   if (uap-timeout  0) {
error = EINVAL;
goto done;
}
-   getmicrouptime(rtv);
-   timevaladd(atv, rtv);
-   } else {
-   atv.tv_sec = 0;
-   atv.tv_usec = 0;
-   }
-   timo = 0;
+   rsbt = SBT_1MS * uap-timeout;
+   precision = rsbt;
+   precision = tc_precexp;
+   if (TIMESEL(asbt, rsbt))
+   asbt += tc_tick_sbt;
+   asbt += rsbt;
+   } else
+   asbt = -1;
seltdinit(td);
/* Iterate until the timeout expires or descriptors become ready. */
for (;;) {
error = pollscan(td, bits, nfds);
if (error || td-td_retval[0] != 0)
break;
-   if (atv.tv_sec || atv.tv_usec) {
-   getmicrouptime(rtv);
-   if (timevalcmp(rtv, atv, =))
-

svn commit: r247804 - head/sys/kern

2013-03-04 Thread Davide Italiano
Author: davide
Date: Mon Mar  4 16:55:16 2013
New Revision: 247804
URL: http://svnweb.freebsd.org/changeset/base/247804

Log:
  MFcalloutng:
  - Rewrite kevent() timeout implementation to allow sub-tick precision.
  - Make the interval timings for EVFILT_TIMER more accurate. This also
  removes an hack introduced in r238424.
  
  Sponsored by: Google Summer of Code 2012, iXsystems inc.
  Tested by:flo, marius, ian, markj, Fabian Keil

Modified:
  head/sys/kern/kern_event.c

Modified: head/sys/kern/kern_event.c
==
--- head/sys/kern/kern_event.c  Mon Mar  4 16:50:01 2013(r247803)
+++ head/sys/kern/kern_event.c  Mon Mar  4 16:55:16 2013(r247804)
@@ -517,39 +517,28 @@ knote_fork(struct knlist *list, int pid)
  * XXX: EVFILT_TIMER should perhaps live in kern_time.c beside the
  * interval timer support code.
  */
-static int
-timertoticks(intptr_t data)
+static __inline sbintime_t 
+timer2sbintime(intptr_t data)
 {
-   struct timeval tv;
-   int tticks;
-
-   tv.tv_sec = data / 1000;
-   tv.tv_usec = (data % 1000) * 1000;
-   tticks = tvtohz(tv);
 
-   return tticks;
+   return (SBT_1MS * data);
 }
 
 static void
 filt_timerexpire(void *knx)
 {
-   struct knote *kn = knx;
struct callout *calloutp;
+   struct knote *kn;
 
+   kn = knx;
kn-kn_data++;
KNOTE_ACTIVATE(kn, 0);  /* XXX - handle locking */
 
-   /*
-* timertoticks() uses tvtohz() which always adds 1 to allow
-* for the time until the next clock interrupt being strictly
-* less than 1 clock tick.  We don't want that here since we
-* want to appear to be in sync with the clock interrupt even
-* when we're delayed.
-*/
if ((kn-kn_flags  EV_ONESHOT) != EV_ONESHOT) {
calloutp = (struct callout *)kn-kn_hook;
-   callout_reset_curcpu(calloutp, timertoticks(kn-kn_sdata) - 1,
-   filt_timerexpire, kn);
+   callout_reset_sbt_on(calloutp,
+   timer2sbintime(kn-kn_sdata), 0 /* 1ms? */,
+   filt_timerexpire, kn, PCPU_GET(cpuid), 0);
}
 }
 
@@ -573,8 +562,9 @@ filt_timerattach(struct knote *kn)
calloutp = malloc(sizeof(*calloutp), M_KQUEUE, M_WAITOK);
callout_init(calloutp, CALLOUT_MPSAFE);
kn-kn_hook = calloutp;
-   callout_reset_curcpu(calloutp, timertoticks(kn-kn_sdata),
-   filt_timerexpire, kn);
+   callout_reset_sbt_on(calloutp,
+   timer2sbintime(kn-kn_sdata), 0 /* 1ms? */,
+   filt_timerexpire, kn, PCPU_GET(cpuid), 0);
 
return (0);
 }
@@ -1319,10 +1309,9 @@ kqueue_scan(struct kqueue *kq, int maxev
 const struct timespec *tsp, struct kevent *keva, struct thread *td)
 {
struct kevent *kevp;
-   struct timeval atv, rtv, ttv;
struct knote *kn, *marker;
-   int count, timeout, nkev, error, influx;
-   int haskqglobal, touch;
+   sbintime_t asbt, rsbt;
+   int count, error, haskqglobal, influx, nkev, touch;
 
count = maxevents;
nkev = 0;
@@ -1332,24 +1321,23 @@ kqueue_scan(struct kqueue *kq, int maxev
if (maxevents == 0)
goto done_nl;
 
+   rsbt = 0;
if (tsp != NULL) {
-   TIMESPEC_TO_TIMEVAL(atv, tsp);
-   if (itimerfix(atv)) {
+   if (tsp-tv_sec  0 || tsp-tv_nsec  0 ||
+   tsp-tv_nsec  10) {
error = EINVAL;
goto done_nl;
}
-   if (tsp-tv_sec == 0  tsp-tv_nsec == 0)
-   timeout = -1;
-   else
-   timeout = atv.tv_sec  24 * 60 * 60 ?
-   24 * 60 * 60 * hz : tvtohz(atv);
-   getmicrouptime(rtv);
-   timevaladd(atv, rtv);
-   } else {
-   atv.tv_sec = 0;
-   atv.tv_usec = 0;
-   timeout = 0;
-   }
+   if (timespecisset(tsp)) {
+   rsbt = tstosbt(*tsp);
+   if (TIMESEL(asbt, rsbt))
+   asbt += tc_tick_sbt;
+   asbt += rsbt;
+   rsbt = tc_precexp;
+   } else
+   asbt = -1;
+   } else
+   asbt = 0;
marker = knote_alloc(1);
if (marker == NULL) {
error = ENOMEM;
@@ -1357,28 +1345,16 @@ kqueue_scan(struct kqueue *kq, int maxev
}
marker-kn_status = KN_MARKER;
KQ_LOCK(kq);
-   goto start;
 
 retry:
-   if (atv.tv_sec || atv.tv_usec) {
-   getmicrouptime(rtv);
-   if (timevalcmp(rtv, atv, =))
-   goto done;
-   ttv = atv;
-   timevalsub(ttv, rtv);
-   timeout = ttv.tv_sec  24 * 60 * 60 ?
-   24 * 60 * 60 * hz 

svn commit: r247810 - in head/contrib/openpam: doc/man lib

2013-03-04 Thread Dag-Erling Smørgrav
Author: des
Date: Mon Mar  4 18:51:53 2013
New Revision: 247810
URL: http://svnweb.freebsd.org/changeset/base/247810

Log:
  Merge upstream r634:646: correctly parse mixed quoted / unquoted text.

Modified:
  head/contrib/openpam/doc/man/openpam_straddch.3
  head/contrib/openpam/lib/openpam_readline.c
  head/contrib/openpam/lib/openpam_readword.c
Directory Properties:
  head/contrib/openpam/   (props changed)

Modified: head/contrib/openpam/doc/man/openpam_straddch.3
==
--- head/contrib/openpam/doc/man/openpam_straddch.3 Mon Mar  4 18:46:55 
2013(r247809)
+++ head/contrib/openpam/doc/man/openpam_straddch.3 Mon Mar  4 18:51:53 
2013(r247810)
@@ -34,7 +34,7 @@
 .\
 .\ $Id$
 .\
-.Dd May 26, 2012
+.Dd March 3, 2013
 .Dt OPENPAM_STRADDCH 3
 .Os
 .Sh NAME
@@ -73,6 +73,21 @@ and
 argument point to variables used to hold the size
 of the buffer and the length of the string it contains, respectively.
 .Pp
+The final argument,
+.Fa ch ,
+is the character that should be appended to
+the string.  If
+.Fa ch
+is 0, nothing is appended, but a new buffer is
+still allocated if
+.Fa str
+is NULL.  This can be used to
+.Do
+bootstrap
+.Dc
+the
+string.
+.Pp
 If a new buffer is allocated or an existing buffer is reallocated to
 make room for the additional character,
 .Fa str
@@ -91,7 +106,9 @@ If the
 function is successful, it increments the
 integer variable pointed to by
 .Fa len
-and returns 0.
+(unless
+.Fa ch
+was 0) and returns 0.
 Otherwise, it leaves the variables pointed to by
 .Fa str ,
 .Fa size

Modified: head/contrib/openpam/lib/openpam_readline.c
==
--- head/contrib/openpam/lib/openpam_readline.c Mon Mar  4 18:46:55 2013
(r247809)
+++ head/contrib/openpam/lib/openpam_readline.c Mon Mar  4 18:51:53 2013
(r247810)
@@ -62,11 +62,9 @@ openpam_readline(FILE *f, int *lineno, s
size_t len, size;
int ch;
 
-   if ((line = malloc(size = MIN_LINE_LENGTH)) == NULL) {
-   openpam_log(PAM_LOG_ERROR, malloc(): %m);
+   line = NULL;
+   if (openpam_straddch(line, size, len, 0) != 0)
return (NULL);
-   }
-   len = 0;
for (;;) {
ch = fgetc(f);
/* strip comment */

Modified: head/contrib/openpam/lib/openpam_readword.c
==
--- head/contrib/openpam/lib/openpam_readword.c Mon Mar  4 18:46:55 2013
(r247809)
+++ head/contrib/openpam/lib/openpam_readword.c Mon Mar  4 18:51:53 2013
(r247810)
@@ -86,13 +86,8 @@ openpam_readword(FILE *f, int *lineno, s
/* begin quote */
quote = ch;
/* edge case: empty quoted string */
-   if (word == NULL  (word = malloc(1)) == NULL) {
-   openpam_log(PAM_LOG_ERROR, malloc(): %m);
-   errno = ENOMEM;
+   if (openpam_straddch(word, size, len, 0) != 0)
return (NULL);
-   }
-   *word = '\0';
-   size = 1;
} else if (ch == quote  !escape) {
/* end quote */
quote = 0;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r247811 - head/sbin/ipfw

2013-03-04 Thread Alexander V. Chernikov
Author: melifaro
Date: Mon Mar  4 19:01:38 2013
New Revision: 247811
URL: http://svnweb.freebsd.org/changeset/base/247811

Log:
  Do not suddenly fail on some rulesets if -n (syntax check only) is specified
  and ipfw(4) module is not loaded.
  
  MFC after:2 weeks

Modified:
  head/sbin/ipfw/ipfw2.c

Modified: head/sbin/ipfw/ipfw2.c
==
--- head/sbin/ipfw/ipfw2.c  Mon Mar  4 18:51:53 2013(r247810)
+++ head/sbin/ipfw/ipfw2.c  Mon Mar  4 19:01:38 2013(r247811)
@@ -3083,9 +3083,14 @@ chkarg:
} else {
len = sizeof(c-max_log);
if (sysctlbyname(net.inet.ip.fw.verbose_limit,
-   c-max_log, len, NULL, 0) == -1)
+   c-max_log, len, NULL, 0) == -1) {
+   if (co.test_only) {
+   c-max_log = 0;
+   break;
+   }
errx(1, sysctlbyname(\%s\),
net.inet.ip.fw.verbose_limit);
+   }
}
}
break;
@@ -3986,9 +3991,13 @@ ipfw_table_handler(int ac, char *av[])
mask = 0;   // XXX uninitialized ?
len = sizeof(tables_max);
if (sysctlbyname(net.inet.ip.fw.tables_max, tables_max, len,
-   NULL, 0) == -1)
-   errx(1, Can't determine maximum number of ipfw tables. 
-   Perhaps you forgot to load ipfw module?);
+   NULL, 0) == -1) {
+   if (co.test_only)
+   tables_max = 128; /* Old conservative default */
+   else
+   errx(1, Can't determine maximum number of ipfw tables.
+Perhaps you forgot to load ipfw module?);
+   }
 
memset(xent, 0, sizeof(xent));
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r247812 - in head/share/man: man4 man9

2013-03-04 Thread Davide Italiano
Author: davide
Date: Mon Mar  4 19:10:39 2013
New Revision: 247812
URL: http://svnweb.freebsd.org/changeset/base/247812

Log:
  MFcalloutng:
  Dcoument the new functions added to condvar(9), sleep(9), sleepqueue(9)
  KPIs. Also document recent changes in timeout(9) and eventtimers(4).

Modified:
  head/share/man/man4/eventtimers.4
  head/share/man/man9/Makefile
  head/share/man/man9/condvar.9
  head/share/man/man9/sleep.9
  head/share/man/man9/sleepqueue.9
  head/share/man/man9/timeout.9

Modified: head/share/man/man4/eventtimers.4
==
--- head/share/man/man4/eventtimers.4   Mon Mar  4 19:01:38 2013
(r247811)
+++ head/share/man/man4/eventtimers.4   Mon Mar  4 19:10:39 2013
(r247812)
@@ -143,14 +143,6 @@ By default this options is disabled.
 If chosen timer is per-CPU
 and runs in periodic mode, this option has no effect - all interrupts are
 always generating.
-.It Va kern.eventtimer.activetick
-makes each CPU to receive all kinds of timer interrupts when they are busy.
-Disabling it allows to skip some
-.Fn hardclock
-calls in some cases.
-By default this options is enabled.
-If chosen timer is per-CPU, this option has no effect - all interrupts are
-always generating, as timer reprogramming is too expensive for that case.
 .El
 .Sh SEE ALSO
 .Xr apic 4 ,

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileMon Mar  4 19:01:38 2013
(r247811)
+++ head/share/man/man9/MakefileMon Mar  4 19:10:39 2013
(r247812)
@@ -1196,9 +1196,13 @@ MLINKS+=signal.9 cursig.9 \
signal.9 SIG_STOPSIGMASK.9 \
signal.9 trapsignal.9
 MLINKS+=sleep.9 msleep.9 \
+   sleep.9 msleep_sbt.9 \
sleep.9 msleep_spin.9 \
+   sleep.9 msleep_spin_sbt.9 \
sleep.9 pause.9 \
+   sleep.9 pause_sbt.9 \
sleep.9 tsleep.9 \
+   sleep.9 tsleep_sbt.9 \
sleep.9 wakeup.9 \
sleep.9 wakeup_one.9
 MLINKS+=sleepqueue.9 init_sleepqueues.9 \
@@ -1213,6 +1217,7 @@ MLINKS+=sleepqueue.9 init_sleepqueues.9 
sleepqueue.9 sleepq_release.9 \
sleepqueue.9 sleepq_remove.9 \
sleepqueue.9 sleepq_set_timeout.9 \
+   sleepqueue.9 sleepq_set_timeout_sbt.9 \
sleepqueue.9 sleepq_signal.9 \
sleepqueue.9 sleepq_timedwait.9 \
sleepqueue.9 sleepq_timedwait_sig.9 \
@@ -1335,6 +1340,9 @@ MLINKS+=timeout.9 callout.9 \
timeout.9 callout_init_rw.9 \
timeout.9 callout_pending.9 \
timeout.9 callout_reset.9 \
+   timeout.9 callout_reset_sbt.9 \
+   timeout.9 callout_reset_on.9 \
+   timeout.9 callout_reset_sbt_on.9 \
timeout.9 callout_schedule.9 \
timeout.9 callout_stop.9 \
timeout.9 untimeout.9

Modified: head/share/man/man9/condvar.9
==
--- head/share/man/man9/condvar.9   Mon Mar  4 19:01:38 2013
(r247811)
+++ head/share/man/man9/condvar.9   Mon Mar  4 19:10:39 2013
(r247812)
@@ -26,7 +26,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd June 5, 2007
+.Dd February 19, 2013
 .Dt CONDVAR 9
 .Os
 .Sh NAME
@@ -37,7 +37,9 @@
 .Nm cv_wait_sig ,
 .Nm cv_wait_unlock ,
 .Nm cv_timedwait ,
+.Nm cv_timedwait_sbt ,
 .Nm cv_timedwait_sig ,
+.Nm cv_timedwait_sig_sbt ,
 .Nm cv_signal ,
 .Nm cv_broadcast ,
 .Nm cv_broadcastpri ,
@@ -60,7 +62,13 @@
 .Ft int
 .Fn cv_timedwait struct cv *cvp lock int timo
 .Ft int
+.Fn cv_timedwait_sbt struct cv *cvp lock sbintime_t sbt \
+sbintime_t pr int flags
+.Ft int
 .Fn cv_timedwait_sig struct cv *cvp lock int timo
+.Ft int
+.Fn cv_timedwait_sig_sbt struct cv *cvp lock sbintime_t sbt \
+sbintime_t pr int flags
 .Ft void
 .Fn cv_signal struct cv *cvp
 .Ft void
@@ -191,6 +199,25 @@ if a signal is caught, or 0 if signaled 
 .Fn cv_signal
 or
 .Fn cv_broadcast .
+.Pp
+.Fn cv_timedwait_sbt
+and
+.Fn cv_timedwait_sig_sbt
+functions take
+.Fa sbt
+argument instead of
+.Fa timo .
+It allows to specify relative or absolute unblock time with higher resolution
+in form of
+.Vt sbintime_t .
+The parameter
+.Fa pr
+allows to specify wanted absolute event precision.
+The parameter
+.Fa flags
+allows to pass additional
+.Fn callout_reset_sbt
+flags.
 .Sh RETURN VALUES
 If successful,
 .Fn cv_wait_sig ,
@@ -230,4 +257,5 @@ Timeout expired.
 .Xr rwlock 9 ,
 .Xr sema 9 ,
 .Xr sleep 9 ,
-.Xr sx 9
+.Xr sx 9 ,
+.Xr timeout 9

Modified: head/share/man/man9/sleep.9
==
--- head/share/man/man9/sleep.9 Mon Mar  4 19:01:38 2013(r247811)
+++ head/share/man/man9/sleep.9 Mon Mar  4 19:10:39 2013(r247812)
@@ -25,14 +25,18 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd December 12, 2009
+.Dd February 19, 2013
 .Dt SLEEP 9
 .Os
 .Sh NAME
 .Nm msleep ,
+.Nm msleep_sbt ,
 .Nm msleep_spin ,
+.Nm msleep_spin_sbt ,
 .Nm pause ,
+.Nm pause_sbt ,
 .Nm 

svn commit: r247813 - head/sys/kern

2013-03-04 Thread Davide Italiano
Author: davide
Date: Mon Mar  4 21:09:22 2013
New Revision: 247813
URL: http://svnweb.freebsd.org/changeset/base/247813

Log:
  Use C99 'bool' rather than Machish 'boolean_t'.
  
  Requested by: jhb

Modified:
  head/sys/kern/kern_timeout.c

Modified: head/sys/kern/kern_timeout.c
==
--- head/sys/kern/kern_timeout.cMon Mar  4 19:10:39 2013
(r247812)
+++ head/sys/kern/kern_timeout.cMon Mar  4 21:09:22 2013
(r247813)
@@ -126,8 +126,8 @@ struct cc_exec {
int ce_migration_cpu;
sbintime_t  ce_migration_time;
 #endif
-   boolean_t   cc_cancel;
-   boolean_t   cc_waiting;
+   boolcc_cancel;
+   boolcc_waiting;
 };
 
 /*
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r247814 - in head: . sys/amd64/conf sys/cam/ctl sys/conf sys/i386/conf

2013-03-04 Thread Kenneth D. Merry
Author: ken
Date: Mon Mar  4 21:18:45 2013
New Revision: 247814
URL: http://svnweb.freebsd.org/changeset/base/247814

Log:
  Re-enable CTL in GENERIC on i386 and amd64, but turn on the CTL disable
  tunable by default.
  
  This will allow GENERIC configurations to boot on small memory boxes, but
  not require end users who want to use CTL to recompile their kernel.  They
  can simply set kern.cam.ctl.disable=0 in loader.conf.
  
  The eventual solution to the memory usage problem is to change the way
  CTL allocates memory to be more configurable, but this should fix things
  for small memory situations in the mean time.
  
  UPDATING: Explain the change in the CTL configuration, and
how users can enable CTL if they would like to use
it.
  
  sys/conf/options: Add a new option, CTL_DISABLE, that prevents CTL
from initializing.
  
  ctl.c:If CTL_DISABLE is turned on, don't initialize.
  
  i386/conf/GENERIC,
  amd64/conf/GENERIC:   Re-enable device ctl, and add the CTL_DISABLE
option.

Modified:
  head/UPDATING
  head/sys/amd64/conf/GENERIC
  head/sys/cam/ctl/ctl.c
  head/sys/conf/options
  head/sys/i386/conf/GENERIC

Modified: head/UPDATING
==
--- head/UPDATING   Mon Mar  4 21:09:22 2013(r247813)
+++ head/UPDATING   Mon Mar  4 21:18:45 2013(r247814)
@@ -26,6 +26,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10
disable the most expensive debugging functionality run
ln -s 'abort:false,junk:false' /etc/malloc.conf.)
 
+20130304:
+   The ctl device has been re-enabled in GENERIC for i386 and amd64,
+   but does not initialize by default (because of the new CTL_DISABLE
+   option) to save memory.  To re-enable it, remove the CTL_DISABLE
+   option from the kernel config file or set kern.cam.ctl.disable=0
+   in /boot/loader.conf.
+
 20130301:
The ctl device has been disabled in GENERIC for i386 and amd64.
This was done due to the extra memory being allocated at system

Modified: head/sys/amd64/conf/GENERIC
==
--- head/sys/amd64/conf/GENERIC Mon Mar  4 21:09:22 2013(r247813)
+++ head/sys/amd64/conf/GENERIC Mon Mar  4 21:18:45 2013(r247814)
@@ -138,7 +138,10 @@ device sa  # Sequential Access 
(tape et
 device cd  # CD
 device pass# Passthrough device (direct ATA/SCSI access)
 device ses # Enclosure Services (SES and SAF-TE)
-#devicectl # CAM Target Layer
+device ctl # CAM Target Layer
+optionsCTL_DISABLE # Disable CTL by default to save memory.
+   # Re-enable with kern.cam.ctl.disable=0 in
+   # /boot/loader.conf
 
 # RAID controllers interfaced to the SCSI subsystem
 device amr # AMI MegaRAID

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Mon Mar  4 21:09:22 2013(r247813)
+++ head/sys/cam/ctl/ctl.c  Mon Mar  4 21:18:45 2013(r247814)
@@ -78,6 +78,8 @@ __FBSDID($FreeBSD$);
 #include cam/ctl/ctl_scsi_all.h
 #include cam/ctl/ctl_error.h
 
+#include opt_ctl.h
+
 struct ctl_softc *control_softc = NULL;
 
 /*
@@ -317,7 +319,11 @@ static int persis_offset;
 static uint8_t ctl_pause_rtr;
 static int ctl_is_single;
 static int index_to_aps_page;
+#ifdef CTL_DISABLE
+int   ctl_disable = 1;
+#else
 int   ctl_disable = 0;
+#endif
 
 SYSCTL_NODE(_kern_cam, OID_AUTO, ctl, CTLFLAG_RD, 0, CAM Target Layer);
 SYSCTL_INT(_kern_cam_ctl, OID_AUTO, disable, CTLFLAG_RDTUN, ctl_disable, 0,

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Mon Mar  4 21:09:22 2013(r247813)
+++ head/sys/conf/options   Mon Mar  4 21:18:45 2013(r247814)
@@ -329,6 +329,9 @@ SCSI_PT_DEFAULT_TIMEOUT opt_pt.h
 # Options used only in cam/scsi/scsi_ses.c
 SES_ENABLE_PASSTHROUGH opt_ses.h
 
+# Options used only in cam/ctl
+CTL_DISABLEopt_ctl.h
+
 # Options used in dev/sym/ (Symbios SCSI driver).
 SYM_SETUP_LP_PROBE_MAP opt_sym.h   #-Low Priority Probe Map (bits)
# Allows the ncr to take precedence

Modified: head/sys/i386/conf/GENERIC
==
--- head/sys/i386/conf/GENERIC  Mon Mar  4 21:09:22 2013(r247813)
+++ head/sys/i386/conf/GENERIC  Mon Mar  4 21:18:45 2013(r247814)
@@ -146,7 +146,10 @@ device sa  # Sequential Access 
(tape et
 device cd

svn commit: r247815 - head/sys/dev/sound/pci/hda

2013-03-04 Thread Alexander Motin
Author: mav
Date: Mon Mar  4 21:20:13 2013
New Revision: 247815
URL: http://svnweb.freebsd.org/changeset/base/247815

Log:
  Add quirk to enable headphones redirection on Lenovo X220.
  
  PR:   kern/174876
  MFC after:1 week

Modified:
  head/sys/dev/sound/pci/hda/hdaa_patches.c
  head/sys/dev/sound/pci/hda/hdac.h

Modified: head/sys/dev/sound/pci/hda/hdaa_patches.c
==
--- head/sys/dev/sound/pci/hda/hdaa_patches.c   Mon Mar  4 21:18:45 2013
(r247814)
+++ head/sys/dev/sound/pci/hda/hdaa_patches.c   Mon Mar  4 21:20:13 2013
(r247815)
@@ -333,6 +333,13 @@ hdac_pin_patch(struct hdaa_widget *w)
patch = as=1 seq=15;
break;
}
+   } else if (id == HDA_CODEC_CX20590 
+   subid == LENOVO_X220_SUBVENDOR) {
+   switch (nid) {
+   case 25:
+   patch = as=1 seq=15;
+   break;
+   }
}
 
if (patch != NULL)

Modified: head/sys/dev/sound/pci/hda/hdac.h
==
--- head/sys/dev/sound/pci/hda/hdac.h   Mon Mar  4 21:18:45 2013
(r247814)
+++ head/sys/dev/sound/pci/hda/hdac.h   Mon Mar  4 21:20:13 2013
(r247815)
@@ -220,6 +220,7 @@
 #define LENOVO_3KN200_SUBVENDORHDA_MODEL_CONSTRUCT(LENOVO, 0x384e)
 #define LENOVO_B450_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x3a0d)
 #define LENOVO_TCA55_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x1015)
+#define LENOVO_X220_SUBVENDOR  HDA_MODEL_CONSTRUCT(LENOVO, 0x21da)
 #define LENOVO_X300_SUBVENDOR  HDA_MODEL_CONSTRUCT(LENOVO, 0x20ac)
 #define LENOVO_ALL_SUBVENDOR   HDA_MODEL_CONSTRUCT(LENOVO, 0x)
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r247818 - head/sys/kern

2013-03-04 Thread Davide Italiano
Author: davide
Date: Mon Mar  4 21:52:12 2013
New Revision: 247818
URL: http://svnweb.freebsd.org/changeset/base/247818

Log:
  Complete r247813:
  Use true/false instead of TRUE/FALSE.
  
  Reported by:  attilio
  Requested by: jhb

Modified:
  head/sys/kern/kern_timeout.c

Modified: head/sys/kern/kern_timeout.c
==
--- head/sys/kern/kern_timeout.cMon Mar  4 21:36:34 2013
(r247817)
+++ head/sys/kern/kern_timeout.cMon Mar  4 21:52:12 2013
(r247818)
@@ -215,8 +215,8 @@ cc_cce_cleanup(struct callout_cpu *cc, i
 
cc-cc_exec_entity[direct].cc_curr = NULL;
cc-cc_exec_entity[direct].cc_next = NULL;
-   cc-cc_exec_entity[direct].cc_cancel = FALSE;
-   cc-cc_exec_entity[direct].cc_waiting = FALSE;
+   cc-cc_exec_entity[direct].cc_cancel = false;
+   cc-cc_exec_entity[direct].cc_waiting = false;
 #ifdef SMP
cc-cc_exec_entity[direct].ce_migration_cpu = CPUBLOCK;
cc-cc_exec_entity[direct].ce_migration_time = 0;
@@ -621,7 +621,7 @@ softclock_call_cc(struct callout *c, str
else
c-c_flags = ~CALLOUT_PENDING;
cc-cc_exec_entity[direct].cc_curr = c;
-   cc-cc_exec_entity[direct].cc_cancel = FALSE;
+   cc-cc_exec_entity[direct].cc_cancel = false;
CC_UNLOCK(cc);
if (c_lock != NULL) {
class-lc_lock(c_lock, sharedlock);
@@ -634,7 +634,7 @@ softclock_call_cc(struct callout *c, str
goto skip;
}
/* The callout cannot be stopped now. */
-   cc-cc_exec_entity[direct].cc_cancel = TRUE;
+   cc-cc_exec_entity[direct].cc_cancel = true;
if (c_lock == Giant.lock_object) {
 #ifdef CALLOUT_PROFILING
(*gcalls)++;
@@ -700,7 +700,7 @@ skip:
 */
c-c_flags = ~CALLOUT_DFRMIGRATION;
}
-   cc-cc_exec_entity[direct].cc_waiting = FALSE;
+   cc-cc_exec_entity[direct].cc_waiting = false;
CC_UNLOCK(cc);
wakeup(cc-cc_exec_entity[direct].cc_waiting);
CC_LOCK(cc);
@@ -954,7 +954,7 @@ callout_reset_sbt_on(struct callout *c, 
 * can cancel the callout if it has not really started.
 */
if (c-c_lock != NULL  !cc-cc_exec_entity[direct].cc_cancel)
-   cancelled = cc-cc_exec_entity[direct].cc_cancel = TRUE;
+   cancelled = cc-cc_exec_entity[direct].cc_cancel = true;
if (cc-cc_exec_entity[direct].cc_waiting) {
/*
 * Someone has called callout_drain to kill this
@@ -1135,7 +1135,7 @@ again:
 * will be packed up, just let softclock()
 * take care of it.
 */
-   cc-cc_exec_entity[direct].cc_waiting = TRUE;
+   cc-cc_exec_entity[direct].cc_waiting = true;
DROP_GIANT();
CC_UNLOCK(cc);
sleepq_add(
@@ -1161,7 +1161,7 @@ again:
 * lock, the callout will be skipped in
 * softclock().
 */
-   cc-cc_exec_entity[direct].cc_cancel = TRUE;
+   cc-cc_exec_entity[direct].cc_cancel = true;
CTR3(KTR_CALLOUT, cancelled %p func %p arg %p,
c, c-c_func, c-c_arg);
KASSERT(!cc_cce_migrating(cc, direct),
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r247820 - head/sys/cddl/contrib/opensolaris/uts/intel/dtrace

2013-03-04 Thread Justin T. Gibbs
Author: gibbs
Date: Mon Mar  4 22:07:36 2013
New Revision: 247820
URL: http://svnweb.freebsd.org/changeset/base/247820

Log:
  Fix assertion failure when using userland DTrace probes from
  the pid provider on a kernel compiled with INVARIANTS.
  
  sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c:
In fasttrap_probe_pid(), attempts to write to the
address space of the thread that fired the probe
must be performed with the process of the thread
held.  Use _PHOLD() to ensure this is the case.
  
In fasttrap_probe_pid(), use proc_write_regs() instead
of calling set_regs() directly.  proc_write_regs()
performs invariant checks to verify the calling
environment of set_regs().  PROC_LOCK()/UNLOCK() around
the call to proc_write_regs() so that it's invariants
are satisfied.
  
  Sponsored by: Spectra Logic Corporation
  Reviewed by:  gnn, rpaulo
  MFC after:1 week

Modified:
  head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c

Modified: head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c
==
--- head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c   Mon Mar 
 4 22:04:14 2013(r247819)
+++ head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c   Mon Mar 
 4 22:07:36 2013(r247820)
@@ -1034,6 +1034,7 @@ fasttrap_pid_probe(struct reg *rp)
 #endif
 
PROC_LOCK(p);
+   _PHOLD(p);
pid = p-p_pid;
 #if defined(sun)
pid_mtx = cpu_core[CPU-cpu_id].cpuc_pid_lock;
@@ -1059,6 +1060,7 @@ fasttrap_pid_probe(struct reg *rp)
 #if defined(sun)
mutex_exit(pid_mtx);
 #endif
+   _PRELE(p);
PROC_UNLOCK(p);
return (-1);
}
@@ -1732,7 +1734,6 @@ fasttrap_pid_probe(struct reg *rp)
 
ASSERT(i = sizeof (scratch));
 
-
 #if defined(sun)
if (fasttrap_copyout(scratch, (char *)addr, i)) {
 #else
@@ -1794,7 +1795,11 @@ done:
}
 
rp-r_rip = new_pc;
-   set_regs(curthread, rp);
+
+   PROC_LOCK(p);
+   proc_write_regs(curthread, rp);
+   _PRELE(p);
+   PROC_UNLOCK(p);
 
return (0);
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r247814 - in head: . sys/amd64/conf sys/cam/ctl sys/conf sys/i386/conf

2013-03-04 Thread Alfred Perlstein

Ken,

By the time ctl_init is called, it looks like enough of the vm is there 
such that you could probe for physmem.   (I may be wrong and apologize 
if so)


Look at kern_mib.c:


sysctl_hw_physmem(SYSCTL_HANDLER_ARGS)
{
u_long val;

val = ctob(physmem);
return (sysctl_handle_long(oidp, val, 0, req));
}

SYSCTL_PROC(_hw, HW_PHYSMEM, physmem, CTLTYPE_ULONG | CTLFLAG_RD,
0, 0, sysctl_hw_physmem, LU, );



Then the logic could be:

IF (set(tunable_ctl_onoff))
  ctl_onoff = tunable_ctl_onoff;
ELSE
  ctl_onoff = physmem  ctl_threshold;

This would get you much more people testing the code and the best out of 
the box experience for people downloading.


Hope this helps.

-Alfred


On 3/4/13 1:18 PM, Kenneth D. Merry wrote:

Author: ken
Date: Mon Mar  4 21:18:45 2013
New Revision: 247814
URL: http://svnweb.freebsd.org/changeset/base/247814

Log:
   Re-enable CTL in GENERIC on i386 and amd64, but turn on the CTL disable
   tunable by default.
   
   This will allow GENERIC configurations to boot on small memory boxes, but

   not require end users who want to use CTL to recompile their kernel.  They
   can simply set kern.cam.ctl.disable=0 in loader.conf.
   
   The eventual solution to the memory usage problem is to change the way

   CTL allocates memory to be more configurable, but this should fix things
   for small memory situations in the mean time.
   
   UPDATING:		Explain the change in the CTL configuration, and

how users can enable CTL if they would like to use
it.
   
   sys/conf/options:	Add a new option, CTL_DISABLE, that prevents CTL

from initializing.
   
   ctl.c:			If CTL_DISABLE is turned on, don't initialize.
   
   i386/conf/GENERIC,

   amd64/conf/GENERIC:  Re-enable device ctl, and add the CTL_DISABLE
option.

Modified:
   head/UPDATING
   head/sys/amd64/conf/GENERIC
   head/sys/cam/ctl/ctl.c
   head/sys/conf/options
   head/sys/i386/conf/GENERIC

Modified: head/UPDATING
==
--- head/UPDATING   Mon Mar  4 21:09:22 2013(r247813)
+++ head/UPDATING   Mon Mar  4 21:18:45 2013(r247814)
@@ -26,6 +26,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10
disable the most expensive debugging functionality run
ln -s 'abort:false,junk:false' /etc/malloc.conf.)
  
+20130304:

+   The ctl device has been re-enabled in GENERIC for i386 and amd64,
+   but does not initialize by default (because of the new CTL_DISABLE
+   option) to save memory.  To re-enable it, remove the CTL_DISABLE
+   option from the kernel config file or set kern.cam.ctl.disable=0
+   in /boot/loader.conf.
+
  20130301:
The ctl device has been disabled in GENERIC for i386 and amd64.
This was done due to the extra memory being allocated at system

Modified: head/sys/amd64/conf/GENERIC
==
--- head/sys/amd64/conf/GENERIC Mon Mar  4 21:09:22 2013(r247813)
+++ head/sys/amd64/conf/GENERIC Mon Mar  4 21:18:45 2013(r247814)
@@ -138,7 +138,10 @@ device sa  # Sequential Access 
(tape et
  devicecd  # CD
  devicepass# Passthrough device (direct ATA/SCSI 
access)
  deviceses # Enclosure Services (SES and SAF-TE)
-#devicectl # CAM Target Layer
+device ctl # CAM Target Layer
+optionsCTL_DISABLE # Disable CTL by default to save memory.
+   # Re-enable with kern.cam.ctl.disable=0 in
+   # /boot/loader.conf
  
  # RAID controllers interfaced to the SCSI subsystem

  deviceamr # AMI MegaRAID

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Mon Mar  4 21:09:22 2013(r247813)
+++ head/sys/cam/ctl/ctl.c  Mon Mar  4 21:18:45 2013(r247814)
@@ -78,6 +78,8 @@ __FBSDID($FreeBSD$);
  #include cam/ctl/ctl_scsi_all.h
  #include cam/ctl/ctl_error.h
  
+#include opt_ctl.h

+
  struct ctl_softc *control_softc = NULL;
  
  /*

@@ -317,7 +319,11 @@ static int persis_offset;
  static uint8_t ctl_pause_rtr;
  static int ctl_is_single;
  static int index_to_aps_page;
+#ifdef CTL_DISABLE
+int   ctl_disable = 1;
+#else
  int  ctl_disable = 0;
+#endif
  
  SYSCTL_NODE(_kern_cam, OID_AUTO, ctl, CTLFLAG_RD, 0, CAM Target Layer);

  SYSCTL_INT(_kern_cam_ctl, OID_AUTO, disable, CTLFLAG_RDTUN, ctl_disable, 0,

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Mon Mar  4 21:09:22 2013(r247813)
+++ head/sys/conf/options   Mon Mar

svn commit: r247821 - in head: . sys/sys

2013-03-04 Thread Davide Italiano
Author: davide
Date: Mon Mar  4 22:41:49 2013
New Revision: 247821
URL: http://svnweb.freebsd.org/changeset/base/247821

Log:
  - Bump __FreeBSD_version after recent callout(9) changes.
  - Add an entry in UPDATING to notice users about breakages.

Modified:
  head/UPDATING
  head/sys/sys/param.h

Modified: head/UPDATING
==
--- head/UPDATING   Mon Mar  4 22:07:36 2013(r247820)
+++ head/UPDATING   Mon Mar  4 22:41:49 2013(r247821)
@@ -27,6 +27,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10
ln -s 'abort:false,junk:false' /etc/malloc.conf.)
 
 20130304:
+   Recent commits to callout(9) changed the size of struct callout,
+   so the KBI is probably heavily disturbed. Also, some functions
+   in callout(9)/sleep(9)/sleepqueue(9)/condvar(9) KPIs were replaced
+   by macros. Every kernel module using it won't load, so rebuild
+   is requested.
+
The ctl device has been re-enabled in GENERIC for i386 and amd64,
but does not initialize by default (because of the new CTL_DISABLE
option) to save memory.  To re-enable it, remove the CTL_DISABLE

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hMon Mar  4 22:07:36 2013(r247820)
+++ head/sys/sys/param.hMon Mar  4 22:41:49 2013(r247821)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 128  /* Master, propagated to newvers */
+#define __FreeBSD_version 129  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r247822 - head/sys/dev/ixgbe

2013-03-04 Thread Jack F Vogel
Author: jfv
Date: Mon Mar  4 23:07:40 2013
New Revision: 247822
URL: http://svnweb.freebsd.org/changeset/base/247822

Log:
  First, sync to internal shared code, and then
  
  Fixes:
- flow control - don't override user value on re-init
- fix to make 1G optics work correctly
- change to interrupt enabling - some bits were incorrect
  for certain hardware.
- certain stats fixes, remove a duplicate increment of
  ierror, thanks to Scott Long for pointing these out.
- shared code link interface changed, requiring some
  core code changes to accomodate this.
- add an m_adj() to ETHER_ALIGN on the recieve side, this
  was requested by Mike Karels, thanks Mike.
- Multicast code corrections also thanks to Mike Karels.

Modified:
  head/sys/dev/ixgbe/LICENSE
  head/sys/dev/ixgbe/ixgbe.c
  head/sys/dev/ixgbe/ixgbe_82598.c
  head/sys/dev/ixgbe/ixgbe_82599.c
  head/sys/dev/ixgbe/ixgbe_82599.h
  head/sys/dev/ixgbe/ixgbe_api.c
  head/sys/dev/ixgbe/ixgbe_api.h
  head/sys/dev/ixgbe/ixgbe_common.c
  head/sys/dev/ixgbe/ixgbe_common.h
  head/sys/dev/ixgbe/ixgbe_mbx.h
  head/sys/dev/ixgbe/ixgbe_osdep.h
  head/sys/dev/ixgbe/ixgbe_phy.c
  head/sys/dev/ixgbe/ixgbe_phy.h
  head/sys/dev/ixgbe/ixgbe_type.h
  head/sys/dev/ixgbe/ixgbe_vf.c
  head/sys/dev/ixgbe/ixgbe_vf.h
  head/sys/dev/ixgbe/ixgbe_x540.c
  head/sys/dev/ixgbe/ixgbe_x540.h
  head/sys/dev/ixgbe/ixv.c

Modified: head/sys/dev/ixgbe/LICENSE
==
--- head/sys/dev/ixgbe/LICENSE  Mon Mar  4 22:41:49 2013(r247821)
+++ head/sys/dev/ixgbe/LICENSE  Mon Mar  4 23:07:40 2013(r247822)
@@ -1,6 +1,6 @@
 /**
 
-  Copyright (c) 2001-2011, Intel Corporation 
+  Copyright (c) 2001-2013, Intel Corporation 
   All rights reserved.
   
   Redistribution and use in source and binary forms, with or without 

Modified: head/sys/dev/ixgbe/ixgbe.c
==
--- head/sys/dev/ixgbe/ixgbe.c  Mon Mar  4 22:41:49 2013(r247821)
+++ head/sys/dev/ixgbe/ixgbe.c  Mon Mar  4 23:07:40 2013(r247822)
@@ -1,6 +1,6 @@
 /**
 
-  Copyright (c) 2001-2012, Intel Corporation 
+  Copyright (c) 2001-2013, Intel Corporation 
   All rights reserved.
   
   Redistribution and use in source and binary forms, with or without 
@@ -47,7 +47,7 @@ int ixgbe_display_debug_stat
 /*
  *  Driver version
  */
-char ixgbe_driver_version[] = 2.5.0;
+char ixgbe_driver_version[] = 2.5.7 - HEAD;
 
 /*
  *  PCI Device ID Table
@@ -83,7 +83,7 @@ static ixgbe_vendor_info_t ixgbe_vendor_
{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_SFP_SF2, 0, 0, 0},
{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_SFP_FCOE, 0, 0, 0},
{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599EN_SFP, 0, 0, 0},
-   {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X540T1, 0, 0, 0},
+   {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_SFP_SF_QP, 0, 0, 0},
{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X540T, 0, 0, 0},
/* required last entry */
{0, 0, 0, 0, 0}
@@ -216,7 +216,6 @@ static device_method_t ixgbe_methods[] =
DEVMETHOD(device_attach, ixgbe_attach),
DEVMETHOD(device_detach, ixgbe_detach),
DEVMETHOD(device_shutdown, ixgbe_shutdown),
-
DEVMETHOD_END
 };
 
@@ -596,6 +595,9 @@ ixgbe_attach(device_t dev)
PCIE, or x4 PCIE 2 slot is required.\n);
 }
 
+   /* Set an initial default flow control value */
+   adapter-fc =  ixgbe_fc_full;
+
/* let hardware know driver is loaded */
ctrl_ext = IXGBE_READ_REG(hw, IXGBE_CTRL_EXT);
ctrl_ext |= IXGBE_CTRL_EXT_DRV_LOAD;
@@ -1310,7 +1312,7 @@ ixgbe_init_locked(struct adapter *adapte
tmp = IXGBE_LOW_DV(frame);
hw-fc.low_water[0] = IXGBE_BT2KB(tmp);

-   adapter-fc = hw-fc.requested_mode = ixgbe_fc_full;
+   hw-fc.requested_mode = adapter-fc;
hw-fc.pause_time = IXGBE_FC_PAUSE;
hw-fc.send_xon = TRUE;
}
@@ -1680,7 +1682,7 @@ ixgbe_media_status(struct ifnet * ifp, s
ifmr-ifm_active |= IFM_100_TX | IFM_FDX;
break;
case IXGBE_LINK_SPEED_1GB_FULL:
-   ifmr-ifm_active |= adapter-optics | IFM_FDX;
+   ifmr-ifm_active |= IFM_1000_SX | IFM_FDX;
break;
case IXGBE_LINK_SPEED_10GB_FULL:
ifmr-ifm_active |= adapter-optics | IFM_FDX;
@@ 

svn commit: r247823 - head/sys/dev/ixgbe

2013-03-04 Thread Jack F Vogel
Author: jfv
Date: Mon Mar  4 23:15:07 2013
New Revision: 247823
URL: http://svnweb.freebsd.org/changeset/base/247823

Log:
  Fix a small, but important bug, a task drain was mistakenly
  being compiled only when setting LEGACY_TX, this means you would
  not get the drain when needed on detach!!
  
  Thanks to Bryan Venteicher (bry...@freebsd.org) for catching this
  little gremlin!! :)

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

Modified: head/sys/dev/ixgbe/ixgbe.c
==
--- head/sys/dev/ixgbe/ixgbe.c  Mon Mar  4 23:07:40 2013(r247822)
+++ head/sys/dev/ixgbe/ixgbe.c  Mon Mar  4 23:15:07 2013(r247823)
@@ -654,7 +654,7 @@ ixgbe_detach(device_t dev)
 
for (int i = 0; i  adapter-num_queues; i++, que++, txr++) {
if (que-tq) {
-#ifdef IXGBE_LEGACY_TX
+#ifndef IXGBE_LEGACY_TX
taskqueue_drain(que-tq, txr-txq_task);
 #endif
taskqueue_drain(que-tq, que-que_task);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r247829 - head/sys/dev/virtio/block

2013-03-04 Thread Bryan Venteicher
Author: bryanv
Date: Tue Mar  5 07:00:05 2013
New Revision: 247829
URL: http://svnweb.freebsd.org/changeset/base/247829

Log:
  Only set the barrier flag if the feature was negotiated
  
  When the VirtIO barrier feature is not negotiated, the driver
  must enforce the proper ordering for BIO_ORDERED BIOs. All the
  in-flight BIOs must complete before starting the BIO, and the
  ordered BIO must complete before subsequent BIOs can start.
  
  Also fix a few whitespace nits.
  
  Reported by:  neel
  Approved by:  grehan (mentor)
  MFC after:3 days

Modified:
  head/sys/dev/virtio/block/virtio_blk.c

Modified: head/sys/dev/virtio/block/virtio_blk.c
==
--- head/sys/dev/virtio/block/virtio_blk.c  Tue Mar  5 06:43:54 2013
(r247828)
+++ head/sys/dev/virtio/block/virtio_blk.c  Tue Mar  5 07:00:05 2013
(r247829)
@@ -72,6 +72,7 @@ struct vtblk_softc {
 #define VTBLK_FLAG_DETACH  0x0004
 #define VTBLK_FLAG_SUSPEND 0x0008
 #define VTBLK_FLAG_DUMPING 0x0010
+#define VTBLK_FLAG_BARRIER 0x0020
 
struct virtqueue*vtblk_vq;
struct sglist   *vtblk_sglist;
@@ -81,7 +82,8 @@ struct vtblk_softc {
TAILQ_HEAD(, vtblk_request)
 vtblk_req_free;
TAILQ_HEAD(, vtblk_request)
-   vtblk_req_ready;
+vtblk_req_ready;
+   struct vtblk_request*vtblk_req_ordered;
 
struct taskqueue*vtblk_tq;
struct task  vtblk_intr_task;
@@ -278,9 +280,10 @@ vtblk_attach(device_t dev)
 
if (virtio_with_feature(dev, VIRTIO_RING_F_INDIRECT_DESC))
sc-vtblk_flags |= VTBLK_FLAG_INDIRECT;
-
if (virtio_with_feature(dev, VIRTIO_BLK_F_RO))
sc-vtblk_flags |= VTBLK_FLAG_READONLY;
+   if (virtio_with_feature(dev, VIRTIO_BLK_F_BARRIER))
+   sc-vtblk_flags |= VTBLK_FLAG_BARRIER;
 
/* Get local copy of config. */
virtio_read_device_config(dev, 0, blkcfg,
@@ -766,25 +769,45 @@ vtblk_bio_request(struct vtblk_softc *sc
bp-bio_cmd);
}
 
-   if (bp-bio_flags  BIO_ORDERED)
-   req-vbr_hdr.type |= VIRTIO_BLK_T_BARRIER;
-
return (req);
 }
 
 static int
 vtblk_execute_request(struct vtblk_softc *sc, struct vtblk_request *req)
 {
+   struct virtqueue *vq;
struct sglist *sg;
struct bio *bp;
-   int readable, writable, error;
+   int ordered, readable, writable, error;
 
+   vq = sc-vtblk_vq;
sg = sc-vtblk_sglist;
bp = req-vbr_bp;
+   ordered = 0;
writable = 0;
 
VTBLK_LOCK_ASSERT(sc);
 
+   /*
+* Wait until the ordered request completes before
+* executing subsequent requests.
+*/
+   if (sc-vtblk_req_ordered != NULL)
+   return (EBUSY);
+
+   if (bp-bio_flags  BIO_ORDERED) {
+   if ((sc-vtblk_flags  VTBLK_FLAG_BARRIER) == 0) {
+   /*
+* This request will be executed once all
+* the in-flight requests are completed.
+*/
+   if (!virtqueue_empty(vq))
+   return (EBUSY);
+   ordered = 1;
+   } else
+   req-vbr_hdr.type |= VIRTIO_BLK_T_BARRIER;
+   }
+
sglist_reset(sg);
 
sglist_append(sg, req-vbr_hdr, sizeof(struct virtio_blk_outhdr));
@@ -802,10 +825,13 @@ vtblk_execute_request(struct vtblk_softc
 
writable++;
sglist_append(sg, req-vbr_ack, sizeof(uint8_t));
-
readable = sg-sg_nseg - writable;
 
-   return (virtqueue_enqueue(sc-vtblk_vq, req, sg, readable, writable));
+   error = virtqueue_enqueue(vq, req, sg, readable, writable);
+   if (error == 0  ordered)
+   sc-vtblk_req_ordered = req;
+
+   return (error);
 }
 
 static int
@@ -1013,6 +1039,12 @@ vtblk_finish_completed(struct vtblk_soft
while ((req = virtqueue_dequeue(sc-vtblk_vq, NULL)) != NULL) {
bp = req-vbr_bp;
 
+   if (sc-vtblk_req_ordered != NULL) {
+   /* This should be the only outstanding request. */
+   MPASS(sc-vtblk_req_ordered == req);
+   sc-vtblk_req_ordered = NULL;
+   }
+
error = vtblk_request_error(req);
if (error)
disk_err(bp, hard error, -1, 1);
@@ -1039,6 +1071,7 @@ vtblk_drain_vq(struct vtblk_softc *sc, i
vtblk_enqueue_request(sc, req);
}
 
+   sc-vtblk_req_ordered = NULL;
KASSERT(virtqueue_empty(vq), (virtqueue not empty));
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any 

Re: svn commit: r247792 - head/sys/dev/syscons

2013-03-04 Thread Luigi Rizzo
On Mon, Mar 04, 2013 at 04:55:49PM +0200, Alexander Motin wrote:
 On 04.03.2013 16:42, Luigi Rizzo wrote:
  On Mon, Mar 04, 2013 at 02:00:59PM +, Davide Italiano wrote:
...
- Reduce syscons refresh rate to 1-2Hz when console is in graphics mode
and there is nothing to do except some polling for keyboard.  Text mode
  
  just to understand, how does this 1-2Hz affect the respose to keypresses ?
  does it mean it takes 0.5..1s to see the keypress ?
 
 No, it is a polling for keyboard presence, and its rate already limited
 to 1Hz by comparing kbd_time_stamp to time_uptime there.

perfect, thanks for the clarification

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