]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
11 years agoComplete any pending Tx frames before attempting the next transmit
Bryan Venteicher [Tue, 3 Sep 2013 02:28:31 +0000 (02:28 +0000)]
Complete any pending Tx frames before attempting the next transmit

Also complete pending frames in the watchdog function when the
EVENT_IDX feature was negotiated just in case the completion
interrupt was postponed.

11 years agoFix unintended compiler constant folding
Bryan Venteicher [Tue, 3 Sep 2013 02:26:57 +0000 (02:26 +0000)]
Fix unintended compiler constant folding

Pointed out by: dim@

11 years agoEnable PMC interrupt handling, and fix a DTrace trap handling bug.
Justin Hibbits [Tue, 3 Sep 2013 00:42:15 +0000 (00:42 +0000)]
Enable PMC interrupt handling, and fix a DTrace trap handling bug.

11 years agoRefactor PowerPC hwpmc(4) driver into generic and specific. More refactoring
Justin Hibbits [Tue, 3 Sep 2013 00:34:18 +0000 (00:34 +0000)]
Refactor PowerPC hwpmc(4) driver into generic and specific.  More refactoring
will likely be done as more drivers are added, since AIM-compatible processors
have similar PMC configuration logic.

11 years agoCreate the default router last. This allows using an static
Xin LI [Mon, 2 Sep 2013 23:52:25 +0000 (23:52 +0000)]
Create the default router last.  This allows using an static
interface route for default routes, which seems to be common
among many dedicated hosting providers.

Reviewed by: hrs
MFC after: 2 weeks

11 years agoUse uint16_t instead of in_port_t for consistency with the SCTP code.
Michael Tuexen [Mon, 2 Sep 2013 23:27:53 +0000 (23:27 +0000)]
Use uint16_t instead of in_port_t for consistency with the SCTP code.

MFC after: 1 week

11 years agoWhitespace cleanup.
Justin Hibbits [Mon, 2 Sep 2013 23:22:05 +0000 (23:22 +0000)]
Whitespace cleanup.

11 years agoAll changes affect only SCTP-AUTH:
Michael Tuexen [Mon, 2 Sep 2013 22:48:41 +0000 (22:48 +0000)]
All changes affect only SCTP-AUTH:
* Remove non working code related to SHA224.
* Remove support for non-standardised HMAC-IDs using SHA384 and SHA512.
* Prefer SHA256 over SHA1.
* Minor cleanup.

MFC after: 2 weeks

11 years agoBetter conformance to style(9) and organizational cleanup.
Justin T. Gibbs [Mon, 2 Sep 2013 22:22:56 +0000 (22:22 +0000)]
Better conformance to style(9) and organizational cleanup.
No functional changes.

sys/i386/xen/mp_machdep.c:
Remove extra newlines.

Group externs, forward delarations, local types, and pcpu data.

Wrap at 80 columns.

Use parens in return statements.

Tab indent members of array initializers.

MFC after: 2 weeks

11 years agosh: Fix race condition with signals and wait or set -T.
Jilles Tjoelker [Mon, 2 Sep 2013 21:57:46 +0000 (21:57 +0000)]
sh: Fix race condition with signals and wait or set -T.

The change in r238888 was incomplete. It was still possible for a trapped
signal to arrive before the shell went to sleep (sigsuspend()) because a
check was missing or because the signal arrived before in_waitcmd was set.

On SMP, this bug sometimes caused the builtins/wait4.0 test to take 1 second
to execute; it then might or might not fail. On UP, the test almost always
failed.

11 years agoIgnore if the interface is not IPv6-capable.
Hiroki Sato [Mon, 2 Sep 2013 20:44:19 +0000 (20:44 +0000)]
Ignore if the interface is not IPv6-capable.

Spotted by: rpaulo

11 years agosys/mouse.h: Move members introduced in r255153 to end of struct synapticshw
Jean-Sébastien Pédron [Mon, 2 Sep 2013 19:49:18 +0000 (19:49 +0000)]
sys/mouse.h: Move members introduced in r255153 to end of struct synapticshw

I didn't know this structure was public and didn't pay enough attention...

11 years agopsm: Add support for middle and extended buttons on Synaptics touchpads
Jean-Sébastien Pédron [Mon, 2 Sep 2013 19:15:20 +0000 (19:15 +0000)]
psm: Add support for middle and extended buttons on Synaptics touchpads

PR: kern/170834
Submitted by: Brandon Gooch <jamesbrandongooch@gmail.com>
Tested by: Artyom Mirgorodskiy <artyom.mirgorodsky@gmail.com>
MFC after: 1 month

11 years agosynaptics and trackpoint support are stable enough to be on by default.
Eitan Adler [Mon, 2 Sep 2013 18:25:18 +0000 (18:25 +0000)]
synaptics and trackpoint support are stable enough to be on by default.

Eventually both options should be removed.

Reviewed by: dumbbell

11 years agoRevert accidental commit.
Rui Paulo [Mon, 2 Sep 2013 17:07:46 +0000 (17:07 +0000)]
Revert accidental commit.

11 years agolibexecinfo compatibility with devel/libexecinfo port
Ed Maste [Mon, 2 Sep 2013 12:37:33 +0000 (12:37 +0000)]
libexecinfo compatibility with devel/libexecinfo port

1. Match shlib number
2. Add libelf dependency

Suggested by: bapt[1]

11 years agoMake ELI destruction (including orphanization) less aggressive, making it
Alexander Motin [Mon, 2 Sep 2013 10:44:54 +0000 (10:44 +0000)]
Make ELI destruction (including orphanization) less aggressive, making it
always wait for provider close.  Old algorithm was reported to cause NULL
dereference panic on attempt to close provider after softc destruction.
If not global workaroung in GEOM, that could even cause destruction with
requests still in flight.

