jhb [Wed, 21 Jun 2006 20:42:08 +0000 (20:42 +0000)]
Replace the kld_mtx mutex with a kld_sx sx lock and expand it's scope to
protect all linker-related data structures including the contents of
linker file objects and the any linker class data as well. Considering how
rarely the linker is used I just went with the simple solution of
single-threading the whole thing rather than expending a lot of effor on
something more fine-grained and complex. Giant is still explicitly
acquired while registering and deregistering sysctl's as well as in the
elf linker class while calling kmupetext(). The rest of the linker runs
without Giant unless it has to acquire Giant while loading files from a
non-MPSAFE filesystem.
yar [Wed, 21 Jun 2006 13:48:34 +0000 (13:48 +0000)]
Fix the VLAN_ARRAY case, mostly regarding improper use of atomic(9)
in place of conventional rw locking. Alas, atomic(9) can't buy us
lockless operation so easily.
flz [Wed, 21 Jun 2006 10:22:44 +0000 (10:22 +0000)]
Since INSTALLS_SHLIB has been superseded by USE_LDCONFIG in bsd.port.mk, I
expect to see quite a few files appearing in libdata/ldconfig directories.
This change avoids the screen to be filled with the names of those ldconfig
files and replace them by the actual non-default directories they contain.
Most of them will be ${PREFIX}/lib so, 'sort -u' will help reducing the
output.
yar [Wed, 21 Jun 2006 09:42:55 +0000 (09:42 +0000)]
Quite a number of rc.d scripts try to load kernel modules. Many
of them do that conditionally depending on kldstat. The code is
duplicated all over, but bugs can be uniqie.
To make the things more consistent, introduce a new rc.subr function,
load_kld, which takes care of loading a kernel module conditionally.
(Found this lying for a while in my p4 branch for various hacks.)
yar [Wed, 21 Jun 2006 07:29:44 +0000 (07:29 +0000)]
Track interface department events and detach vlans from
departing trunk so that we don't get into trouble later
by dereferencing a stale pointer to dead trunk's things.
ps [Tue, 20 Jun 2006 22:41:44 +0000 (22:41 +0000)]
Instead of using scsi probes to do device discovery, use the firmware
commands to grab the device listing. This resolves issues using
multiple volumes, where each volume was actually internally pointing
to target 0.
ps [Tue, 20 Jun 2006 21:06:05 +0000 (21:06 +0000)]
Cleanup dcmd firmware processing into a single function, mfi_dcmd_command
to avoid duplication and mistakes when setting up firmware commands
for submission.
jhb [Tue, 20 Jun 2006 20:59:55 +0000 (20:59 +0000)]
Add a new section in this file for functions that are only exported by the
linker for use in the linker class handlers. Move linker_add_class(),
linker_file_unload(), linker_load_dependencies(), and linker_make_file()
into this section.
jhb [Tue, 20 Jun 2006 20:54:13 +0000 (20:54 +0000)]
- Push Giant down into linker_reference_module().
- Add a new function linker_release_module() as a more intuitive complement
to linker_reference_module() that wraps linker_file_unload().
linker_release_module() can either take the module name and version info
passed to linker_reference_module() or it can accept the linker file
object returned by linker_reference_module().
alc [Tue, 20 Jun 2006 20:52:11 +0000 (20:52 +0000)]
Change get_pv_entry() such that the call to vm_page_alloc() specifies
VM_ALLOC_NORMAL instead of VM_ALLOC_SYSTEM when try is TRUE. In other
words, when get_pv_entry() is permitted to fail, it no longer tries as
hard to allocate a page.
Change pmap_enter_quick_locked() to fail rather than wait if it is
unable to allocate a page table page. This prevents a race between
pmap_enter_object() and the page daemon. Specifically, an inactive
page that is a successor to the page that was given to
pmap_enter_quick_locked() might become a cache page while
pmap_enter_quick_locked() waits and later pmap_enter_object() maps
the cache page violating the invariant that cache pages are never
mapped. Similarly, change
pmap_enter_quick_locked() to call pmap_try_insert_pv_entry() rather
than pmap_insert_entry(). Generally speaking,
pmap_enter_quick_locked() is used to create speculative mappings. So,
it should not try hard to allocate memory if free memory is scarce.
Add an assertion that the object containing m_start is locked in
pmap_enter_object(). Remove a similar assertion from
pmap_enter_quick_locked() because that function no longer accesses the
containing object.
jhb [Tue, 20 Jun 2006 20:41:15 +0000 (20:41 +0000)]
Make linker_find_file_by_name() and linker_find_file_by_id() static to
simplify linker locking. The only external consumers now use
linker_file_foreach().
netchild [Tue, 20 Jun 2006 20:38:44 +0000 (20:38 +0000)]
Switch to using the DUMMY infrastructure instead of UNIMPL for the new
syscalls. This way there will be a log message printed to the console
(this time for real).
Note: UNIMPL should be used for syscalls we do not implement ever, e.g.
syscalls to load linux kernel modules.
jhb [Tue, 20 Jun 2006 20:37:17 +0000 (20:37 +0000)]
- Add a new linker_file_foreach() function that walks the list of linker
file objects calling a user-specified predicate function on each object.
The iteration terminates either when the entire list has been iterated
over or the predicate function returns a non-zero value.
linker_file_foreach() returns the value returned by the last invocation
of the predicate function. It also accepts a void * context pointer that
is passed to the predicate function as well. Using an iterator function
avoids exposing linker internals to the rest of the kernel making locking
simpler.
- Use linker_file_foreach() instead of walking the list of linker files
manually to lookup ndis files in ndis(4).
- Use linker_file_foreach() to implement linker_hwpmc_list_objects().
imp [Tue, 20 Jun 2006 20:13:40 +0000 (20:13 +0000)]
Probe the memory size of the board better. Look at the bus width,
number of banks, rows and columns the SDRAMC is programmed to access
to determine the RAM size for the board, rather than hard-wiring it to
be 32MB. My company's board with 64MB now probes correctly, as does
the KB9202 with only 32MB. This means that to detect the right memory
size, our boot loader must correctly initialize these values. This is
a fairly safe assumption because the boot loader has to initialize
SDRAM already, and it isn't really possible to change this register
after we've accessed SDRAM.
yar [Tue, 20 Jun 2006 12:44:21 +0000 (12:44 +0000)]
We no longer need to disable interrupts in MD trap machinery
when we're about to call kdb_trap() because the latter MI
function can disable interrupts by itself now.
Pointed out by: bde
X-MFC remark: depends on kern/subr_kdb.c#1.18
Sponsored by: RiNet (Cronyx Plus LLC)
gnn [Tue, 20 Jun 2006 12:36:40 +0000 (12:36 +0000)]
Properly cast the values of valsize (the size of the value passed in)
in setsockopt so that they can be compared correctly against negative
values. Passing in a negative value had a rather negative effect
on our socket code, making it impossible to open new sockets.
andre [Tue, 20 Jun 2006 08:11:30 +0000 (08:11 +0000)]
Allocate a zero'ed syncache hashtable. mtx_init() tests the supplied
memory location for already existing/initialized mutexes. With random
data in the memory location this fails (ie. after a soft reboot).
davidxu [Mon, 19 Jun 2006 22:36:01 +0000 (22:36 +0000)]
MFi386:
Use the method described in IA-32 Intel Architecture Software
Developer's Manual chapter 11.6.6 to get valid mxcsr bits,
use the mxcsr mask to clear invalid bits passed by user code.
mlaier [Mon, 19 Jun 2006 22:20:45 +0000 (22:20 +0000)]
Import interface groups from OpenBSD. This allows to group interfaces in
order to - for example - apply firewall rules to a whole group of
interfaces. This is required for importing pf from OpenBSD 3.9
Obtained from: OpenBSD (with changes)
Discussed on: -net (back in April)
yar [Mon, 19 Jun 2006 17:12:25 +0000 (17:12 +0000)]
There is a plenty of arch's out there where sizeof(size_t) != sizeof(int).
A field width in printf(3) must be int, so cast return value from strlen()
to the type.
Noticed by: Andrzej Tobola <ato iem pw edu pl>; tinderbox
Pointy hat to: yar
X-MFC with: the rest of the new asf code
dwmalone [Mon, 19 Jun 2006 12:33:52 +0000 (12:33 +0000)]
When we receive an out-of-window SYN for an "ESTABLISHED" connection,
ACK the SYN as required by RFC793, rather than ignoring it. NetBSD
have had a similar change since 1999.
davidxu [Mon, 19 Jun 2006 07:51:47 +0000 (07:51 +0000)]
Clear bit 22 in MSR IA32_MISC_ENABLE, according to Intel document,
when the bit 22 is set to 1, CPUID with EAX=0 returns a maximum
value in EAX[7..0] of 3, when set to 0(default), CPUID with EAX=0
returns the number corresponding to the maximum standard function
supported. On my machine, BIOS sets the bit to 1 to make it to be
compatible with old OS, this causes dual-core Pentium-D (two
physical cores) to be identified as hyperthreading (two logical
cores) by function mp_topology().
simon [Sun, 18 Jun 2006 22:02:22 +0000 (22:02 +0000)]
- Fail with an understandable error message if we cannot detect the
sector size, instead of later failing with an error about /boot/mbr
not being a multiple of the sector size (since we end up with an
assumed sector size of MAX_SEC_SIZE * 2).
- We query the sector size via an IOCTL anyway, so if that succeeds
use that instead of probing for it via read(2) calls. This fixes
the problem with fdisk failing to operate on at least graid3 and
md(4) devices on kernels with src/sys/geom/geom_dev.c before
rev. 1.90, due to fdisk failing to detect the sector size.
- When detecting the root device allow "/" characters in it, which
happens with e.g. gmirror devices.
simon [Sun, 18 Jun 2006 22:01:15 +0000 (22:01 +0000)]
In g_dev_strategy(), when failing an IO request with EINVAL due to
offset or request size which is not a multiple of the sector size, make
sure that the bio is set to indicate that no data has actually been
transferred.
The result of this is that the file offset is no longer incremented for
these requests. The fact that the file offset was incremented broke
fdisk(8)'s probing of sector size for non-512 byte sector sizes.
bmah [Sun, 18 Jun 2006 21:13:28 +0000 (21:13 +0000)]
Put several notes in the right place: Move an arp(8) note from kernel
to userland. Move all of the items in the Kernel contrib section to
the top-level contrib section.
All of the moved items are unchanged with respect to their actual
contents.
imp [Sun, 18 Jun 2006 17:48:45 +0000 (17:48 +0000)]
Remove the insistance on having a device.hints. This was a seat belt
for those upgrading from 4.x -> 5.x. It is therefore no longer
necessary because it is installed on 5.x and 6.x and one has to
upgrade from 6.x -> current, or at the very least 5.x (although not
supported, it can be made to work).
netchild [Sun, 18 Jun 2006 17:18:17 +0000 (17:18 +0000)]
When attaching an Xbox 360 gamepad a computer, the LED on the gamepad
blinks by default. When the operating system (read: normally an Xbox
360) initializes the gamepad, the LED stops blinking.
netchild [Sun, 18 Jun 2006 14:14:41 +0000 (14:14 +0000)]
- Rename hw.snd.unit to hw.snd.default_unit to make the purpose more obvious.
- Enable 4 automatic vchan's by default.
- Add some comments which provide ides/questions for improvement.
- Prefix some temporary sysctl's with an underscore to denote that it is not
an official API but a workaround until the real solution is implemented.
yar [Sun, 18 Jun 2006 12:27:59 +0000 (12:27 +0000)]
Add a funny sysctl: debug.kdb.trap_code .
It is similar to debug.kdb.trap, except for it tries to cause a page fault
via a call to an invalid pointer. This can highlight differences between
a fault on data access vs. a fault on code call some CPUs might have.
This appeared as a test for a work \
Sponsored by: RiNet (Cronyx Plus LLC)