13664 Commits

Author SHA1 Message Date
ian
9f4d42e0d5 MFC 264019, 264041, 264048, 264049, 264050, 264051
Add support for event timers whose clock frequency can change while running.

  Apparently all ARM configs build kern_et.c, but only a few of them also
  build kern_clocksource.c, un-break the build by not referencing functions in
  kern_clocksource if NO_EVENTTIMERS is defined.

  Add variable-frequency support to the arm mpcore eventtimer driver.

  mpcore_timer: Disable the timer and clear any pending bit, then setup the
  new counter register values, then restart the timer.  Also re-nest the parens
  properly for casting the result of converting time and frequency to a count.
2014-05-17 20:10:12 +00:00
ian
ee5c0f266a MFC 261357, 261358, 261421:
Enable SCHED_ULE for ppc book-e.

  Add driver for the ADT7460/ADT7467 fan controller found in
  later PowerBooks and iBooks.
2014-05-17 17:18:35 +00:00
sbruno
ebb52114cf MFC r264269, r264282, r264280, r264291, r264276, r264314
Merge sson's binmiscctl and image activator features to stable/10

Submitted by:	sson@freebsd.org
2014-05-16 21:56:33 +00:00
ian
8e2dd9b5e3 MFC r257854 (discussed with alc@)
As of r257209, all architectures have defined
  VM_KMEM_SIZE_SCALE.  In other words, every architecture is now
  auto-sizing the kmem arena.  This revision changes kmeminit() so
  that the definition of VM_KMEM_SIZE_SCALE becomes mandatory and
  the definition of VM_KMEM_SIZE becomes optional.

  Replace or eliminate all existing definitions of VM_KMEM_SIZE.
  With auto-sizing enabled, VM_KMEM_SIZE effectively became an
  alternate spelling for VM_KMEM_SIZE_MIN on most architectures.
  Use VM_KMEM_SIZE_MIN for clarity.
2014-05-16 01:30:30 +00:00
ian
4742b38bad MFC r261786, r261789
Rework the EARLY_PRINTF mechanism.  Instead of defining a special eprintf()
  routine, now a platform can provide a pointer to an early_putc() routine
  which is used instead of cn_putc().  Control can be handed off from early
  printf support to standard console support by NULLing out the pointer
  during standard console init.

  Convert two while(1); statements into proper panics.
2014-05-15 21:41:32 +00:00
cperciva
ec1799d213 MFC r265876:
In cf_get_method, when we don't already know what clock speed the CPU is
  running at, guess the nearest value instead of looking for a value within
  25 MHz of the observed frequency.

  Prior to this change, if a system booted with Intel Turbo Boost enabled,
  the dev.cpu.0.freq sysctl is nonfunctional, since the ACPI-reported
  frequency for Turbo Boost states does not match the actual clock frequency
  (and thus no levels are within 25 MHz of the observed frequency) and the
  current performance level is read before a new level is set.

Relnotes:	Bug fix in power management on CPUs with Intel Turbo Boost
2014-05-15 18:07:35 +00:00
ian
393ed120ae MFC r261038, r261039, r261040, r261041
Implement generic support for early printf.
2014-05-14 22:52:16 +00:00
ian
835175f3b8 MFC r260118
Delete echoed doesn't rub out the previous character, so always
  use <backspace> <space> <backspace> instead. This fixes hitting
  DELETE instead of BACKSPACE at mountroot> prompt.
2014-05-14 17:43:49 +00:00
bdrewery
c8a6d26c3c MFC r264795:
Fix grammar error and trailing newline.
2014-05-14 15:21:27 +00:00
bdrewery
729b1e09fe MFC r264385:
Use proper MFSNAMELEN for fs type.
2014-05-14 15:16:02 +00:00
truckman
767aadd2f0 MFC r265363
Avoid unsigned integer overflow which can cause
rman_reserve_resource_bound() to return incorrect results.

Continue the initial search until the first viable region is found.

Add a comment to explain the search termination test.

PR:		kern/188534
Reviewed by:	jhb (previous version)
2014-05-12 04:27:10 +00:00
brueffer
384378af24 MFC: r265244
Free resources in an error case.

CID:		1018947
Found with:	Coverity Prevent(tm)
2014-05-09 13:18:24 +00:00
brooks
5b893a150d MFC r265201
Fix a 2038 bug.