11 years agoMerge 1.12 of pf_lb.c from OpenBSD, with some changes. Original commit:
Gleb Smirnoff [Mon, 2 Sep 2013 10:14:25 +0000 (10:14 +0000)]
Merge 1.12 of pf_lb.c from OpenBSD, with some changes. Original commit:

  date: 2010/02/04 14:10:12;  author: sthen;  state: Exp;  lines: +24 -19;
  pf_get_sport() picks a random port from the port range specified in a
  nat rule. It should check to see if it's in-use (i.e. matches an existing
  PF state), if it is, it cycles sequentially through other ports until
  it finds a free one. However the check was being done with the state
  keys the wrong way round so it was never actually finding the state
  to be in-use.

  - switch the keys to correct this, avoiding random state collisions
  with nat. Fixes PR 6300 and problems reported by robert@ and viq.

  - check pf_get_sport() return code in pf_test(); if port allocation
  fails the packet should be dropped rather than sent out untranslated.

  Help/ok claudio@.

Some additional changes to 1.12:

- We also need to bzero() the key to zero padding, otherwise key
  won't match.
- Collapse two if blocks into one with ||, since both conditions
  lead to the same processing.
- Only naddr changes in the cycle, so move initialization of other
  fields above the cycle.
- s/u_intXX_t/uintXX_t/g

PR: kern/181690
Submitted by: Olivier Cochard-Labbé <olivier cochard.me>
Sponsored by: Nginx, Inc.

11 years agoConform to style(9). No functional changes.
Justin T. Gibbs [Sun, 1 Sep 2013 23:49:36 +0000 (23:49 +0000)]
Conform to style(9).  No functional changes.

