imp [Mon, 25 Aug 2008 02:36:27 +0000 (02:36 +0000)]
Greatly expand the devices listed as being supported. This list was
taken from PR/121184 which was mechanically generated from similar
lists in the Linux ipaq driver. I then took the numbers we had in
usbdevs and filled in the right symbols and eliminated duplicates.
imp [Mon, 25 Aug 2008 02:05:04 +0000 (02:05 +0000)]
Update uipaq for FreeBSD's driver:
o List all devices FreeBSD supports (more on the way)
o Sort the list of supported devices
o Note this was introduced with FreeBSD 7.0
o Include the FreeBSD configuration synopsis
o Bump the man page date
o Put $FreeBSD$ where all the other usb man pages have it.
And add to build.
imp [Mon, 25 Aug 2008 01:51:40 +0000 (01:51 +0000)]
Bring in verbatim copy of NetBSD's uipaq.4 man page. This in turn was
copied from OpenBSD. I'll adjust the history section to reflect
FreeBSD's history, and attach it to the build later.
roberto [Sun, 24 Aug 2008 23:28:56 +0000 (23:28 +0000)]
Use the correct systime.c file instead of the "simulation mode" one.
Should fix the current weirdness in ntpd/ntpdate where the current system
time is not read/updated.
Submitted by: naddy
MFC after: 2 weeks
Pointy hat to: me
rwatson [Sun, 24 Aug 2008 21:20:35 +0000 (21:20 +0000)]
When MPSAFE ttys were merged, a new BSM audit event identifier was
allocated for posix_openpt(2). Unfortunately, that identifier
conflicts with other events already allocated to other systems in
OpenBSM. Assign a new globally unique identifier and conform
better to the AUE_ event naming scheme.
This is a stopgap until a new OpenBSM import is done with the
correct identifier, so we'll maintain this as a local diff in svn
until then.
Discussed with: ed
Obtained from: TrustedBSD Project
marius [Sun, 24 Aug 2008 20:53:36 +0000 (20:53 +0000)]
There's a race in kmem(4) between checking whether a page is resident
in the kernel and copying it out, causing a panic when faulting on a
nofault entry. Handle this case gracefully by letting the kernel copy
functions return EFAULT instead. As such this change addresses the
same problem as r154721 does for i386.
imp [Sun, 24 Aug 2008 20:40:00 +0000 (20:40 +0000)]
MFp4:
Remove all the OtherBSD ifdefs. They are very out of date at this
point. OtherBSD doesn't use this file verbatim, and they don't have
FreeBSD ifdefs in their code.
csjp [Sun, 24 Aug 2008 20:16:44 +0000 (20:16 +0000)]
Remove worrying printf warning on bootup when processing vnodes which
have NULL mount-points. This is the case for special vnodes, such as the
one used in nameiinit() which is used for crossing mount points in lookup()
to avoid lock ordering issues.
marius [Sun, 24 Aug 2008 20:02:18 +0000 (20:02 +0000)]
MFamd64: r133413
In syscall, always make a copy of parameters from trapframe, this
becauses some syscalls using set_mcontext can sneakily change
parameters and later when those syscalls references parameters,
they will wrongly use register values in mcontext_t.
ed [Sun, 24 Aug 2008 19:50:57 +0000 (19:50 +0000)]
Make syscons(4) use ttyv0 instead of consolectl as its primary window.
When I was hacking on uart(4) to make it work with the MPSAFE TTY layer,
I noticed there was a difference between the way syscons and uart work
with respect to consoles:
- The uart(4) driver sets cn_name to the corresponding ttyu%r node,
which means init(8) (which opens /dev/console) will have its output
redirected to /dev/ttyu%r. After /etc/rc is done, it can spawn a getty
on that device node as well.
- Syscons used a little different approach. Apart from the /dev/ttyv%r
nodes, it creates a /dev/consolectl node. This device node is used by
moused and others to deliver their data, but for some reason it also
acts as a TTY, which shares its stat structure with ttyv0. This device
node is used as a console (run conscontrol).
There are a couple advantages of this approach:
- Because we use two different TTY's to represent the 0th syscons
window, we allocate two sets of TTY buffers. Even if you don't use
/dev/consolectl after the system has booted (systems that don't run
moused), it seems the buffers are still allocated.
- We have to apply an evil hack to redirect input to /dev/consolectl.
Because each window (stat) is associated not associated with one TTY,
syscons solves this by redirecting all input to closed TTY's to
consolectl.
This means that opening /dev/ttyv0 while in single user mode will
probably cause strange things to happen with respect to keyboard input
redirection.
The first patch that I discussed with philip@ turned consolectl into a
symlink to ttyv0, but this was not a good idea, because in theory we
would want consolectl to be a simple device node, which contains all the
`privileged' ioctl()'s. Apart from that, it didn't work, because each
time /dev/ttyv0 got revoked, moused also lost its descriptor to deliver
input, which meant you had to plug out/in your mouse to make it work
again. This version just leaves the consolectl device the way it is. It
can still be used to write output to ttyv0, but it can no longer receive
any input.
In my opinion this patch is not a complete solution, but it's already a
step in the good direction. It would allow us to turn consolectl into a
special (non-TTY) device node in the far future. It shaves off 15 KB of
wasted TTY buffer space.
kib [Sun, 24 Aug 2008 17:24:22 +0000 (17:24 +0000)]
Revert the r167541: "Remove unneeded getinoquota() call in the
ufs_access()." The call to getinoquota in ufs_access() serves the
purpose of instantiating inode dquot from the vn_open(). Since quotas
are accounted only for the inodes with already attached dquot, removal
of the call prevented opened inodes from participation in the quota
calculations.
Since ufs_access() may be called with the vnode being only shared
locked, upgrade (and then downgrade) vnode lock if calling
getinoquota().
Reported by: simon at optinet com
In collaboration with: pho
MFC after: 1 week
ed [Sun, 24 Aug 2008 15:20:44 +0000 (15:20 +0000)]
Make sysmouse(4) use its own locks, instead of using Giant.
When I changed syscons(4) to work with the MPSAFE TTY code, I just
locked all device nodes down using the compatibility feature that allows
you to override the TTY's lock (Giant in this case). Upon closer
inspection, it seems sysmouse(4) only has two internal variables that
need locking: mouse_level and mouse_status.
I haven't done any performance benchmarks on this, though I think it
won't have any dramatic improvements on the system. It is good to get
rid of Giant here, because the third argument of tty_alloc() has only
been added to ease migration to MPSAFE TTY. It should not be used when
not needed.
While there, remove SC_MOUSE, which is a leftover from the MPSAFE TTY
import.
marius [Sun, 24 Aug 2008 15:05:46 +0000 (15:05 +0000)]
The PCI specifications don't explain the details on how to calculate
the latency based on the Min_Gnt register so use the algorithm found
in OpenSolaris as they probably know how to interpret the value Sun
puts into these registers (previously, the latency calculated for
66MHz was most likely wrong) and for bridges additionally set up the
secondary latency register. Also set up the bridge control register
the way it's done in OpenSolaris. As the latency register don't apply
to PCI-Express and the bridge control setup wasn't tested on sun4v
(besides most likely not being needed), expand the #ifndef SUN4V
accordingly.
yar [Sun, 24 Aug 2008 13:47:53 +0000 (13:47 +0000)]
Explicitly tell that one needs to start a context address with a
backslash if he/she wants to use a non-traditional delimiter, i.e.,
anything other than a slash. That is, /abc/ works as is, but xabcx
needs to be spelled as \xabcx.
ed [Sun, 24 Aug 2008 10:01:22 +0000 (10:01 +0000)]
Remove the now unneeded pt_chown utility.
Before we had a posix_openpt() that allocated PTY's with proper
permissions in place, we used this set-uid utility to change the
ownership of PTY slave devices to the real user ID of the process. This
utility was used to implement grantpt().
In my first designs of the MPSAFE TTY layer, I replaced this by adding
an ioctl() called TIOCGRANTPT, which was used to change the ownership.
I left the pt_chown utility, because older C libraries needed it to work
properly.
After some discussions back in June I changed the PTY code to set
permissions properly upon creation. Fortunately the previous grantpt()
implementation changed permissions by hand when pt_chown is not
installed, which always succeeds. This means grantpt() still works
properly, even though the set-uid utility is missing.
I've done tests with FreeBSD 5.2.1, FreeBSD 6.3 and FreeBSD 7.0 jails.
All of them still work if I remove pt_chown.
ed [Sun, 24 Aug 2008 08:41:29 +0000 (08:41 +0000)]
Restore 256 pty(4) entries.
As discussed with Robert Watson on the src-committers list, it is safer
to keep at least some pty(4) entries in /etc/ttys, for applications that
roll their own PTY allocation routine and only search for BSD-style
PTY's.
This means we've now just toggled the amount of entries for pts(4) and
pty(4).
kientzle [Sun, 24 Aug 2008 06:21:00 +0000 (06:21 +0000)]
Update the total archive byte counters when writing entries to disk using
archive_write_disk.
Update cpio to use this to emit block counts in -p mode.
Update cpio tests to verify these block counts.
kientzle [Sun, 24 Aug 2008 05:42:22 +0000 (05:42 +0000)]
Fail copying path/.. only if SECURE_NODOTDOT was specified.
Since we already warn for any '..' elements in that case,
the extra "lastdotdot" tracking turns out to be unnecessary.
kientzle [Sun, 24 Aug 2008 05:01:01 +0000 (05:01 +0000)]
Fix the cpio bug tested for by r182092 of usr.bin/cpio/test.
Since various 'find' incantations can emit container directories
in various orders, we cannot refuse to update a dir because it's
apparently the same age.
kientzle [Sun, 24 Aug 2008 04:58:22 +0000 (04:58 +0000)]
Test for a bug reported by Bernd Walter: In passthrough mode,
copying "dir/file" and then copying "dir" results in
"File on disk is not older; skipping" for the "dir" because
it was implicitly created by "dir/file." Among other sins,
this means that "dir" ends up with the wrong permissions
and ownership.
This is actually a libarchive bug; fix is forthcoming.
imp [Sun, 24 Aug 2008 00:22:42 +0000 (00:22 +0000)]
Some PC Card variants of the 82365 don't seem to like setting the IRQ
number in the irq register. While there are other issues with these
variants, avoiding writing to it helps interrupt generation on at
least one card, and doesn't hurt on the others. Flag ISA attachment
as needing INT_NO_REG written, and don't update the PC Card attachment
(which will have the effect of not touching it for PC Cards).
Document this in a comment, and tweak one or two formatting nits while
I'm here.
jhb [Sat, 23 Aug 2008 21:00:40 +0000 (21:00 +0000)]
Add a very simple dpms(4) driver that uses the VESA BIOS DPMS calls to
turn off the external display during suspend and restore it to its
original state on resume.
rnoland [Sat, 23 Aug 2008 20:59:12 +0000 (20:59 +0000)]
Update drm kernel drivers.
This is a sync to mesa/drm pre-gem, with a few fixes on top of that.
It also contains one local patch supplied by kib@ that I can't apply to
git.master shared code.
marius [Sat, 23 Aug 2008 20:57:48 +0000 (20:57 +0000)]
- Use m_collapse(9) instead of m_defrag(9) if possible. This results
in a noticeable reduction in system time spent.
- If bus_dmamap_load_mbuf_sg(9) fails with EFBIG and we already have
defragmented the mbuf chain, don't bother to defragment and load it
a second time just yet as it's likely to fail again anyway.
marius [Sat, 23 Aug 2008 20:53:27 +0000 (20:53 +0000)]
Update the comment regarding the workaround for the BlackBird
TICK_COMPARE bug and the instruction alignment used for it based
on information found in the OpenSolaris source.
ed [Sat, 23 Aug 2008 16:03:00 +0000 (16:03 +0000)]
Allow the user to suppress the rate-limited pty(4) warning.
The pty(4) driver raises up to warnings when an old BSD-style PTY is
created. The reason why I added this warning, was to make it easier to
spot applications that allocate BSD-style PTY's, while they should just
use openpty() or posix_openpt().
Add a sysctl, which allows you to override the number of remaining
messages, making it possible to suppress the warnings.
imp [Sat, 23 Aug 2008 15:50:18 +0000 (15:50 +0000)]
Move the code that looks for the companion phy to a subroutine to make
sure we get the error handling right in both places. This also
simplifies the code somewhat.
imp [Sat, 23 Aug 2008 15:34:31 +0000 (15:34 +0000)]
There actually were bugs in the original handling that I missed last
night.
Free the children after each pci bus that is searched. Otherwise we
leak them. With free in the new place, we also have to free children
before going to done when we find the device we're looking for.
Also, if we can't get the children of a device, just ignore that bus.
imp [Sat, 23 Aug 2008 15:29:28 +0000 (15:29 +0000)]
It turns out that my analysis of the error handling here was wrong.
When there's an error, we don't want to free the children, since it
will be stack garbage. While we did fail to dereference it by setting
devs to 0, we didn't fail to call free. We never failed to fail, it
was the easiest thing to do.
rwatson [Sat, 23 Aug 2008 15:26:36 +0000 (15:26 +0000)]
Introduce two related changes to the TrustedBSD MAC Framework:
(1) Abstract interpreter vnode labeling in execve(2) and mac_execve(2)
so that the general exec code isn't aware of the details of
allocating, copying, and freeing labels, rather, simply passes in
a void pointer to start and stop functions that will be used by
the framework. This change will be MFC'd.
(2) Introduce a new flags field to the MAC_POLICY_SET(9) interface
allowing policies to declare which types of objects require label
allocation, initialization, and destruction, and define a set of
flags covering various supported object types (MPC_OBJECT_PROC,
MPC_OBJECT_VNODE, MPC_OBJECT_INPCB, ...). This change reduces the
overhead of compiling the MAC Framework into the kernel if policies
aren't loaded, or if policies require labels on only a small number
or even no object types. Each time a policy is loaded or unloaded,
we recalculate a mask of labeled object types across all policies
present in the system. Eliminate MAC_ALWAYS_LABEL_MBUF option as it
is no longer required.
jhb [Sat, 23 Aug 2008 15:13:39 +0000 (15:13 +0000)]
Fix a race condition with concurrent LOOKUP namecache operations for a vnode
not in the namecache when shared lookups are enabled (vfs.lookup_shared=1,
it is currently off by default) and the filesystem supports shared lookups
(e.g. NFS client). Specifically, if multiple concurrent LOOKUPs both miss
in the name cache in parallel, each of the lookups may each end up adding an
entry to the namecache resulting in duplicate entries in the namecache
for the same pathname. A subsequent removal of the mapping of that
pathname to that vnode (via remove or rename) would only evict one of the
entries from the name cache. As a result, subseqent lookups for that
pathname would still return the old vnode.
This race was observed with shared lookups over NFS where a file was updated
by writing a new file out to a temporary file name and then renaming that
temporary file to the "real" file to effect atomic updates of a file. Other
processes on the same client that were periodically reading the file would
occasionally receive an ESTALE error from open(2) because the VOP_GETATTR()
in nfs_open() would receive that error when given the stale vnode.
The fix here is to check for duplicates in cache_enter() and just return
if an entry for this same directory and leaf file name for this vnode is
already in the cache. The check for duplicates is done by walking the
per-vnode list of name cache entries. It is expected that this list should
be very small in the common case (usually 0 or 1 entries during a
cache_enter() since most files only have 1 "leaf" name).
marius [Sat, 23 Aug 2008 15:03:26 +0000 (15:03 +0000)]
- Restore the behavior of enabling the MII buffer for an internal
PHY only and not also in the case of an external PHY currently
doing full duplex, which accidentally got broken in r172334.
It's still not clear to me why we need to enable the buffer for
an internal PHY though.
- Count excess and late collisions as output errors. [1]
- Count receive errors as input errors. [1]
rwatson [Sat, 23 Aug 2008 14:39:01 +0000 (14:39 +0000)]
When getaudit(2) is unable to fit the terminal IPv6 address into the
space provided by its argument structure, return EOVERFLOW instead of
E2BIG. The latter is documented in Solaris's man page, but the
former is implemented. In either case, the caller should use
getaudit_addr(2) to return the IPv6 address.
Submitted by: sson
Obtained from: Apple, Inc.
MFC after: 3 days
ed [Sat, 23 Aug 2008 14:36:39 +0000 (14:36 +0000)]
Remove old BSD-style entries from /etc/ttys and increase pts(4) to 512.
Because we now use pts(4)-style PTY's exclusively, there is no use for
these entries in /etc/ttys. Right now the pts(4) entries only go from 0
to 255. Because we're going to touch these files anyway, increase the
number to 511.
marius [Sat, 23 Aug 2008 14:28:44 +0000 (14:28 +0000)]
Remove clkbrd(4) as a separate device and compile it solely based
on the presence of fhc(4) instead; we by far don't support all of
the functionality provide by the clock board but in general it's
an integral part of FireHose-based systems which shouldn't be
possible to omit.
bz [Sat, 23 Aug 2008 14:22:12 +0000 (14:22 +0000)]
Cache the cred locally in _syncache_add() while holding the locks, so
we can be sure that it's valid.
In case we abort early free it again else put it into the syncache.
We need the cred in the syncache to be able to restrict what will be
exportet by the sysctl helper function syncache_pcblist() (to netstat)
within jails.
marius [Sat, 23 Aug 2008 14:17:00 +0000 (14:17 +0000)]
- Add kbdmux(4); since sunkbd(4) was tought to emulate atkbd(4) like
ukbd(4) does and that emulation was enabled by default, all three of
them work together with kbdmux(4) out of the box just fine.
- Fix some whitespace bugs.
When my earlier MPSAFE TTY prototypes still implemented line
disciplines, we needed a mechanism to abort read()'s on PTY master
devices when inside the line discipline. Because this is no longer the
case, these checks have become unneeded.
ed [Sat, 23 Aug 2008 13:28:55 +0000 (13:28 +0000)]
Make stty(1) use tab0 and tab3 to handle tab completion.
After the MPSAFE TTY import, we have support for the TAB0 and TAB3 flags
to handle tab expansion, while we only used to support OXTABS. Switch
stty(1) to use tab0 and tab3 to print whether tab expansion is turned on
or off. Implement the oxtabs and tabs switches by setting the
appropriate TABx value.
Even though POSIX only lists this as being XSI, we'd better follow it.
jhb [Sat, 23 Aug 2008 12:53:42 +0000 (12:53 +0000)]
If we are unable to obtain a frequency list from either ACPI or the static
tables, then attempt to build a simple list containing just the high and
low frequencies based on the current CPU frequency calculated during boot
and the contents of the MSR.
jhb [Sat, 23 Aug 2008 12:35:43 +0000 (12:35 +0000)]
Adjust the handling the various timer frequencies when using the lapic
timer. Previously, the various divisors were fixed which meant that while
it gave somewhat reasonable stathz, etc. at hz=1000, it went off the rails
with any other hz value. With these changes, we now pick a lapic timer hz
based on the value of hz. If hz is >= 1500, then the lapic timer runs at
hz. If 1500 hz >= 750, we run the lapic timer at hz * 2. If hz < 750, we
run at hz * 4. We compute a divider at runtime to make stathz run as close
to 128 as we can since stathz really wants to be run at something close to
that frequency. Profiling just runs on every clock tick. So some examples:
With hz = 100, the lapic timer now runs at 400 instead of 2000. stathz
will be 133, and profhz = 400. With hz = 1000 (default), the lapic timer
is still at 2000 (as it is now), stathz is at 133 (as it is now), and
profhz will be 2000 (previously 666).
imp [Sat, 23 Aug 2008 07:23:52 +0000 (07:23 +0000)]
Cope with errors from device_get_children(). These errors can happen
only in low memory situations, so the error fork of these fixes is
lightly tested, but they should do the least-wrong thing...
nwhitehorn [Sat, 23 Aug 2008 01:35:36 +0000 (01:35 +0000)]
Allow the MD UMA allocator to use VM routines like kmem_*(). Existing code requires MD allocator to be available early in the boot process, before the VM is fully available. This defines a new VM define (UMA_MD_SMALL_ALLOC_NEEDS_VM) that allows an MD UMA small allocator to become available at the same time as the default UMA allocator.
rodrigc [Sat, 23 Aug 2008 01:16:09 +0000 (01:16 +0000)]
In nmount(), when we see the "force" option,
set the MNT_FORCE flag, but do not persist "force"
in the options list, since it is a command, not a persistent property
of a mount.
Similarly, when we see "reload", set MNT_RELOAD,
but delete "reload" from the options list.
ed [Fri, 22 Aug 2008 21:27:37 +0000 (21:27 +0000)]
Fix two small bugs in tcsetattr().
- According to POSIX, tcsetattr() must not fail when any of the bits in
the structure are unsupported, but it must leave the unsupported flags
alone.
- The CIGNORE flag (set by TCSASOFT, extension) was not cleared from
c_cflag, which means using it would cause it to be applied during its
entire lifespan. Eventually make sure we clear the flag.
I don't really like CIGNORE, but I think we must keep it alive right
now. With our new TTY layer, we don't actually need this mechanism,
because if you leave c_cflag, c_ispeed and c_ospeed alone, we won't make
a call into the device driver anyway.