Nick Hibma [Tue, 27 Mar 2007 21:03:37 +0000 (21:03 +0000)]
Revisit the watchdogs: Resetting the error to EINVAL after failing to set the
watchdog might hide the succesful arming of an earlier one. Accept that on
failing to arm any watchdog (because of non-supported timeouts) EOPNOTSUPP is
returned instead of the more appropriate EINVAL.
John Baldwin [Tue, 27 Mar 2007 16:51:34 +0000 (16:51 +0000)]
Align 'struct thread' on 16 byte boundaries so that the lower 4 bits are
always 0. Previously we aligned threads on a minimum of 8-byte boundaries.
Note: This changes the uma zone to no longer cache align threads. We
really want the uma zone to do align threads to MAX(16, cache line size)
but there currently isn't a good way to express that to uma.
Andrew Gallatin [Tue, 27 Mar 2007 15:55:32 +0000 (15:55 +0000)]
Fix a bug which could lead to receive side lockup when WC is disabled.
When submitting rx buffers and not using WC fifo, always replace the
invalid DMA address with the real one, otherwise allocation failures
could lead to the invalid DMA address being given to the NIC, and
that would cause the receive side to lockup.
Yaroslav Tykhiy [Tue, 27 Mar 2007 09:59:15 +0000 (09:59 +0000)]
In account management, verify whether the account has been locked
with `pw lock', so that it's impossible to log into a locked account
using an alternative authentication mechanism, such as an ssh key.
This change affects only accounts locked with pw(8), i.e., having a
`*LOCKED*' prefix in their password hash field, so people still can
use a different pattern to disable password authentication only.
Mention all account management criteria in the manpage.
Alan Cox [Tue, 27 Mar 2007 08:55:17 +0000 (08:55 +0000)]
Prevent a race between vm_object_collapse() and vm_object_split() from
causing a crash.
Suppose that we have two objects, obj and backing_obj, where
backing_obj is obj's backing object. Further, suppose that
backing_obj has a reference count of two. One being the reference
held by obj and the other by a map entry. Now, suppose that the map
entry is deallocated and its reference removed by
vm_object_deallocate(). vm_object_deallocate() recognizes that the
only remaining reference is from a shadow object, obj, and calls
vm_object_collapse() on obj. vm_object_collapse() executes
if (backing_object->ref_count == 1) {
/*
* If there is exactly one reference to the backing
* object, we can collapse it into the parent.
*/
vm_object_backing_scan(object, OBSC_COLLAPSE_WAIT);
if (op & OBSC_COLLAPSE_WAIT) {
vm_object_set_flag(backing_object, OBJ_DEAD);
}
Finally, suppose that either vm_object_backing_scan() or
vm_object_collapse() sleeps releasing its locks. At this instant,
another thread executes vm_object_split(). It crashes in
vm_object_reference_locked() on the assertion that the object is not
dead. If, however, assertions are not enabled, it crashes much later,
after the object has been recycled, in vm_object_deallocate() because
the shadow count and shadow list are inconsistent.
Joseph Koshy [Tue, 27 Mar 2007 04:40:57 +0000 (04:40 +0000)]
Bug fixes to ar(1) archive handling:
- Correctly retrieve the initial (special) members of an archive after
an archive descriptor is rewound using elf_rand(SARMAG).
- Do not strip trailing white space from the 'raw' names retrieved
using elf_getarhdr().
Reported by: "Hyo geol, Lee" <hyogeollee at gmail dot com>
Lukas Ertl [Mon, 26 Mar 2007 23:29:20 +0000 (23:29 +0000)]
Introduce the new option -M to allow to set the permissions of
the user's newly created home directory. If omitted, it's derived
from the current umask.
Thomas Quinot [Mon, 26 Mar 2007 21:56:13 +0000 (21:56 +0000)]
Fix setting of serial port speed. A junk value was passed in AX when
bioscom is called to set up serial port parameters because COMSPEED
was treated as an address instead of an immediate value, causing
serial port parameters to never be set.
Kris Kennaway [Mon, 26 Mar 2007 21:45:44 +0000 (21:45 +0000)]
Remove unnecessary giant acquisition around panic in #ifdef DIAGNOSTIC
code.
# There is some question about whether this code is even relevant any
# longer (it dates back to prehistoric times, i.e. present in r1.1),
# especially on amd64.
John Baldwin [Mon, 26 Mar 2007 20:18:52 +0000 (20:18 +0000)]
Change the VPD code to read the VPD data on-demand when a driver asks for
it via pci_get_vpd_*() rather than always reading it for each device during
boot. I've left the tunable so that it can still be turned off if a device
driver causes a lockup via a query to a broken device, but devices whose
drivers do not use VPD (the vast majority) should no longer result in
lockups during boot, and most folks should not need to tweak the tunable
now.
Nate Lawson [Mon, 26 Mar 2007 19:38:28 +0000 (19:38 +0000)]
Use a unique name for each mutex now that acpi-ca is creating more than
one (hardware & global lock). This should address witness complaints that
a duplicate mutex is being acquired. Be sure to free the mutex to fix a
potential memory leak.
Nate Lawson [Mon, 26 Mar 2007 18:03:29 +0000 (18:03 +0000)]
Add an interface for drivers to be notified of changes to CPU frequency.
cpufreq_pre_change is called before the change, giving each driver a chance
to revoke the change. cpufreq_post_change provides the results of the
change (success or failure). cpufreq_levels_changed gives the unit number
of the cpufreq device whose number of available levels has changed. Hook
in all the drivers I could find that needed it.
* TSC: update TSC frequency value. When the available levels change, take the
highest possible level and notify the timecounter set_cputicker() of that
freq. This gets rid of the "calcru: runtime went backwards" messages.
* identcpu: updates the sysctl hw.clockrate value
* Profiling: if profiling is active when the clock changes, let the user
know the results may be inaccurate.
John Baldwin [Mon, 26 Mar 2007 15:14:58 +0000 (15:14 +0000)]
Initialize vfslocked to 0 before nfsm_srvmtofh() so that the variable is
not used uninitialized in 'nfsmout' if nfsm_srvmtofh() gets an internal
error.
Robert Watson [Mon, 26 Mar 2007 08:59:03 +0000 (08:59 +0000)]
Complete removal of uipc_socket2.c by moving the last few functions to
other C files:
- Move sbcreatecontrol() and sbtoxsockbuf() to uipc_sockbuf.c. While
sbcreatecontrol() is really an mbuf allocation routine, it does its work
with awareness of the layout of socket buffer memory.
- Move pru_*() protocol switch stubs to uipc_socket.c where the non-stub
versions of several of these functions live. Likewise, move socket state
transition calls (soisconnecting(), etc) to uipc_socket.c. Moveo
sodupsockaddr() and sotoxsocket().
Yaroslav Tykhiy [Mon, 26 Mar 2007 08:58:22 +0000 (08:58 +0000)]
We no longer embed ifnet in softc, and the pointer to ifnet
doesn't need to be first in softc now. (It was the whole
ifnet structure itself that needed to be first in the good
old days.) Fix the respective comment accordingly.
Add xrefs to ifnet(9) in some other comments while I'm here.
Yaroslav Tykhiy [Mon, 26 Mar 2007 04:50:06 +0000 (04:50 +0000)]
Introduce a new toy interface, edsc(4). It's a discard interface
imitating an Ethernet device, so vlan(4) and if_bridge(4) can be
attached to it for testing and benchmarking purposes. Its source
can be an introduction to the anatomy of a network interface driver
due to its simplicity as well as to a bunch of comments in it.
(The rest of needed changes were in my previous commit, which got
interrupted in the middle. Alas, CVS commits are not atomic.)
Yaroslav Tykhiy [Mon, 26 Mar 2007 04:39:18 +0000 (04:39 +0000)]
Introduce a new toy interface, edsc(4). It's a discard interface
imitating an Ethernet device, so vlan(4) and if_bridge(4) can be
attached to it for testing and benchmarking purposes. Its source
can be an introduction to the anatomy of a network interface driver
due to its simplicity as well as to a bunch of comments in it.
Andre Oppermann [Sun, 25 Mar 2007 23:27:26 +0000 (23:27 +0000)]
In tcp_sack_doack() remove too tight KASSERT() added in last revision. This
function may be called without any TCP SACK option blocks present. Protect
iteration over SACK option blocks by checking for SACK options present flag
first.
Robert Watson [Sun, 25 Mar 2007 21:49:50 +0000 (21:49 +0000)]
Replace a comment about RSVP/mrouting with a different but similar comment
explaining that some more locking is needed. The routing pieces are done,
but there is an interlocking issue between optionally compiled code and
mandatory code.
Robert Watson [Sun, 25 Mar 2007 21:44:24 +0000 (21:44 +0000)]
Replace GIANT_REQUIRED's present for socket locking with NET_LOCK_GIANT().
If/when someone does the necessary MPSAFEty locking for the NFSv4 client,
the socket code is generally MPSAFE now.
Alan Cox [Sun, 25 Mar 2007 19:33:40 +0000 (19:33 +0000)]
Two small changes to vm_map_pmap_enter():
1) Eliminate an unnecessary check for fictitious pages. Specifically,
only device-backed objects contain fictitious pages and the object is
not device-backed.
2) Change the types of "psize" and "tmpidx" to vm_pindex_t in order to
prevent possible wrap around with extremely large maps and objects,
respectively. Observed by: tegge (last summer)
Jason Evans [Sat, 24 Mar 2007 20:44:06 +0000 (20:44 +0000)]
Fix some subtle bugs for posix_memalign() having to do with integer
rounding and overflow. Carefully document what the various overflow
tests actually detect.
The bugs mostly canceled out, such that the worst possible failure
cases resulted in non-fatal over-allocations.
Yaroslav Tykhiy [Sat, 24 Mar 2007 20:26:54 +0000 (20:26 +0000)]
Back out rev. 1.129 because it breaks the practice of auto-loading
hardware drivers. Unlike pseudo-device drivers, which just attach
to the cloning framework and wait for "ifconfig create", h/w drivers
create interfaces for installed cards as soon as loaded. The issue
of devd(8) involuntarily reloading modules should be dealt with in a
different way.
Alan Cox [Sat, 24 Mar 2007 19:53:22 +0000 (19:53 +0000)]
In order to satisfy ACPI's need for an identity mapping, modify the
temporary mapping created by locore so that the lowest two to four
megabytes can become a permanent identity mapping. This implementation
avoids any use of a large page mapping.
Warner Losh [Fri, 23 Mar 2007 23:47:59 +0000 (23:47 +0000)]
Default to booting off the SD card. It is more useful, and a full
FreeBSD/arm installworld install is only 170MB. The smallest SD card
I could find at the store today was 512MB (and it was only $10 after
rebate), with a 2GB card for as low as $25.00...
Now that the IIC stuff has been sorted out, include that as well.
Include hints for the icee 16kb 16-bit i2c device. It should include
info about the temperature sensor as well, but that driver isn't quite
ready.
Warner Losh [Fri, 23 Mar 2007 23:08:28 +0000 (23:08 +0000)]
MFp4: Make the iicbus fully hinted. We no longer automatically add
some devices (and not others). To get instances onto the iicbus, one
now needs hints or an identify routine. We also do not probe the bus
for devices because many iic devices cannot be safely probed (and when
they can, the probe order turns out to be somewhat difficult to get
right).
# I'm not 100% sure that the iicsmb removal is right. Please contact me if
# this causes difficulty.
Jason Evans [Fri, 23 Mar 2007 22:58:15 +0000 (22:58 +0000)]
Fix posix_memalign() for large objects. Now that runs are extents rather
than binary buddies, the alignment guarantees are weaker, which requires
a more complex aligned allocation algorithm, similar to that used for
alignment greater than the chunk size.
Warner Losh [Fri, 23 Mar 2007 22:57:24 +0000 (22:57 +0000)]
MFp4: A bunch of patches from myself and Tisco to improve the
robustness of IIC transactions when parts aren't present. This also
removes a bunch of debug. This also moves this driver to 7-1
addressing rather than 6-0 addressing, which is more inline with all
the other iic drivers in the tree. I've tested this for about a
million years on the systems at work.
Jung-uk Kim [Fri, 23 Mar 2007 22:26:01 +0000 (22:26 +0000)]
Update to FICL 3.03 (the last release before FICL4 rewrite).
The relevant changes for FreeBSD (excerpt from the release note):
* Newly implemented CORE EXT words: CASE, OF, ENDOF, and ENDCASE. Also
added FALLTHROUGH, which works like ENDOF but jumps to the instruction
just after the next OF.
* Bugfix: John-Hopkins locals syntax now accepts | and -- in the comment
(between the first -- and the }.)
* Bugfix: Changed vmGetWord0() to make Purify happier. The resulting
code is no slower, no larger, and slightly more robust.
Andre Oppermann [Fri, 23 Mar 2007 20:16:50 +0000 (20:16 +0000)]
Split tcp_input() into its two functional parts:
o tcp_input() now handles TCP segment sanity checks and preparations
including the INPCB lookup and syncache.
o tcp_do_segment() handles all data and ACK processing and is IPv4/v6
agnostic.
Change all KASSERT() messages to ("%s: ", __func__).
The changes in this commit are primarily of mechanical nature and no
functional changes besides the function split are made.
John Baldwin [Fri, 23 Mar 2007 17:15:07 +0000 (17:15 +0000)]
- Fix exca_(io|mem)_map() to return proper errno values.
- Change exca_activate_resource() to call BUS_ACTIVATE_RESOURCE() before
calling exca_(io|mem)_map() since the latter use rman_get_bus(tag|handle)
and the recent changes to nexus(4) mean that you need to activate a
resource before reading the bus tag and handle. This was true before,
but now the nexus(4) drivers on x86 and ia64 are more forceful about it.
Jason Evans [Fri, 23 Mar 2007 05:05:48 +0000 (05:05 +0000)]
Use extents rather than binary buddies to track free pages within
chunks. This allows runs to be any multiple of the page size. The
primary advantage is that large objects are no longer constrained to be
2^n pages, which can dramatically decrease internal fragmentation for
large objects. This also allows the sizes for runs that back small
objects to be more finely tuned.
Free runs are searched for linearly using the chunk page map (with the
help of some heuristic optimizations). This changes the allocation
policy from "first best fit" to "first fit". A prototype red-black tree
implementation for tracking free runs that implemented "first best fit"
did not cause a measurable speed or memory usage difference for
realistic chunk sizes (though of course it is possible to construct
benchmarks that favor one allocation policy over another).
Refine the handling of fullness constraints for small runs to be more
tunable.
Restructure the per chunk page map to contain only two fields per entry,
rather than four. Also, increase each entry from 4 to 8 bytes, since it
allows for 32-bit integers, without increasing the number of chunk
header pages.
Relax the maximum chunk size constraint. This is of no practical
interest; it is merely fallout from the chunk page map restructuring.
Revamp statistics gathering and reporting to be faster, clearer and more
informative. Statistics gathering is fast enough now to have little
to no impact on application speed, but it still requires approximately
two extra pages of memory per arena (per process). This memory overhead
may be acceptable for most systems, but we still need to leave
statistics gathering disabled by default in RELENG branches.
Rename NO_MALLOC_EXTRAS to MALLOC_PRODUCTION in order to make its intent
clearer (i.e. it should be defined in RELENG branches).