If time_t is 64-bit (i.e. isn't 32-bit) allow any value of year, not
just years less than 2038.

Don't bother fixing the underflow in the case of years before 1903.

MFC after:	1 week
Sponsored by:	DARPA, AFRL
2014-05-08 16:12:38 +00:00
scottl
96be897ce1 Merge r264984
Retire smp_active.  It was racey and caused demonstrated problems with
the cpufreq code.  Replace its use with smp_started.  There's at least
one userland tool that still looks at the kern.smp.active sysctl, so
preserve it but point it to smp_started as well.

Obtained from:	Netflix, Inc.
2014-05-07 20:28:27 +00:00
mav
825aecc9cf MFC r264550:
Fix VIRTUAL and PROF interval timers for short intervals, broken at r247903.

Due to the way those timers are implemented, we can't handle very short
intervals.  In addition to that mentioned patch caused math overflows
for short intervals.  To avoid that round those intervals to 1 tick.

PR:		kern/187668
2014-04-23 12:46:27 +00:00
brueffer
d9c1f7d446 MFC: r264422, r264471
Set buf to NULL only when we don't allocate memory,
and free buf unconditionally.

Found with:	Coverity Prevent(tm)
Requested by:	kib (r264471)
2014-04-23 12:15:14 +00:00
kib
be9f211c78 MFC r264620:
Fix typo.
2014-04-20 01:37:30 +00:00
emax
13d344e5ca MFC r263690
change defaule permissions on /dev/devstat. while i'm here remove
D_NEEDGIANT flag

Submitted by:	jhb
Reviewed by:	jhb, scottl, rwatson, delphij, phk
2014-04-16 17:57:08 +00:00
ray
bd8afe2477 MFC 264242,264244,264259
Fix panic on load new driver while vt(4) is in VGA textmode.
o Mute terminal while vt(4) driver change in progress.
o Reset VDF_TEXTMODE before init new driver.
o Assign default font, if new driver is not in TEXTMODE.
o Do not update screen while driver changing.
o Unmute terminal when done with driver replacement.
o Move init fonts to early point.
o Minor cleanup.
o Do not fill screen, while muted. (kern/subr_terminal.c)

Sponsored by:	The FreeBSD Foundation
2014-04-14 12:40:37 +00:00
kib
91bb0a33cf MFC r264173:
Use realloc(9) instead of doing the reallocation inline.
2014-04-12 14:18:25 +00:00
kib
67f7cbcad8 MFC r264146:
Fix a race between kqueue_register() and kqueue_scan() setting KN_INFLUX
flag while knlist is not locked, which caused lost notifications from
parallel knote().
2014-04-12 14:08:53 +00:00
dchagin
ee7f22ddbc MFC r264151:
Prevent alq from panic when the invalid alq_file path specified.
2014-04-12 06:50:11 +00:00
asomers
6b6e4c2d32 MFC r263116
Replace 4.4BSD Lite's unix domain socket backpressure hack with a cleaner
mechanism, based on the new SB_STOP sockbuf flag.  The old hack dynamically
changed the sending sockbuf's high water mark whenever adding or removing
data from the receiving sockbuf.  It worked for stream sockets, but it never
worked for SOCK_SEQPACKET sockets because of their atomic nature.  If the
sockbuf was partially full, it might return EMSGSIZE instead of blocking.

The new solution is based on DragonFlyBSD's fix from commit
3a6117bbe0ed6a87605c1e43e12a1438d8844380 on 2008-05-27.  It adds an SB_STOP
flag to sockbufs.  Whenever uipc_send surpasses the socket's size limit, it
sets SB_STOP on the sending sockbuf.  sbspace() will then return 0 for that
sockbuf, causing sosend_generic and friends to block.  uipc_rcvd will
likewise clear SB_STOP.  There are two fringe benefits: uipc_{send,rcvd} no
longer need to call chgsbsize() on every send and receive because they don't
change the sockbuf's high water mark.  Also, uipc_sense no longer needs to
acquire the UIPC linkage lock, because it's simpler to compute the
st_blksizes.

There is one drawback: since sbspace() will only ever return 0 or the
maximum, sosend_generic will allow the sockbuf to exceed its nominal maximum
size by at most one packet of size less than the max.  I don't think that's
a serious problem.  In fact, I'm not even positive that FreeBSD guarantees a
socket will always stay within its nominal size limit.

sys/sys/sockbuf.h
	Add the SB_STOP flag and adjust sbspace()

sys/sys/unpcb.h
	Delete the obsolete unp_cc and unp_mbcnt fields from struct unpcb.

sys/kern/uipc_usrreq.c
	Adjust uipc_rcvd, uipc_send, and uipc_sense to use the SB_STOP
	backpressure mechanism.  Removing obsolete unpcb fields from
	db_show_unpcb.

tests/sys/kern/unix_seqpacket_test.c
	Clear expected failures from ATF.
2014-04-03 16:57:16 +00:00
mjg
e7b96c1d34 MFC r263755:
Document a known problem with handling the process intended to receive
SIGIO in /dev/devctl.
2014-03-31 02:44:43 +00:00
mjg
0cdb222abb MFC r263704:
Make /dev/devctl mpsafe.

MFC r263753:
Remove lockless check in devopen, while correct it does not make much sense.
2014-03-31 02:30:55 +00:00
mjg
ae2823466f MFC r263530:
Mark the following sysctls as MPSAFE:
kern.file
kern.proc.filedesc
kern.proc.ofiledesc
2014-03-31 02:19:57 +00:00
mjg
11fbc59f9b MFC r263460:
Take filedesc lock only for reading when allocating new fdtable.

Code populating the table does this already.
2014-03-31 02:17:58 +00:00
bdrewery
e696b793ca MFC r263129:
Combine similar code from vprintf(9) and log(9).
2014-03-30 16:48:04 +00:00
kib
ef58943ab3 MFC r263475:
Fix two issues with /dev/mem access on amd64, both causing kernel page
faults.

First, for accesses to direct map region should check for the limit by
which direct map is instantiated.

Second, for accesses to the kernel map, use a new thread private flag
TDP_DEVMEMIO, which instructs vm_fault() to return error when fault
happens on the MAP_ENTRY_NOFAULT entry, instead of panicing.

MFC r263498:
Add change forgotten in r263475.  Make dmaplimit accessible outside
amd64/pmap.c.
2014-03-28 15:38:38 +00:00
asomers
df22d5312e MFC r262867
Fix PR kern/185813 "SOCK_SEQPACKET AF_UNIX sockets with asymmetrical buffers
drop packets".  It was caused by a check for the space available in a
sockbuf, but it was checking the wrong sockbuf.

sys/sys/sockbuf.h
sys/kern/uipc_sockbuf.c
	Add sbappendaddr_nospacecheck_locked(), which is just like
	sbappendaddr_locked but doesn't validate the receiving socket's space.
	Factor out common code into sbappendaddr_locked_internal().  We
	shouldn't simply make sbappendaddr_locked check the space and then call
	sbappendaddr_nospacecheck_locked, because that would cause the O(n)
	function m_length to be called twice.

sys/kern/uipc_usrreq.c
	Use sbappendaddr_nospacecheck_locked for SOCK_SEQPACKET sockets,
	because the receiving sockbuf's size limit is irrelevant.

tests/sys/kern/unix_seqpacket_test.c
	Now that 185813 is fixed, pipe_128k_8k fails intermittently due to
	185812.  Make it fail every time by adding a usleep after starting the
	writer thread and before starting the reader thread in test_pipe.  That
	gives the writer time to fill up its send buffer.  Also, clear the
	expected failure message due to 185813.  It actually said "185812", but
	that was a typo.

PR:		kern/185813
2014-03-27 16:47:35 +00:00
kib
4d414590eb MFC r263349:
Make the array pointed to by AT_PAGESIZES auxv properly aligned.
2014-03-26 16:59:28 +00:00
kib
5484edfdac MFC r263080:
Use correct types for sizeof() in the calculations for the malloc(9) sizes.
2014-03-19 13:02:17 +00:00
kib
7b315234ad MFC r263079:
The auio structure is only initialized when the vnode is symlink,
avoid reading from it otherwise.
2014-03-19 12:55:57 +00:00
markj
f17aef0675 MFC r262325:
Print a backtrace if the SDT(9) stub gets called so that there's at least
some hope of figuring out how it happened.
2014-03-18 00:55:19 +00:00
markj
437134881a MFC r259535:
The fasttrap fork handler is responsible for removing tracepoints in the
child process that were inherited from its parent. However, this should
not be done in the case of a vfork, since the fork handler ends up removing
the tracepoints from the shared vm space, and userland DTrace probes in the
parent will no longer fire as a result.

Now the child of a vfork may trigger userland DTrace probes enabled in its
parent, so modify the fasttrap probe handler to handle this case and handle
the child process in the same way that it would handle the traced process.
In particular, if once traces function foo() in a process that vforks, and
the child calls foo(), fasttrap will treat this call as having come from the
parent. This is the behaviour of the upstream code.

While here, add #ifdef guards to some code that isn't present upstream.
2014-03-18 00:29:33 +00:00
jhb
59b6242e90 MFC 259016,259019,259049,259071,259102,259110,259129,259130,259178,259179,
259203,259221,259261,259532,259615,259650,259651,259667,259680,259727,
259761,259772,259776,259777,259830,259882,259915,260160,260449,260450,
260688,260888,260953,261269,261547,261551,261552,261553,261585:
Merge the vt(4) driver (newcons) to stable/10.

Approved by:	ray
2014-03-06 18:30:56 +00:00
glebius
8a9528c4d0 Merge r261722, r261723, r261724, r261725 from head:
several minor improvements for UMA_ZPCPU_ZONE zones.
2014-03-04 14:46:30 +00:00
glebius
4b9e17c3ef Merge r261590, r261592 from head:
Remove identical vnet sysctl handlers, and handle CTLFLAG_VNET
  in the sysctl_root().

  Note: SYSCTL_VNET_* macros can be removed as well. All is
    needed to virtualize a sysctl oid is set CTLFLAG_VNET on it.
    But for now keep macros in place to avoid large code churn.
2014-03-04 14:01:12 +00:00
bdrewery
ee7a8407e1 MFC r262006,r262328:
r262006:
  Fix M_FILEDESC leak in fdgrowtable() introduced in r244510.
  fdgrowtable() now only reallocates fd_map when necessary.
 r262328:
  Style.

Approved by:	bapt (mentor, implicit)
2014-03-02 16:25:56 +00:00
bdrewery
1e9cbfb2bd MFC r262005:
Remove redundant memcpy of fd_ofiles in fdgrowtable()

Approved by:	bapt (mentor, implicit)
2014-03-02 16:04:27 +00:00
hiren
8c7b818635 MFC r257472
Rate limit (to once per minute) "Listen queue overflow" message in
sonewconn().
2014-02-27 22:34:09 +00:00
mjg
3948f93fc8 MFC r262309:
Fix a race between kern_proc_{o,}filedesc_out and fdescfree leading
to use-after-free.

fdescfree proceeds to free file pointers once fd_refcnt reaches 0, but
kern_proc_{o,}filedesc_out only checked for hold count.
2014-02-24 21:03:38 +00:00
mjg
7a394d25ec MFC r259330,r259331:
rlimit: add and utilize lim_shared

rlimit: avoid unnecessary copying of rlimits

If refcount is 1 just modify rlimits in place.
2014-02-20 21:52:39 +00:00
mjg
c581d5764a MFC r260233:
Plug a memory leak in dup2 when both old and new fd have ioctl caps.
2014-02-20 21:36:05 +00:00
brueffer
c34a480545 MFC: r261858
Fix a bug in be_uuid_dec(); it called le16dec() instead of be16dec(),
probably due to copy+pasting le_uuid_dec().

PR:		146588
Submitted by:	Erwin Rol <erwin at erwinrol.com>
Reviewed by:	marcel
2014-02-20 08:55:59 +00:00
jhb
459448a934 MFC 261780:
Expose OBJT_MGTDEVICE VM objects used for GEM/TTM with drm2 as an
explicit object type.
2014-02-19 19:11:14 +00:00
jhb
5b0bab6d24 MFC 261517,261520:
Convert the license on files where I am the sole copyright holder to
2 clause BSD licenses.
2014-02-18 20:27:17 +00:00
avg
22073dc5fc MFC r258713,262062: add taskqueue_drain_all 2014-02-17 15:32:08 +00:00
avg
cc43c81b03 MFC r258625: sdt: add support for solaris/illumos style DTRACE_PROBE macros
Note: in head KDTRACE_HOOKS is defined in opt_global.h and thus there is
no need to explicitly include any header to check that option.
In this branch we have to include opt_kdtrace.h and, so, this commit
carries additional changes to accomodate for that difference.

Sponsored by:	HybridCluster
2014-02-17 14:47:52 +00:00
avg
8fc9b71c18 MFC r259587: Invoke the kld_* event handlers from linker_load_file() ... 2014-02-17 12:45:35 +00:00