John Baldwin [Tue, 18 Apr 2006 18:16:54 +0000 (18:16 +0000)]
- Bring back turnstile_empty() which can check to see if an individual
queue on a turnstile is empty.
- Add a turnstile_disown() function that allows a thread to give up
ownership of a turnstile w/o waking up any waiters.
- Add new ntpd_config variable so that people can override it in rc.conf.
- Add default value in /etc/defaults/rc.conf.
- Add documentation bits to rc.conf(5).
Fix storing offset of already synchronized data. Offset in entire array was
stored in metadata instead of an offset in single disk.
After reboot/crash synchronization process started from a wrong offset
skipping (not synchronizing) part of the component which can lead to data
corrutpion (when synchronization process was interrupted on initial
synchronization) or other strange situations like 'graid3 status' showing
value more than 100%.
Reported, reviewed and tested by: ru
Reported by: Dmitry Morozovsky <marck@rinet.ru>
MFC after: 1 day
Add ldconfig to the list of requirements for named, needed to use bind
from ports. The effect is that ldconfig is now started right after
mountcritremote. Everything else is left unchanged.
remove DRIVER_MODULE lines that are useless... pcf doesn't exist (only
as pcf_ebus and pcf_isa, they should probably be fixed back to pcf),
and bti2c doesn't exist, bktr has smbus or iicbb as children..
Brought to you by: http://people.FreeBSD.org/~jmg/driver.pdf
John Baldwin [Mon, 17 Apr 2006 21:11:01 +0000 (21:11 +0000)]
- Add a rw_wowner() macro that just returns the owner of a write lock and
use it in places that only care about the write owner instead of
rw_owner() as a baby step towards limited read-lock owner.
- Tidy the code that sets the WAITER flag bits to not duplicate a test
around the atomic operation and the KTR trace in both of the lock
functions.
Marius Strobl [Mon, 17 Apr 2006 21:03:24 +0000 (21:03 +0000)]
- Since critical sections no longer raise the processor interrupt level to
above what's used for fast interrupts, only interrupts with the level of
the interrupt which led to calling intr_fast() (which is used with both
fast and ithread interrupts) are blocked while in that function. Thus
intr_fast() can be preempted by a fast interrupt (which are of a higher
level than ithread interrupts) while servicing an ithread interrupt. This
can lead to a stale pointer to the head of the active interrupt requests
list when back in the ithread interrupt invocation of intr_fast(), in turn
resulting in corruption of the interrupt request lists and consequently
in a panic. Solve this be turning off interrupts in intr_fast() before
reading the pointer to the head of the active list rather than after. [1]
- Add a KASSERT in intr_fast() which asserts that ir_func is non-zero before
calling it. [1]
- Increment interrupt stats after calling the handlers rather than before.
This reduces the delay until direct and fast handlers are serviced, in my
testings by 30% on average for the direct tick interrupt handler, in turn
resulting in less clock drift.
Add the ability to log to an arbitrary udp port as well as the
standard syslog port. This allows syslog to easily export lines of interest to
an external logging system.
John Baldwin [Mon, 17 Apr 2006 19:44:44 +0000 (19:44 +0000)]
Add a new module_file() function that returns the linker_file_t associated
with a given module_t. I use this in some the MOD_LOAD event handler for
some test kernel modules to ask the kernel linker to look up the linker
sets in my test modules. (I use linker sets to generate the list of
possible events that I then signal to execute via a sysctl. On non-amd64,
ld(8) would resolve the entire linker set, but on amd64 I have to ask the
kernel linker to do it for me, and having the kernel linker do it works on
all archs.)
John Baldwin [Mon, 17 Apr 2006 19:11:12 +0000 (19:11 +0000)]
- Sleep/wakeup operate on threads now, not processes.
- Describe msleep() as the primary sleep function now rather than tsleep()
and describe tsleep() and msleep_spin() as variations.
- Try to make the description of msleep() a bit closer to English
(sentences with actual subjects, etc.)
- Document that a priority of 0 now prevents the thread's priority from
being altered.
- Add a history note for wakeup_one().
David Malone [Mon, 17 Apr 2006 18:35:58 +0000 (18:35 +0000)]
Port 37 (RFC 738) style times are supposed to be a 32 bit time since
1900 in network byte order. Use a uint32_t to calculate and send
the time, so that we don't need to know how big ints or longs are.
I used uint32_t instead of int in the patch, on the off chance
someone uses our inetd source on a system that doesnt 32 bit ints.
John Baldwin [Mon, 17 Apr 2006 18:20:38 +0000 (18:20 +0000)]
Change msleep() and tsleep() to not alter the calling thread's priority
if the specified priority is zero. This avoids a race where the calling
thread could read a snapshot of it's current priority, then a different
thread could change the first thread's priority, then the original thread
would call sched_prio() inside msleep() undoing the change made by the
second thread. I used a priority of zero as no thread that calls msleep()
or tsleep() should be specifying a priority of zero anyway.
The various places that passed 'curthread->td_priority' or some variant
as the priority now pass 0.
Remove a corrupted fortune ending in line noise. Even googling did not
turn up a non-corrupted version, else I would have restored it.
(No, it's not the one that uses line noise intentionally.)
o Implement Solaris-like -x flag: show extended disk statistics.
o Implement Solaris-like -z flag: omit lines for devices with no activity.
o iostat.8: describe -x and -z flags, Xr devstat(3), touch .Dd.
PR: mostly bin/68840, with style changes; bin/73327
Submitted by: Dan Nelson, Peter Schuller
Obtained from: NetBSD (a part of man page)
MFC after: 1 month
Sam Leffler [Sun, 16 Apr 2006 18:14:01 +0000 (18:14 +0000)]
Unbreak cabq handling: check the s/w q, not the h/w q as the frames
have not been passed to the h/w yet. This remedies watchdog timeout
of buffered multicast frames in hostap mode.
While here eliminate an extraneous check; ieee80211_beacon_update sets
the tim bit based on ncabq != 0 so there's no reason to check it too.
Daniel Eischen [Sat, 15 Apr 2006 15:35:20 +0000 (15:35 +0000)]
Don't export __gdtoa. The only known ports that rely on
this or the deprecated POSIX functions {e,g,f}cvt() have
newer versions that do not (rely on them).
Import ACPI Dock Station support. Note that this is still very young.
Additional detach implementaions (or maybe improvement) for other
deivce drivers is required.
Scott Long [Sat, 15 Apr 2006 08:13:06 +0000 (08:13 +0000)]
Fix the interrupt handler to do the mandatory PCI flush before looking at
DMA memory. The could contribute towards missed link state changes under
heavy bus load.
Robert Watson [Sat, 15 Apr 2006 05:24:23 +0000 (05:24 +0000)]
Mirror IPv4 pcb locking into in6_setsockaddr() and in6_setpeeraddr():
acquire inpcb lock when reading inpcb port+address in order to prevent
races with other threads that may be changing them.
John Baldwin [Fri, 14 Apr 2006 19:51:50 +0000 (19:51 +0000)]
Mark the thread pointer used during an adaptive spin volatile so that the
compiler doesn't decide to cache td_state. Cachine the state would cause
the spinning thread to not notice when the owning thread stopped executing
(if it was preempted for example) which could result in livelock.
John Baldwin [Fri, 14 Apr 2006 14:27:28 +0000 (14:27 +0000)]
Drop the kqueue global mutex as soon as we are finished with it rather
than keeping it locked until we exit the function to optimize the case
where the lock would be dropped and later reacquired. The optimization
was broken when kevent's were moved from UFS to VFS and the knote list
lock for a vnode kevent became the lockmgr vnode lock. If one tried
to use a kqueue that contained events for a kqueue fd followed by a vnode,
then the kq global lock would end up being held when the vnode lock was
acquired which could result in sleeping with a mutex held (and subsequent
panics) if the vnode lock was contested.
Reviewed by: jmg
Tested by: ps (on 6.x)
MFC after: 3 days
Output something reasonable for regular and expanded here-documents.
I would have chosen the EOF markers, but they are no longer available
AFAICS, so output "<<HERE" and "<<XHERE" instead.
(NOTE: These changes only affect DEBUG output.)
o Yacc's lineno variable holds a total number of parsed lines.
Reset it to 1 for each devd config file so if the parser finds
a syntax error devd(8) will report a correct line number.
David Xu [Thu, 13 Apr 2006 23:29:25 +0000 (23:29 +0000)]
Clear TDF_SINTR in sleepq_resume_thread, also sleepq_catch_signal does
not need to clear it now, this should fix panic when msleep is recursivly
called. Patch is slightly adjusted after review.
Reviewed by: jhb
Tested by: Csaba Henk, csaba-ml at creo.hu
MFC after: 3 days
Martin Cracauer [Thu, 13 Apr 2006 19:37:32 +0000 (19:37 +0000)]
Repair ext2fs writes.
Strong candidate for backport to 6.x.
When allocating new blocks, the search for block group beginnings
would fail with a segfault. There was a side-effect read access with
an off-by-one errors. The results were not used in the error case so
the code worked in the past. But now the FreeBSD kernel has tighter
mappings and the word accessed is not mapped (for me).
The Linux kernel has rewritten most of the allocation strategy by now.
Also, the Linux kernel cleaned up the integration of these files and
it look feasable to wrap the original Linux files in wrapper that
provides their favorite arguments instead of dragging around our own
code.
Warner Losh [Thu, 13 Apr 2006 17:39:34 +0000 (17:39 +0000)]
MFp4:
For 32-bit SDRAM systems, enable D16 to D31 in the PIO controller.
Otherwise they read back as 0xffff.
Shave 8 bytes from the object size by using AT91C_BASE_PIOA directly
and by not assigning PIO_BSR to 0 in the DBGU init. That's a nop in
two ways (everything defaults to peripheral A, and writing 0 changes
nothing).
Warner Losh [Thu, 13 Apr 2006 17:34:23 +0000 (17:34 +0000)]
Merge from p4:
Many places used #define FOO ((unsigned int) 0x23) where a simpler
#define FOO 0x23u would have sufficed. This practice is overly
verbose and has the disadvantage that you can't say
#if FOO == BAR
#endif
because the extra "unsigned int" tokens choke cpp's little brain.
Migrate to the latter style to allow use in preprocessor statements.
The two are the same semantically anyway in a C context (at least for
the uses they are put to presently, C gurus can explain to me how they
differ).
Bring back arm-specific workaround from rev 1.15:
Do not use the IO-mapping to issue the reset on the 82546 on arm. For some
reason, it results in corrupted descriptors.