sys/x86/xen/hvm.c:
Do not rely on implicit conversion to boolean in expressions
(e.g. use "if (rc != 0)" instead of "if (rc)".

Line continuations for functions are indented an additional
4 spaces.

Insert an empty line if the function has no local variables.

Prefer separate initializtion statements to initialzing
local variables in their declaration.

Braces that are not necessary may be left out.

MFC after: 2 weeks

11 years agoFix socket buffer timeouts precision using the new sbintime_t KPI instead
Davide Italiano [Sun, 1 Sep 2013 23:34:53 +0000 (23:34 +0000)]
Fix socket buffer timeouts precision using the new sbintime_t KPI instead
of relying on the tvtohz() workaround. The latter has been introduced
lately by jhb@ (r254699) in order to have a fix that can be backported
to STABLE.

Reported by: Vitja Makarov <vitja.makarov at gmail dot com>
Reviewed by: jhb (earlier version)

11 years agoForced dismounts of NFS mounts can fail when thread(s) are stuck
Rick Macklem [Sun, 1 Sep 2013 23:02:59 +0000 (23:02 +0000)]
Forced dismounts of NFS mounts can fail when thread(s) are stuck
waiting for an RPC reply from the server while holding the mount
point busy (mnt_lockref incremented). This happens because dounmount()
msleep()s waiting for mnt_lockref to become 0, before calling
VFS_UNMOUNT(). This patch adds a new VFS operation called VFS_PURGE(),
which the NFS client implements as purging RPCs in progress. Making
this call before checking mnt_lockref fixes the problem, by ensuring
that the VOP_xxx() calls will fail and unbusy the mount point.

Reported by: sbruno
Reviewed by: kib
MFC after: 2 weeks

11 years agoUse single underscore for all parameters name and local variables in
Davide Italiano [Sun, 1 Sep 2013 22:30:24 +0000 (22:30 +0000)]
Use single underscore for all parameters name and local variables in
bintime_* related functions. This commit completes what was already done
by theraven@ for bintime_shift, and just uses a single underscore instead
of two (which is a style bug according to Bruce). See r251855 for reference.

Reported by: theraven
Discussed with: bde
Reviewed by: bde

11 years agoComplete r250105. Do not zero fields if M_ZERO flag is specified to
Davide Italiano [Sun, 1 Sep 2013 21:44:43 +0000 (21:44 +0000)]
Complete r250105. Do not zero fields if M_ZERO flag is specified to
malloc(9).

Reported by: pluknet, glebius

11 years agoFix build with gcc
Eitan Adler [Sun, 1 Sep 2013 20:22:52 +0000 (20:22 +0000)]
Fix build with gcc

Reported by: Michael Butler <imb@protected-networks.net>
Reviewed by: jilles

11 years agoInitial support for the Digi ConnectCore(c) i.MX53 / Wi-i.MX53 boards.
Rui Paulo [Sun, 1 Sep 2013 20:15:35 +0000 (20:15 +0000)]
Initial support for the Digi ConnectCore(c) i.MX53 / Wi-i.MX53 boards.

There are many drivers missing, but we can reach single user mode now.

Hardware graciously donated by Douglas Beattie.

11 years agosystem(): Restore behaviour for SIGINT and SIGQUIT.
Jilles Tjoelker [Sun, 1 Sep 2013 19:59:54 +0000 (19:59 +0000)]
system(): Restore behaviour for SIGINT and SIGQUIT.

As mentioned in r16117 and the book "Advanced Programming in the Unix
Environment" by W. Richard Stevens, we should ignore SIGINT and SIGQUIT
before forking, since it is not guaranteed that the parent process starts
running soon enough.

To avoid calling sigaction() in the vforked child, instead block SIGINT and
SIGQUIT before vfork() and keep the sigaction() to ignore after vfork(). The
FreeBSD kernel discards ignored signals, even if they are blocked;
therefore, it is not necessary to unblock SIGINT and SIGQUIT earlier.

11 years agoAdd support for the BCM20702A0 chipset, ASUS USB-BT400.
Eitan Adler [Sun, 1 Sep 2013 19:27:32 +0000 (19:27 +0000)]
Add support for the BCM20702A0 chipset, ASUS USB-BT400.

PR: kern/181728
Submitted by: rakuco

11 years agoPay attention to errCheck!
Simon J. Gerraty [Sun, 1 Sep 2013 18:59:09 +0000 (18:59 +0000)]
Pay attention to errCheck!

PR: 181715

11 years agoAdd debug trace points for freeze/release device queue.
Alexander Motin [Sun, 1 Sep 2013 17:37:19 +0000 (17:37 +0000)]
Add debug trace points for freeze/release device queue.

11 years agopmap_protect() on MIPS does not need to acquire the pvh global lock.
Alan Cox [Sun, 1 Sep 2013 17:06:14 +0000 (17:06 +0000)]
pmap_protect() on MIPS does not need to acquire the pvh global lock.

11 years agoRegenerate after recent addition of FTDI and bluetooth device IDs.
Ian Lepore [Sun, 1 Sep 2013 14:28:12 +0000 (14:28 +0000)]
Regenerate after recent addition of FTDI and bluetooth device IDs.

11 years agoAdd the device ID for a new flavor of FTDI serial adapter (model 232EX).
Ian Lepore [Sun, 1 Sep 2013 14:15:31 +0000 (14:15 +0000)]
Add the device ID for a new flavor of FTDI serial adapter (model 232EX).

11 years agoFix a compiler warning about signed vs unsigned compare.
Ian Lepore [Sun, 1 Sep 2013 14:06:57 +0000 (14:06 +0000)]
Fix a compiler warning about signed vs unsigned compare.

11 years agoBring legacy CAM target implementation back into API/KPI-coherent and even
Alexander Motin [Sun, 1 Sep 2013 13:01:59 +0000 (13:01 +0000)]
Bring legacy CAM target implementation back into API/KPI-coherent and even
functional state.  While CTL is much more superior target from all points,
there is no reason why this code should not work.

Tested with ahc(4) as target side HBA.

MFC after: 2 weeks

11 years agoFix SES_ENABLE_PASSTHROUGH kernel option, unexpectedly broken during driver
Alexander Motin [Sun, 1 Sep 2013 12:18:44 +0000 (12:18 +0000)]
Fix SES_ENABLE_PASSTHROUGH kernel option, unexpectedly broken during driver
overhaul.

MFC after: 3 days

11 years agoFix targbh crash on XPT_IMMED_NOTIFY error during attach.
Alexander Motin [Sun, 1 Sep 2013 11:50:37 +0000 (11:50 +0000)]
Fix targbh crash on XPT_IMMED_NOTIFY error during attach.

11 years agoFix the build with CTLFEDEBUG, broken by unmapped I/O support changes.
Alexander Motin [Sun, 1 Sep 2013 10:11:00 +0000 (10:11 +0000)]
Fix the build with CTLFEDEBUG, broken by unmapped I/O support changes.

11 years agoImport multiqueue VirtIO net driver from my user/bryanv/vtnetmq branch
Bryan Venteicher [Sun, 1 Sep 2013 04:33:47 +0000 (04:33 +0000)]
Import multiqueue VirtIO net driver from my user/bryanv/vtnetmq branch

This is a significant rewrite of much of the previous driver; lots of
misc. cleanup was also performed, and support for a few other minor
features was also added.

11 years agoSync VirtIO net device header file from recent Linux
Bryan Venteicher [Sun, 1 Sep 2013 04:23:54 +0000 (04:23 +0000)]
Sync VirtIO net device header file from recent Linux

11 years agoAdd optional VirtIO device method for post-attach notifications
Bryan Venteicher [Sun, 1 Sep 2013 04:20:23 +0000 (04:20 +0000)]
Add optional VirtIO device method for post-attach notifications

This is called after the parent device (ie virito_pci) has
completed the device attachment/initialization.

11 years agoAdd support for postponing VirtIO virtqueue interrupts
Bryan Venteicher [Sun, 1 Sep 2013 04:16:43 +0000 (04:16 +0000)]
Add support for postponing VirtIO virtqueue interrupts

Partial support for the EVENT_IDX feature was added a while ago,
but this commit adds an interface for the device driver to hint
how long (in terms of descriptors) the next interrupt should be
delayed.

The first user of this will be used to reduce VirtIO net's Tx
completion interrupts.

11 years agolibc: Always use our own copy of sys_errlist and sys_nerr (.so only).
Jilles Tjoelker [Sat, 31 Aug 2013 22:32:42 +0000 (22:32 +0000)]
libc: Always use our own copy of sys_errlist and sys_nerr (.so only).

This ensures strerror() and friends continue to work correctly even if a
(non-PIE) executable linked against an older libc imports sys_errlist (which
causes sys_errlist to refer to the executable's copy with a size fixed when
that executable was linked).

The executable's use of sys_errlist remains broken because it uses the
current value of sys_nerr and may access past the bounds of the array.

Different from the message "Using sys_errlist from executables is not
ABI-stable" on freebsd-arch, this change does not affect the static library.
There seems no reason to prevent overriding the error messages in the static
library.

11 years agoAdd support for the GCC binary integer constants extension.
Pedro F. Giffuni [Sat, 31 Aug 2013 20:33:37 +0000 (20:33 +0000)]
Add support for the GCC binary integer constants extension.

This is required to build the i965 backend with newer versions of mesa.

Original patch from Joerg Wunsch in GCC Bug 23479, under the GPLv2;
also taken from there in OpenBSD.

Obtained from: gcc 4.3 (rev. 125346; GPLv2)
MFC after: 5 days

11 years agoFix two build failures for non-tb configurations, UP [2] and when using gas [1].
Konstantin Belousov [Sat, 31 Aug 2013 19:13:21 +0000 (19:13 +0000)]
Fix two build failures for non-tb configurations, UP [2] and when using gas [1].

Reported by: andreast [1], bf [2]
Sponsored by: The FreeBSD Foundation

11 years agoAdd support to the ARM platform specific section types.
Andrew Turner [Sat, 31 Aug 2013 18:13:20 +0000 (18:13 +0000)]
Add support to the ARM platform specific section types.

11 years agoOnly add the backlight device if it actually exists in OF.
Justin Hibbits [Sat, 31 Aug 2013 16:31:48 +0000 (16:31 +0000)]
Only add the backlight device if it actually exists in OF.

MFC after: 1 week

11 years agoFixes for DTrace on PowerPC:
Justin Hibbits [Sat, 31 Aug 2013 16:30:20 +0000 (16:30 +0000)]
Fixes for DTrace on PowerPC:

- Implement dtrace_getarg()
- Sync fbt with x86, and fix a typo.
- Pull in the time synchronization code from amd64.

11 years agoImplement pmap_advise().
Alan Cox [Sat, 31 Aug 2013 16:21:13 +0000 (16:21 +0000)]
Implement pmap_advise().

11 years agoFix bug introduced in rewrite of keg_free_slab in -r251894.
Kirk McKusick [Sat, 31 Aug 2013 15:40:15 +0000 (15:40 +0000)]
Fix bug introduced in rewrite of keg_free_slab in -r251894.
The consequence of the bug is that fini calls are not done
when a slab is freed by a call-back from the page daemon.
It went unnoticed for two months because fini is little used.

I spotted the bug while reading the code to learn how it works
so I could write it up for the next edition of the Design and
Implementation of FreeBSD book.

No MFC needed as this code exists only in HEAD.

Reviewed by: kib, jeff
Tested by:   pho

11 years agoImplement _Unwind_GetIP and _Unwind_GetIPInfo as functions as that is what
Andrew Turner [Sat, 31 Aug 2013 14:56:09 +0000 (14:56 +0000)]
Implement _Unwind_GetIP and _Unwind_GetIPInfo as functions as that is what
we expect on FreeBSD. The implementation is based on the existing macros.

11 years agoBring in gcc r128087 to add support for _Unwind_Backtrace on ARM. This is
Andrew Turner [Sat, 31 Aug 2013 14:53:19 +0000 (14:53 +0000)]
Bring in gcc r128087 to add support for _Unwind_Backtrace on ARM. This is
prior to the licence change so is under the GPLv2.

11 years agoDon't use _Unwind_Backtrace() on ARM as it's currently missing from our libgcc_s...
David Chisnall [Sat, 31 Aug 2013 08:56:33 +0000 (08:56 +0000)]
Don't use _Unwind_Backtrace() on ARM as it's currently missing from our libgcc_s.  andrew@ has patches to add it, so this can be reverted and sync'd with upstream later.

11 years agoUnconditionally compile the __sync_* atomics support functions into compiler-rt
David Chisnall [Sat, 31 Aug 2013 08:50:45 +0000 (08:50 +0000)]
Unconditionally compile the __sync_* atomics support functions into compiler-rt
for ARM.
This is quite ugly, because it has to work around a clang bug that does not
allow built-in functions to be defined, even when they're ones that are
expected to be built as part of a library.

Reviewed by: ed

11 years agoFix a typo in a comment.
Rui Paulo [Sat, 31 Aug 2013 07:08:21 +0000 (07:08 +0000)]
Fix a typo in a comment.

11 years agoSync USB bluetooth product list with Linux.
Hans Petter Selasky [Sat, 31 Aug 2013 06:47:53 +0000 (06:47 +0000)]
Sync USB bluetooth product list with Linux.

MFC after: 1 week

11 years ago- Set proper KERNLOADADDR
Oleksandr Tymoshenko [Sat, 31 Aug 2013 01:30:01 +0000 (01:30 +0000)]
- Set proper KERNLOADADDR
- Add bpf(4) required by dhclient

11 years ago YAMON is 32-bit application and uses 32-bit pointers to pass kernel
Oleksandr Tymoshenko [Sat, 31 Aug 2013 01:24:05 +0000 (01:24 +0000)]
YAMON is 32-bit application and uses 32-bit pointers to pass kernel
arguments and environment names/values. Cast values to proper pointer type
to make MALTA kernel 64-bit compatible

11 years agosh: Simplify list() in the parser.
Jilles Tjoelker [Fri, 30 Aug 2013 20:50:28 +0000 (20:50 +0000)]
sh: Simplify list() in the parser.

The erflag argument was only used by old-style (``) command substitutions.
We can remove it and handle the special case in the command substitution
code.

11 years agoAdd device PicoStation M2HP support.
Hiren Panchasara [Fri, 30 Aug 2013 20:46:01 +0000 (20:46 +0000)]
Add device PicoStation M2HP support.
This is a nice small outdoor/indoor AP from Ubiquity Networks.

The device has:
AR7241 CPU SoC
AR9287 Wifi
8MB flash
32MB RAM

wifi has been tested to work along with leds.

Submitted by:   loos
Approved by:    sbruno (mentor, implicit)
Tested by:      hiren

11 years agosh: Separate out nbinary allocation into a function.
Jilles Tjoelker [Fri, 30 Aug 2013 20:37:52 +0000 (20:37 +0000)]
sh: Separate out nbinary allocation into a function.

11 years agoAdd bpf(4) to config file to get dhclient working
Oleksandr Tymoshenko [Fri, 30 Aug 2013 20:30:33 +0000 (20:30 +0000)]
Add bpf(4) to config file to get dhclient working

11 years ago Add PCI bus space implementation that converts all 2 and 4 bytes
Oleksandr Tymoshenko [Fri, 30 Aug 2013 20:28:35 +0000 (20:28 +0000)]
Add PCI bus space implementation that converts all 2 and 4 bytes
values to/from little endian according to PCI spec.

11 years agomdoc: add missing El.
Joel Dahl [Fri, 30 Aug 2013 20:20:06 +0000 (20:20 +0000)]
mdoc: add missing El.

11 years agosh: Use makename() where possible.
Jilles Tjoelker [Fri, 30 Aug 2013 20:13:33 +0000 (20:13 +0000)]
sh: Use makename() where possible.

11 years agoGive the page allocations initiated by the swap-backed md(4) a higher
Konstantin Belousov [Fri, 30 Aug 2013 20:12:23 +0000 (20:12 +0000)]
Give the page allocations initiated by the swap-backed md(4) a higher
priority.  If the write is requested by a system daemon, sleeping
there would starve resources and cause deadlock.

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation

11 years agoThe pm_save should be cleared on the pmap initialization, and not on
Konstantin Belousov [Fri, 30 Aug 2013 20:10:01 +0000 (20:10 +0000)]
The pm_save should be cleared on the pmap initialization, and not on
the activation.

Noted by: alc

11 years agoStyle cleanups.
Pawel Jakub Dawidek [Fri, 30 Aug 2013 19:42:25 +0000 (19:42 +0000)]
Style cleanups.

11 years agoacpi_thermal: Warn about insane _TMP temperature only once
Jean-Sébastien Pédron [Fri, 30 Aug 2013 19:21:12 +0000 (19:21 +0000)]
acpi_thermal: Warn about insane _TMP temperature only once

A warning is emitted again if the temperature became briefly valid
meanwhile. This avoids spamming the user when the sensor is broken.

Other values (ie. not _TMP) always raise a warning.

11 years agoPull in r189672 from upstream llvm trunk:
Dimitry Andric [Fri, 30 Aug 2013 18:29:25 +0000 (18:29 +0000)]
Pull in r189672 from upstream llvm trunk:

  InstCombine: Check for zero shift amounts before subtracting one
  causing integer overflow.

  PR17026. Also avoid undefined shifts and shift amounts larger than 64
  bits (those are always undef because we can't represent integer types
  that large).

This should fix assertion failures when building the emulators/xmame
port.

Reported by: bapt

11 years agoA final test with unmodified code has shown that a delay of 150ms
Marcel Moolenaar [Fri, 30 Aug 2013 15:26:45 +0000 (15:26 +0000)]
A final test with unmodified code has shown that a delay of 150ms
is not giving us a 100% success rate. Bump the delay to 200ms as
that seems to do the trick.

Note that during testing the delay was added to uart_bus_attach()
in uart_core.c. While having the delay in a different place can
change the behaviour, it was not expected. Having to bump the
delay with another 50ms could therefore be an indication that
the problem can not be solved with delays.

Reported by: kevlo@
Tested by: kevlo@

11 years agosh: Add a function for the case where one token is required in the parse.
Jilles Tjoelker [Fri, 30 Aug 2013 13:25:15 +0000 (13:25 +0000)]
sh: Add a function for the case where one token is required in the parse.

11 years agosh: Recognize "--" as end of options in type builtin.
Jilles Tjoelker [Fri, 30 Aug 2013 12:09:59 +0000 (12:09 +0000)]
sh: Recognize "--" as end of options in type builtin.

This implementation makes minimal changes: command names starting with "-"
(other than "--") can still be queried normally.

11 years agoThe round of expand_number() cleanups.
Sergey Kandaurov [Fri, 30 Aug 2013 11:21:52 +0000 (11:21 +0000)]
The round of expand_number() cleanups.
o Fix range error checking to detect overflow when uint64_t < uintmax_t.
o Remove a non-functional check for no valid digits as pointed out by Bruce.
o Remove a rather pointless comment describing what the function does.
o Clean up a bunch of style bugs.

Brucified by: bde

11 years agosh: Cast -1 to pointer rather than pointer to variable of wrong type.
Jilles Tjoelker [Fri, 30 Aug 2013 10:45:02 +0000 (10:45 +0000)]
sh: Cast -1 to pointer rather than pointer to variable of wrong type.

NEOF needs to be a non-null pointer distinct from valid union node pointers.
It is not dereferenced.

The new NEOF is much like SIG_ERR except that it is an object pointer
instead of a function pointer.

The variable tokpushback can now be static.

11 years agoSimplify pause_sbt() logic. Don't call DELAY() if remainder is less
Hans Petter Selasky [Fri, 30 Aug 2013 10:39:56 +0000 (10:39 +0000)]
Simplify pause_sbt() logic. Don't call DELAY() if remainder is less
than or equal to zero.

11 years agoTypo in strtol(3).
Sergey Kandaurov [Fri, 30 Aug 2013 10:01:19 +0000 (10:01 +0000)]
Typo in strtol(3).

Noticed by: bde

11 years agoImplement support for the process-context identifiers ('PCID') on
Konstantin Belousov [Fri, 30 Aug 2013 07:59:49 +0000 (07:59 +0000)]
Implement support for the process-context identifiers ('PCID') on
Intel CPUs.  The feature tags TLB entries with the Id of the address
space and allows to avoid TLB invalidation on the context switch, it
is available only in the long mode.  In the microbenchmarks, using the
PCID decreased latency of the context switches by ~30% on SandyBridge
class desktop CPUs, measured with the lat_ctx program from lmbench.

If available, use INVPCID instruction when a TLB entry in non-current
address space needs to be invalidated.  The instruction is typically
available on the Haswell.

If needed, the use of PCID can be turned off with the
vm.pmap.pcid_enabled loader tunable set to 0.  The state of the
feature is reported by the vm.pmap.pcid_enabled sysctl.  The sysctl
vm.pmap.pcid_save_cnt reports the number of context switches which
avoided invalidating the TLB; compare with the total number of context
switches, available as sysctl vm.stats.sys.v_swtch.

Sponsored by: The FreeBSD Foundation
Reviewed by: alc
Tested by: pho, bf

11 years agoAdd BIT_AND_ATOMIC() and CPU_AND_ATOMIC().
Konstantin Belousov [Fri, 30 Aug 2013 07:43:34 +0000 (07:43 +0000)]
Add BIT_AND_ATOMIC() and CPU_AND_ATOMIC().

Sponsored by: The FreeBSD Foundation
Reviewed by: alc
Tested by: pho, bf

11 years agoProvide a wrapper for the INVPCID instruction, definition of the
Konstantin Belousov [Fri, 30 Aug 2013 07:42:38 +0000 (07:42 +0000)]
Provide a wrapper for the INVPCID instruction, definition of the
descriptor and symbolic names for the operation types.

Sponsored by: The FreeBSD Foundation
Reviewed by: alc
Tested by: pho, bf

11 years agoMove the definition of the struct unrhdr into a separate header file,
Konstantin Belousov [Fri, 30 Aug 2013 07:37:45 +0000 (07:37 +0000)]
Move the definition of the struct unrhdr into a separate header file,
to allow embedding the struct.  Add init_unrhdr(9) initializer, which
sets up preallocated unrhdr.

Reviewed by: alc
Tested by: pho, bf

11 years agoReduce WARNS to 0 for dig, host, and nslookup to make them
Erwin Lansing [Fri, 30 Aug 2013 06:21:00 +0000 (06:21 +0000)]
Reduce WARNS to 0 for dig, host, and nslookup to make them
compile with the optional WITH_BIND_SIGCHASE.

Submitted by: Andre Albsmeier <Andre.Albsmeier@siemens.com>
Approved by: delphij (mentor, implicit)
MFC after: 3 days
Sponsored by: DK Hostmaster A/S

11 years agoFew more minor if_vmx tweaks
Bryan Venteicher [Fri, 30 Aug 2013 05:53:00 +0000 (05:53 +0000)]
Few more minor if_vmx tweaks

 - Allow the Rx/Tx queue sizes to be configured by tunables
 - Bail out earlier if the Tx queue unlikely has enough free
   descriptors to hold the frame
 - Cleanup some of the offloading capabilities handling

11 years agoFix the sysctl that displays whether buffer packing is enabled
Navdeep Parhar [Fri, 30 Aug 2013 02:13:36 +0000 (02:13 +0000)]
Fix the sysctl that displays whether buffer packing is enabled
or not.

11 years agoIf reading a virtual-device value fails, attempt to read a virtual-device-ext
Colin Percival [Fri, 30 Aug 2013 01:46:56 +0000 (01:46 +0000)]
If reading a virtual-device value fails, attempt to read a virtual-device-ext
value.  Some hosts do not publish "extended" disk IDs via virtual-device in
an attempt to avoid confusing old blkfront drivers, and without this change
we failed to attach such disks.

In particular, this commit allows all 24 ephemeral disks on EC2 hs1.8xlarge
instances to be used, instead of only the first 15.

MFC after: 3 days

11 years agoImplement support for rx buffer packing. Enable it by default for T5
Navdeep Parhar [Fri, 30 Aug 2013 01:45:36 +0000 (01:45 +0000)]
Implement support for rx buffer packing.  Enable it by default for T5
cards.

This is a T4 and T5 chip feature which lets the chip deliver multiple
Ethernet frames in a single buffer.  This is more efficient within the
chip, in the driver, and reduces wastage of space in rx buffers.

- Always allocate rx buffers from the jumbop zone, no matter what the
  MTU is.  Do not use the normal cluster refcounting mechanism.
- Reserve space for an mbuf and a refcount in the cluster itself and let
  the chip DMA multiple frames in the rest.
- Use the embedded mbuf for the first frame and allocate mbufs on the
  fly for any additional frames delivered in the cluster.  Each of these
  mbufs has a reference on the underlying cluster.

11 years ago- Fix LOCAL_MTREE so it properly handles multiple files and quotes
Bryan Drewery [Fri, 30 Aug 2013 01:32:47 +0000 (01:32 +0000)]
- Fix LOCAL_MTREE so it properly handles multiple files and quotes
  its value into submakes

PR: conf/179466
Submitted by: Garrett Cooper <yaneurabeya@gmail.com>
Approved by: bapt
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

11 years agoAdd a routine for attaching an mbuf to a buffer with an external
Navdeep Parhar [Thu, 29 Aug 2013 23:46:38 +0000 (23:46 +0000)]
Add a routine for attaching an mbuf to a buffer with an external
refcount.  This one is willing to work with buffers that may already be
referenced.  MEXTADD/m_extadd are suitable only for the first attachment
to a cluster -- they initialize the refcount to 1.

11 years agoIntroduce a new, HVM compatible, paravirtualized timer driver for Xen.
Justin T. Gibbs [Thu, 29 Aug 2013 23:11:58 +0000 (23:11 +0000)]
Introduce a new, HVM compatible, paravirtualized timer driver for Xen.
Use this new driver for both PV and HVM instances.

This driver requires a Xen hypervisor that supports vector callbacks,
VCPUOP hypercalls, and reports that it has a "safe PV clock".

New timer driver:
Submitted by: will
Sponsored by: Spectra Logic Corporation

PV port to new driver, and bug fixes:
Submitted by: Roger Pau Monné
Sponsored by: Citrix Systems R&D

sys/dev/xen/timer/timer.c:
- Register a PV timer device driver which (currently)
  implements device_{identify,probe,attach} and stubs
  device_detach.  The detach routine requires functionality
  not provided by timecounters(4).  The suspend and resume
  routines need additional work (due to Xen requiring that
  the hypercalls be executed on the target VCPU), and aren't
  needed for our purposes.

- Make sure there can only be one device instance of this
  driver, and that it only registers one eventtimers(4) and
  one timecounters(4) device interface.  Make both interfaces
  use PCPU data as needed.

- Match, with a few style cleanups & API differences, the
  Xen versions of the "fetch time" functions.

- Document the magic scale_delta() better for the i386 version.

- When registering the event timer, bind a separate event
  channel for the timer VIRQ to the device's event timer
  interrupt handler for each active VCPU.  Describe each
  interrupt as "xen_et:c%d", so they can be identified per
  CPU in "vmstat -i" or "show intrcnt" in KDB.

- When scheduling a timer into the hypervisor, try up to
  60 times if the hypervisor rejects the time as being in
  the past.  In the common case, this retry shouldn't happen,
  and if it does, it should only happen once.  This is
  because the event timer advertises a minimum period of
  100usec, which is only less than the usual hypercall round
  trip time about 1 out of every 100 tries.  (Unlike other
  similar drivers, this one actually checks whether the
  hypervisor accepted the singleshot timer set hypercall.)

- Implement a RTC PV clock based on the hypervisor wallclock.

sys/conf/files:
- Add dev/xen/timer/timer.c if the kernel configuration
  includes either the XEN or XENHVM options.

sys/conf/files.i386:
sys/i386/include/xen/xen_clock_util.h:
sys/i386/xen/clock.c:
sys/i386/xen/xen_clock_util.c:
sys/i386/xen/mp_machdep.c:
sys/i386/xen/xen_rtc.c:
- Remove previous PV timer used in i386 XEN PV kernels, the
  new timer introduced in this change is used instead (so
  we share the same code between PVHVM and PV).

MFC after: 2 weeks

11 years ago'u_long' is consistently spelled 'unsigned long' in this file. Fix it.
Jung-uk Kim [Thu, 29 Aug 2013 23:09:34 +0000 (23:09 +0000)]
'u_long' is consistently spelled 'unsigned long' in this file.  Fix it.

11 years agoPartially revert r254880. The bitmap operations actually use long type now.
Jung-uk Kim [Thu, 29 Aug 2013 22:46:21 +0000 (22:46 +0000)]
Partially revert r254880.  The bitmap operations actually use long type now.

11 years agoBump up the default timeouts for move commands in the ch(4) driver
Kenneth D. Merry [Thu, 29 Aug 2013 21:25:27 +0000 (21:25 +0000)]
Bump up the default timeouts for move commands in the ch(4) driver
to 15 minutes, and 5 minutes for things like READ ELEMENT STATUS.

This is needed to account for the worst case scenarios on at least
some Spectra Logic tape libraries.

Sponsored by: Spectra Logic
MFC after: 3 days

11 years agoFix the incomplete conversion from atomic_t to long for test_bit().
Jung-uk Kim [Thu, 29 Aug 2013 20:51:12 +0000 (20:51 +0000)]
Fix the incomplete conversion from atomic_t to long for test_bit().

11 years agoClarify confusions between atomic_t and bitmap. Fix bitmap operations
Jung-uk Kim [Thu, 29 Aug 2013 20:40:45 +0000 (20:40 +0000)]
Clarify confusions between atomic_t and bitmap.  Fix bitmap operations
accordingly.

11 years agoImplement vector callback for PVHVM and unify event channel implementations
Justin T. Gibbs [Thu, 29 Aug 2013 19:52:18 +0000 (19:52 +0000)]
Implement vector callback for PVHVM and unify event channel implementations

Re-structure Xen HVM support so that:
- Xen is detected and hypercalls can be performed very
  early in system startup.
- Xen interrupt services are implemented using FreeBSD's native
  interrupt delivery infrastructure.
- the Xen interrupt service implementation is shared between PV
  and HVM guests.
- Xen interrupt handlers can optionally use a filter handler
  in order to avoid the overhead of dispatch to an interrupt
  thread.
- interrupt load can be distributed among all available CPUs.
- the overhead of accessing the emulated local and I/O apics
  on HVM is removed for event channel port events.
- a similar optimization can eventually, and fairly easily,
  be used to optimize MSI.

Early Xen detection, HVM refactoring, PVHVM interrupt infrastructure,
and misc Xen cleanups:

Sponsored by: Spectra Logic Corporation

Unification of PV & HVM interrupt infrastructure, bug fixes,
and misc Xen cleanups:

Submitted by: Roger Pau Monné
Sponsored by: Citrix Systems R&D

sys/x86/x86/local_apic.c:
sys/amd64/include/apicvar.h:
sys/i386/include/apicvar.h:
sys/amd64/amd64/apic_vector.S:
sys/i386/i386/apic_vector.s:
sys/amd64/amd64/machdep.c:
sys/i386/i386/machdep.c:
sys/i386/xen/exception.s:
sys/x86/include/segments.h:
Reserve IDT vector 0x93 for the Xen event channel upcall
interrupt handler.  On Hypervisors that support the direct
vector callback feature, we can request that this vector be
called directly by an injected HVM interrupt event, instead
of a simulated PCI interrupt on the Xen platform PCI device.
This avoids all of the overhead of dealing with the emulated
I/O APIC and local APIC.  It also means that the Hypervisor
can inject these events on any CPU, allowing upcalls for
different ports to be handled in parallel.

sys/amd64/amd64/mp_machdep.c:
sys/i386/i386/mp_machdep.c:
Map Xen per-vcpu area during AP startup.

sys/amd64/include/intr_machdep.h:
sys/i386/include/intr_machdep.h:
Increase the FreeBSD IRQ vector table to include space
for event channel interrupt sources.

sys/amd64/include/pcpu.h:
sys/i386/include/pcpu.h:
Remove Xen HVM per-cpu variable data.  These fields are now
allocated via the dynamic per-cpu scheme.  See xen_intr.c
for details.

sys/amd64/include/xen/hypercall.h:
sys/dev/xen/blkback/blkback.c:
sys/i386/include/xen/xenvar.h:
sys/i386/xen/clock.c:
sys/i386/xen/xen_machdep.c:
sys/xen/gnttab.c:
Prefer FreeBSD primatives to Linux ones in Xen support code.

sys/amd64/include/xen/xen-os.h:
sys/i386/include/xen/xen-os.h:
sys/xen/xen-os.h:
sys/dev/xen/balloon/balloon.c:
sys/dev/xen/blkback/blkback.c:
sys/dev/xen/blkfront/blkfront.c:
sys/dev/xen/console/xencons_ring.c:
sys/dev/xen/control/control.c:
sys/dev/xen/netback/netback.c:
sys/dev/xen/netfront/netfront.c:
sys/dev/xen/xenpci/xenpci.c:
sys/i386/i386/machdep.c:
sys/i386/include/pmap.h:
sys/i386/include/xen/xenfunc.h:
sys/i386/isa/npx.c:
sys/i386/xen/clock.c:
sys/i386/xen/mp_machdep.c:
sys/i386/xen/mptable.c:
sys/i386/xen/xen_clock_util.c:
sys/i386/xen/xen_machdep.c:
sys/i386/xen/xen_rtc.c:
sys/xen/evtchn/evtchn_dev.c:
sys/xen/features.c:
sys/xen/gnttab.c:
sys/xen/gnttab.h:
sys/xen/hvm.h:
sys/xen/xenbus/xenbus.c:
sys/xen/xenbus/xenbus_if.m:
sys/xen/xenbus/xenbusb_front.c:
sys/xen/xenbus/xenbusvar.h:
sys/xen/xenstore/xenstore.c:
sys/xen/xenstore/xenstore_dev.c:
sys/xen/xenstore/xenstorevar.h:
Pull common Xen OS support functions/settings into xen/xen-os.h.

sys/amd64/include/xen/xen-os.h:
sys/i386/include/xen/xen-os.h:
sys/xen/xen-os.h:
Remove constants, macros, and functions unused in FreeBSD's Xen
support.

sys/xen/xen-os.h:
sys/i386/xen/xen_machdep.c:
sys/x86/xen/hvm.c:
Introduce new functions xen_domain(), xen_pv_domain(), and
xen_hvm_domain().  These are used in favor of #ifdefs so that
FreeBSD can dynamically detect and adapt to the presence of
a hypervisor.  The goal is to have an HVM optimized GENERIC,
but more is necessary before this is possible.

sys/amd64/amd64/machdep.c:
sys/dev/xen/xenpci/xenpcivar.h:
sys/dev/xen/xenpci/xenpci.c:
sys/x86/xen/hvm.c:
sys/sys/kernel.h:
Refactor magic ioport, Hypercall table and Hypervisor shared
information page setup, and move it to a dedicated HVM support
module.

HVM mode initialization is now triggered during the
SI_SUB_HYPERVISOR phase of system startup.  This currently
occurs just after the kernel VM is fully setup which is
just enough infrastructure to allow the hypercall table
and shared info page to be properly mapped.

sys/xen/hvm.h:
sys/x86/xen/hvm.c:
Add definitions and a method for configuring Hypervisor event
delievery via a direct vector callback.

sys/amd64/include/xen/xen-os.h:
sys/x86/xen/hvm.c:

sys/conf/files:
sys/conf/files.amd64:
sys/conf/files.i386:
Adjust kernel build to reflect the refactoring of early
Xen startup code and Xen interrupt services.

sys/dev/xen/blkback/blkback.c:
sys/dev/xen/blkfront/blkfront.c:
sys/dev/xen/blkfront/block.h:
sys/dev/xen/control/control.c:
sys/dev/xen/evtchn/evtchn_dev.c:
sys/dev/xen/netback/netback.c:
sys/dev/xen/netfront/netfront.c:
sys/xen/xenstore/xenstore.c:
sys/xen/evtchn/evtchn_dev.c:
sys/dev/xen/console/console.c:
sys/dev/xen/console/xencons_ring.c
Adjust drivers to use new xen_intr_*() API.

sys/dev/xen/blkback/blkback.c:
Since blkback defers all event handling to a taskqueue,
convert this task queue to a "fast" taskqueue, and schedule
it via an interrupt filter.  This avoids an unnecessary
ithread context switch.

sys/xen/xenstore/xenstore.c:
The xenstore driver is MPSAFE.  Indicate as much when
registering its interrupt handler.

sys/xen/xenbus/xenbus.c:
sys/xen/xenbus/xenbusvar.h:
Remove unused event channel APIs.

sys/xen/evtchn.h:
Remove all kernel Xen interrupt service API definitions
from this file.  It is now only used for structure and
ioctl definitions related to the event channel userland
device driver.

Update the definitions in this file to match those from
NetBSD.  Implementing this interface will be necessary for
Dom0 support.

sys/xen/evtchn/evtchnvar.h:
Add a header file for implemenation internal APIs related
to managing event channels event delivery.  This is used
to allow, for example, the event channel userland device
driver to access low-level routines that typical kernel
consumers of event channel services should never access.

sys/xen/interface/event_channel.h:
sys/xen/xen_intr.h:
Standardize on the evtchn_port_t type for referring to
an event channel port id.  In order to prevent low-level
event channel APIs from leaking to kernel consumers who
should not have access to this data, the type is defined
twice: Once in the Xen provided event_channel.h, and again
in xen/xen_intr.h.  The double declaration is protected by
__XEN_EVTCHN_PORT_DEFINED__ to ensure it is never declared
twice within a given compilation unit.

sys/xen/xen_intr.h:
sys/xen/evtchn/evtchn.c:
sys/x86/xen/xen_intr.c:
sys/dev/xen/xenpci/evtchn.c:
sys/dev/xen/xenpci/xenpcivar.h:
New implementation of Xen interrupt services.  This is
similar in many respects to the i386 PV implementation with
the exception that events for bound to event channel ports
(i.e. not IPI, virtual IRQ, or physical IRQ) are further
optimized to avoid mask/unmask operations that aren't
necessary for these edge triggered events.

Stubs exist for supporting physical IRQ binding, but will
need additional work before this implementation can be
fully shared between PV and HVM.

sys/amd64/amd64/mp_machdep.c:
sys/i386/i386/mp_machdep.c:
sys/i386/xen/mp_machdep.c
sys/x86/xen/hvm.c:
Add support for placing vcpu_info into an arbritary memory
page instead of using HYPERVISOR_shared_info->vcpu_info.
This allows the creation of domains with more than 32 vcpus.

sys/i386/i386/machdep.c:
sys/i386/xen/clock.c:
sys/i386/xen/xen_machdep.c:
sys/i386/xen/exception.s:
Add support for new event channle implementation.

11 years ago- Remove test_and_set_bit() macro. It is unused since r255037.
Jung-uk Kim [Thu, 29 Aug 2013 19:47:52 +0000 (19:47 +0000)]
- Remove test_and_set_bit() macro.  It is unused since r255037.
- Relax atomic_read() and atomic_set() macros.  Linux does not require any
memory barrier.  Also, these macros may be even reordered or optimized away
according to the API documentation:

https://www.kernel.org/doc/Documentation/atomic_ops.txt

11 years agoConvert the if_lagg rwlock to an rmlock.
Adrian Chadd [Thu, 29 Aug 2013 19:35:14 +0000 (19:35 +0000)]
Convert the if_lagg rwlock to an rmlock.

We've been seeing lots of cache line contention (but not lock contention!)
in our workloads between the various TX and RX threads going on.

The write lock is only grabbed when configuration changes are made - which
are infrequent.

With this patch, the contention and cycles spent waiting for updates
disappear.

Sponsored by: Netflix, Inc.

11 years agoFix atomic operations on context_flag without altering semantics.
Jung-uk Kim [Thu, 29 Aug 2013 18:36:47 +0000 (18:36 +0000)]
Fix atomic operations on context_flag without altering semantics.

11 years agoAdd directories that is installed as part of bsdconfig.
Xin LI [Thu, 29 Aug 2013 17:45:13 +0000 (17:45 +0000)]
Add directories that is installed as part of bsdconfig.

These are included unconditionally for now because bsdconfig
is currently installed unconditionally.

This fixes 'make -j 17 installworld' caused by a race
condition.

MFC candidate.

11 years agoAdd a few missing language directories for /usr.
Xin LI [Thu, 29 Aug 2013 17:40:03 +0000 (17:40 +0000)]
Add a few missing language directories for /usr.

11 years agoUpdate to 2013-08-29 NetBSD libexecinfo snapshot
Ed Maste [Thu, 29 Aug 2013 16:57:55 +0000 (16:57 +0000)]
Update to 2013-08-29 NetBSD libexecinfo snapshot

This adds my patch to use the kern.proc.pathname sysctl instead of
relying on procfs(5).