rwatson [Sun, 7 Nov 2004 23:11:32 +0000 (23:11 +0000)]
Add basic critical section tracing to KTR using event type KTR_CRITICAL.
This generates a KTR event for each critical section entered and exited.
It would be desirable to also log the filename and line number of the
source entering or exiting the critical section, but this requires
hacking up the critical section API, so I've not done that yet.
rwatson [Sun, 7 Nov 2004 19:19:35 +0000 (19:19 +0000)]
Do some re-sorting of TCP pcbinfo locking and assertions: make sure to
retain the pcbinfo lock until we're done using a pcb in the in-bound
path, as the pcbinfo lock acts as a pseuo-reference to prevent the pcb
from potentially being recycled. Clean up assertions and make sure to
assert that the pcbinfo is locked at the head of code subsections where
it is needed. Free the mbuf at the end of tcp_input after releasing
any held locks to reduce the time the locks are held.
njl [Sun, 7 Nov 2004 06:58:45 +0000 (06:58 +0000)]
Add comments to clarify why we need to run shutdown code on the BSP, update
an old comment about boot() being MI, and note that splhigh() no longer
disables interrupts.
First there was an -m option.
Then Peter killed it and made it the default.
Then Brooks and Poul-Henning added it again.
Then Ruslan fixed the manpage...
rwatson [Sat, 6 Nov 2004 11:43:30 +0000 (11:43 +0000)]
Abstract the logic to look up the uma_bucket_zone given a desired
number of entries into bucket_zone_lookup(), which helps make more
clear the logic of consumers of bucket zones.
Annotate the behavior of bucket_init() with a comment indicating
how the various data structures, including the bucket lookup tables,
are initialized.
Update the description of -l to reflect reality. After mdconfig.c
1.25, -l without -u only lists the names, so specifying -u does more
than just limit the output to one device.
das [Sat, 6 Nov 2004 07:17:50 +0000 (07:17 +0000)]
Fix the last known race in swapoff(), which could lead to a spurious panic:
swapoff: failed to locate %d swap blocks
The race occurred because putpages() can block between the time it
allocates swap space and the time it updates the swap metadata to
associate that space with a vm_object, so swapoff() would complain
about the temporary inconsistency. I hoped to fix this by making
swp_pager_getswapspace() and swp_pager_meta_build() a single atomic
operation, but that proved to be inconvenient. With this change,
swapoff() simply doesn't attempt to be so clever about detecting when
all the pageout activity to the target device should have drained.
alc [Sat, 6 Nov 2004 05:33:02 +0000 (05:33 +0000)]
Move a call to wakeup() from vm_object_terminate() to vnode_pager_dealloc()
because this call is only needed to wake threads that slept when they
discovered a dead object connected to a vnode. To eliminate unnecessary
calls to wakeup() by vnode_pager_dealloc(), introduce a new flag,
OBJ_DISCONNECTWNT.
peter [Sat, 6 Nov 2004 03:35:51 +0000 (03:35 +0000)]
i386_set_ldt() is not available when running 32 bit binaries on amd64
kernels. Use the recently exposed direct-set routines instead. This is
only activated for when we compile i386 support libraries on amd64.
peter [Sat, 6 Nov 2004 03:32:07 +0000 (03:32 +0000)]
The 32 bit compatability ld-elf32.so.1 cannot use i386_set_ldt() when
running on an amd64 kernel. Use the recently exposed direct %fs/%gs set
routines instead for the TLS setup of 32 bit binaries.
peter [Sat, 6 Nov 2004 03:30:53 +0000 (03:30 +0000)]
Use the recently exposed fs/gs set functions when compiling libthr to
run as a 32 bit support library for an amd64 kernel. 32 bit consumers of
libthr have zero chance of running on an amd64 kernel since we don't
implement the i386_set_ldt() family of functions. Note that this commit
doesn't make it actually work, it just removes one more obstacle.
peter [Sat, 6 Nov 2004 03:28:26 +0000 (03:28 +0000)]
When building the custom i386 libraries for use on amd64 kernels, we
can't use the i386_set_ldt() family of routines, because they are not
implemented. Instead, use the recently exposed direct access sysarch
routines for setting what %fs and %gs point to.
Use this for the i386 TLS _set_tp() routine, but only when compiling to
run as a 32 bit support binary for amd64 kernels.
peter [Sat, 6 Nov 2004 03:23:36 +0000 (03:23 +0000)]
Begin an invasion of i386-land by amd64.
Expose some of the amd64-specific sysarch functions to allow alternative
implementations of the %fs/%gs code for TLS, threads, etc. USER_LDT does
not exist on the amd64 kernel, so we have to implement things other ways.
peter [Sat, 6 Nov 2004 03:14:26 +0000 (03:14 +0000)]
Convert tools/lib32/build.sh into world connectable hooks. This still
rates pretty high on the "hack!" scale, but it works for me. Adding
-DWANT_LIB32 to the world build command line, or 'WANT_LIB32=yes' to
/etc/make.conf will include the 32 bit libraries with the build.
I have not made this default behavior. Cross compiling this stuff is an
adventure I have not investigated.
This is still a WIP. We needed this at work so that we could install from
a readonly obj tree - lib32/build.sh wasn't up to that.
jhb [Fri, 5 Nov 2004 20:19:58 +0000 (20:19 +0000)]
- Store threads on sleep queues in FIFO order rather than sorted by
priority. The sleep queues don't get updated when the priority of
threads changes, so sleepq_signal() might not always wakeup the
highest priority thread. Updating the queues when thread priorities
change cannot be easily done due to lock orders, so instead we do an
O(n) walk of the queue for a sleepq_signal() operation instead of O(1).
On the other hand, adding a thread to a sleep queue now goes from O(n)
to O(1) so it ends up as an even tradeoff. The correctness here with
regards to priorities is actually fairly important. msleep() gives
interactive threads their priority "boost" after they are placed on the
queue, but before this fix that "boost" wasn't used to determine the
highest priority thread that sleepq_signal() awoke.
- Fix up some comments.
cognet [Fri, 5 Nov 2004 19:57:10 +0000 (19:57 +0000)]
Copy the syscall args in a tmp variable instead of directly using the
trapframe, as it can be modified in the syscall.
Call thread_user_enter() when appropriate.
cognet [Fri, 5 Nov 2004 19:52:55 +0000 (19:52 +0000)]
If we're still running at the physical address, jump to the virtual address
instead before calling initarm().
This removes the need to map virtual == physical in initarm().
jhb [Fri, 5 Nov 2004 19:16:44 +0000 (19:16 +0000)]
- Add a new MD per-CPU field for Alpha 'pal_id' which is the PAL ID
associated with each processor. This ID is inferred from the index
of the pcs structure in the hwprb.
- Give Alpha CPUs FreeBSD CPU IDs more like other architectures where the
boot processor is always CPU 0 and the other processors are numbered
1 ... N. List active CPUs in the system in cpu_mp_announce() as well.
jhb [Fri, 5 Nov 2004 19:14:02 +0000 (19:14 +0000)]
- Set the priority of the page zeroing thread using sched_prio() when the
thread is created rather than adjusting the priority in the main
function. (kthread_create() should probably take the initial priority
as an argument.)
- Only yield the CPU in the !PREEMPTION case if there are any other
runnable threads. Yielding when there isn't anything else better to do
just wastes time in pointless context switches (albeit while the system
is idle.)
jhb [Fri, 5 Nov 2004 19:11:24 +0000 (19:11 +0000)]
- Make setting of IT_ENTROPY a bit simpler in ithread_update().
- Tweak the updating of the ithread name in ithread_update() so that the
'+' and '*' characters for device names that were too short only get
added at the end after as many device names as possible were fit into
the allocated space. Prior to this, some long devices would result
in '+' chars showing up between two different devices rather than at the
end.
peter [Fri, 5 Nov 2004 18:29:10 +0000 (18:29 +0000)]
Bind to cpu0 for boot() processing. (Note this is reboot, not startup)
This means we'll always call the event hooks, device_shutdown etc on the
BSP and theoretically means we can de-cruftify the cpu_reset_proxy stuff.
pjd [Fri, 5 Nov 2004 12:38:27 +0000 (12:38 +0000)]
Stop method for swap1 script was introduced, because gmirror needed it.
Now gmirror use shutdown hooks to mark mirrors as clean on shutdown,
so this is not needed anymore.
pjd [Fri, 5 Nov 2004 10:55:04 +0000 (10:55 +0000)]
- Add a sysctl kern.geom.mirror.idletime, so one can specify after how many
seconds of idling, DRITY flags are removed.
- If mirror is in idle state or is not open for writing, sleep without
timeout when waiting for I/O requests.
- Don't use atomic operations, for now sysctls are protected by Giant.
- Update debugs.
tjr [Fri, 5 Nov 2004 10:45:23 +0000 (10:45 +0000)]
When the last line of a file is missing a newline in -f mode, pass a
length argument to mbrtowc() that accounts for the terminating newline
character we add automatically. Failing to do this caused the loop to
unexpectedly run out of characters and incorrectly signal an "Illegal byte
sequence" error.