]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
18 years agoNew OEM generic card. "10/100 Fast Ethernet PC Card". It has a
Warner Losh [Tue, 11 Oct 2005 01:02:16 +0000 (01:02 +0000)]
New OEM generic card.  "10/100 Fast Ethernet PC Card".  It has a
generic sounding CIS "PCMCIA", "FAST ETHERENT CARD" and a bogus MANFID
code (0xffff and 0x1090).  However, since I'm not aware of 'generic'
cards that aren't NE-2000oids, go with that and hope for the best.

18 years agoMake forwarding of connect/disconnect events optional. wpa_supplicant
Bill Paul [Mon, 10 Oct 2005 20:40:28 +0000 (20:40 +0000)]
Make forwarding of connect/disconnect events optional. wpa_supplicant
seems to already be able to tell when it's associated and the extra
events just confuse it. Only forward media-specific events by default.

18 years agoFix a missing set of lock operations.
Scott Long [Mon, 10 Oct 2005 20:13:31 +0000 (20:13 +0000)]
Fix a missing set of lock operations.

Submitted by: green
PR: 87191

18 years agoFixed range reduction near (but not very near) medium-sized multiples
Bruce Evans [Mon, 10 Oct 2005 20:02:02 +0000 (20:02 +0000)]
Fixed range reduction near (but not very near) medium-sized multiples
of pi/2 (1 line) and expand a comment about related magic (many lines).

The bug was essentially the same as for the +-pi/2 case (a mistranslated
mask), but was smaller so it only significantly affected multiples
starting near +-13*pi/2.  At least on amd64, for cosf() on all 2^32
float args, the bug caused 128 errors of >= 1 ulp, with a maximum error
of 1.2393 ulps.

18 years agoCorrect the former patch to the way it would have looked after review.
Søren Schmidt [Mon, 10 Oct 2005 19:13:27 +0000 (19:13 +0000)]
Correct the former patch to the way it would have looked after review.

18 years agoProperly react to allocation failures.
Søren Schmidt [Mon, 10 Oct 2005 19:12:43 +0000 (19:12 +0000)]
Properly react to allocation failures.

Found by: imp@

18 years agoAvoid unintended VMIO on directories and symlinks due to leftover object
Tor Egge [Mon, 10 Oct 2005 19:02:04 +0000 (19:02 +0000)]
Avoid unintended VMIO on directories and symlinks due to leftover object
not having been destroyed.

18 years agoGrrr. Add one more missing NDIS_UNLOCK().
Bill Paul [Mon, 10 Oct 2005 18:41:36 +0000 (18:41 +0000)]
Grrr. Add one more missing NDIS_UNLOCK().

18 years agoAdd missing NDIS_UNLOCK() in one of the failure cases in SIOCGPRIVATE_0.
Bill Paul [Mon, 10 Oct 2005 18:17:46 +0000 (18:17 +0000)]
Add missing NDIS_UNLOCK() in one of the failure cases in SIOCGPRIVATE_0.

18 years agoAutogenerate hardware notes for snd_mss(4).
Joel Dahl [Mon, 10 Oct 2005 18:01:18 +0000 (18:01 +0000)]
Autogenerate hardware notes for snd_mss(4).

18 years agoEnable -D ndis support in wpa_supplicant and add the ndis_events utility.
Bill Paul [Mon, 10 Oct 2005 17:51:12 +0000 (17:51 +0000)]
Enable -D ndis support in wpa_supplicant and add the ndis_events utility.
This allows wpa_supplicant to work with WPA and WPA2 compliant NDIS
drivers.

18 years ago- Xref snd_mss(4).
Joel Dahl [Mon, 10 Oct 2005 17:49:40 +0000 (17:49 +0000)]
-  Xref snd_mss(4).
-  Remove a few items from the HARDWARE list.  This support is
   already described in the snd_mss(4) manual page.

18 years agoRemove the driver_ndis files from the exclusion list
Bill Paul [Mon, 10 Oct 2005 17:48:01 +0000 (17:48 +0000)]
Remove the driver_ndis files from the exclusion list

18 years agoAdd manual page for snd_mss(4) and hook it up to the build.
Joel Dahl [Mon, 10 Oct 2005 17:46:43 +0000 (17:46 +0000)]
Add manual page for snd_mss(4) and hook it up to the build.

Reviewed by: brueffer

18 years agoThis commit was generated by cvs2svn to compensate for changes in r151208,
Bill Paul [Mon, 10 Oct 2005 17:46:15 +0000 (17:46 +0000)]
This commit was generated by cvs2svn to compensate for changes in r151208,
which included commits to RCS files with non-trunk default branches.

18 years agoImport the driver_ndis files from the 0.3.9 distribution.
Bill Paul [Mon, 10 Oct 2005 17:46:15 +0000 (17:46 +0000)]
Import the driver_ndis files from the 0.3.9 distribution.

18 years agoThis commit makes a big round of updates and fixes many, many things.
Bill Paul [Mon, 10 Oct 2005 16:46:39 +0000 (16:46 +0000)]
This commit makes a big round of updates and fixes many, many things.

First and most importantly, I threw out the thread priority-twiddling
implementation of KeRaiseIrql()/KeLowerIrq()/KeGetCurrentIrql() in
favor of a new scheme that uses sleep mutexes. The old scheme was
really very naughty and sought to provide the same behavior as
Windows spinlocks (i.e. blocking pre-emption) but in a way that
wouldn't raise the ire of WITNESS. The new scheme represents
'DISPATCH_LEVEL' as the acquisition of a per-cpu sleep mutex. If
a thread on cpu0 acquires the 'dispatcher mutex,' it will block
any other thread on the same processor that tries to acquire it,
in effect only allowing one thread on the processor to be at
'DISPATCH_LEVEL' at any given time. It can then do the 'atomic sit
and spin' routine on the spinlock variable itself. If a thread on
cpu1 wants to acquire the same spinlock, it acquires the 'dispatcher
mutex' for cpu1 and then it too does an atomic sit and spin to try
acquiring the spinlock.

Unlike real spinlocks, this does not disable pre-emption of all
threads on the CPU, but it does put any threads involved with
the NDISulator to sleep, which is just as good for our purposes.

This means I can now play nice with WITNESS, and I can safely do
things like call malloc() when I'm at 'DISPATCH_LEVEL,' which
you're allowed to do in Windows.

Next, I completely re-wrote most of the event/timer/mutex handling
and wait code. KeWaitForSingleObject() and KeWaitForMultipleObjects()
have been re-written to use condition variables instead of msleep().
This allows us to use the Windows convention whereby thread A can
tell thread B "wake up with a boosted priority." (With msleep(), you
instead have thread B saying "when I get woken up, I'll use this
priority here," and thread A can't tell it to do otherwise.) The
new KeWaitForMultipleObjects() has been better tested and better
duplicates the semantics of its Windows counterpart.

I also overhauled the IoQueueWorkItem() API and underlying code.
Like KeInsertQueueDpc(), IoQueueWorkItem() must insure that the
same work item isn't put on the queue twice. ExQueueWorkItem(),
which in my implementation is built on top of IoQueueWorkItem(),
was also modified to perform a similar test.

I renamed the doubly-linked list macros to give them the same names
as their Windows counterparts and fixed RemoveListTail() and
RemoveListHead() so they properly return the removed item.

I also corrected the list handling code in ntoskrnl_dpc_thread()
and ntoskrnl_workitem_thread(). I realized that the original logic
did not correctly handle the case where a DPC callout tries to
queue up another DPC. It works correctly now.

I implemented IoConnectInterrupt() and IoDisconnectInterrupt() and
modified NdisMRegisterInterrupt() and NdisMDisconnectInterrupt() to
use them. I also tried to duplicate the interrupt handling scheme
used in Windows. The interrupt handling is now internal to ndis.ko,
and the ndis_intr() function has been removed from if_ndis.c. (In
the USB case, interrupt handling isn't needed in if_ndis.c anyway.)

NdisMSleep() has been rewritten to use a KeWaitForSingleObject()
and a KeTimer, which is how it works in Windows. (This is mainly
to insure that the NDISulator uses the KeTimer API so I can spot
any problems with it that may arise.)

KeCancelTimer() has been changed so that it only cancels timers, and
does not attempt to cancel a DPC if the timer managed to fire and
queue one up before KeCancelTimer() was called. The Windows DDK
documentation seems to imply that KeCantelTimer() will also call
KeRemoveQueueDpc() if necessary, but it really doesn't.

The KeTimer implementation has been rewritten to use the callout API
directly instead of timeout()/untimeout(). I still cheat a little in
that I have to manage my own small callout timer wheel, but the timer
code works more smoothly now. I discovered a race condition using
timeout()/untimeout() with periodic timers where untimeout() fails
to actually cancel a timer. I don't quite understand where the race
is, using callout_init()/callout_reset()/callout_stop() directly
seems to fix it.

I also discovered and fixed a bug in winx32_wrap.S related to
translating _stdcall calls. There are a couple of routines
(i.e. the 64-bit arithmetic intrinsics in subr_ntoskrnl) that
return 64-bit quantities. On the x86 arch, 64-bit values are
returned in the %eax and %edx registers. However, it happens
that the ctxsw_utow() routine uses %edx as a scratch register,
and x86_stdcall_wrap() and x86_stdcall_call() were only preserving
%eax before branching to ctxsw_utow(). This means %edx was getting
clobbered in some cases. Curiously, the most noticeable effect of this
bug is that the driver for the TI AXC110 chipset would constantly drop
and reacquire its link for no apparent reason. Both %eax and %edx
are preserved on the stack now. The _fastcall and _regparm
wrappers already handled everything correctly.

I changed if_ndis to use IoAllocateWorkItem() and IoQueueWorkItem()
instead of the NdisScheduleWorkItem() API. This is to avoid possible
deadlocks with any drivers that use NdisScheduleWorkItem() themselves.

The unicode/ansi conversion handling code has been cleaned up. The
internal routines have been moved to subr_ntoskrnl and the
RtlXXX routines have been exported so that subr_ndis can call them.
This removes the incestuous relationship between the two modules
regarding this code and fixes the implementation so that it honors
the 'maxlen' fields correctly. (Previously it was possible for
NdisUnicodeStringToAnsiString() to possibly clobber memory it didn't
own, which was causing many mysterious crashes in the Marvell 8335
driver.)

The registry handling code (NdisOpen/Close/ReadConfiguration()) has
been fixed to allocate memory for all the parameters it hands out to
callers and delete whem when NdisCloseConfiguration() is called.
(Previously, it would secretly use a single static buffer.)

I also substantially updated if_ndis so that the source can now be
built on FreeBSD 7, 6 and 5 without any changes. On FreeBSD 5, only
WEP support is enabled. On FreeBSD 6 and 7, WPA-PSK support is enabled.

The original WPA code has been updated to fit in more cleanly with
the net80211 API, and to eleminate the use of magic numbers. The
ndis_80211_setstate() routine now sets a default authmode of OPEN
and initializes the RTS threshold and fragmentation threshold.
The WPA routines were changed so that the authentication mode is
always set first, followed by the cipher. Some drivers depend on
the operations being performed in this order.

I also added passthrough ioctls that allow application code to
directly call the MiniportSetInformation()/MiniportQueryInformation()
methods via ndis_set_info() and ndis_get_info(). The ndis_linksts()
routine also caches the last 4 events signalled by the driver via
NdisMIndicateStatus(), and they can be queried by an application via
a separate ioctl. This is done to allow wpa_supplicant to directly
program the various crypto and key management options in the driver,
allowing things like WPA2 support to work.

Whew.

18 years agoCorrect typo.
Ceri Davies [Mon, 10 Oct 2005 15:25:39 +0000 (15:25 +0000)]
Correct typo.

Discussed with: glebius

18 years agoBug fix initialization on multi-core HTT CPUs.
Joseph Koshy [Mon, 10 Oct 2005 15:21:08 +0000 (15:21 +0000)]
Bug fix initialization on multi-core HTT CPUs.

Reported by: ps
Tested by: ps

18 years ago- Note that ng_iface(4) now supports ALTQ.
Gleb Smirnoff [Mon, 10 Oct 2005 15:14:37 +0000 (15:14 +0000)]
- Note that ng_iface(4) now supports ALTQ.
- Explain when ALTQ should be used on ng_iface(4) and when not.

18 years agoALTQ support for ng_iface(4). Before turning on please consult manual page.
Gleb Smirnoff [Mon, 10 Oct 2005 15:12:59 +0000 (15:12 +0000)]
ALTQ support for ng_iface(4). Before turning on please consult manual page.

18 years agoReplace "/etc/make.conf" with references to make.conf(5)
Yaroslav Tykhiy [Mon, 10 Oct 2005 14:55:59 +0000 (14:55 +0000)]
Replace "/etc/make.conf" with references to make.conf(5)
where applicable.  The main reason for this change is that
the location of make.conf is not constant and can be
modified via __MAKE_CONF.  This change also improves
hyper-text linkage in our manpages.

MFC after: 2 weeks

18 years agoClarify the usage and effects of sys.mk, make.conf(5), and __MAKE_CONF.
Yaroslav Tykhiy [Mon, 10 Oct 2005 14:49:55 +0000 (14:49 +0000)]
Clarify the usage and effects of sys.mk, make.conf(5), and __MAKE_CONF.

MFC after: 2 weeks

18 years ago* pkg_version(1) exits if INDEX files is not found and -I is not
Kirill Ponomarev [Mon, 10 Oct 2005 12:35:31 +0000 (12:35 +0000)]
* pkg_version(1) exits if INDEX files is not found and -I is not
  specified.  The result is that the package will be listed with a '?'
  as if it was not found within the INDEX file, so fix this behaviour.
* Remove trailing spaces.

PR: bin/87136
Submitted by: Sean Farley <sean-freebsd at farley dot org>
MFC after: 3 days

18 years agoThe pthread_attr_set_createsuspend_np was broken, fix it by
David Xu [Mon, 10 Oct 2005 12:15:07 +0000 (12:15 +0000)]
The pthread_attr_set_createsuspend_np was broken, fix it by
replacing THR_FLAGS_SUSPENDED with THR_FLAGS_NEED_SUSPEND.

18 years agoFix pkg_info(1) and pkg_delete(1) to handle properly packages which
Kirill Ponomarev [Mon, 10 Oct 2005 08:38:21 +0000 (08:38 +0000)]
Fix pkg_info(1) and pkg_delete(1) to handle properly packages which
names start with a digit.

PR: bin/76858
Submitted by: Matthew D. Fuller <fullermd@over-yonder dot net>
MFC after: 3 days

18 years agoRelease clean buffer with wrong size and no dependencies also for non-VMIO
Tor Egge [Sun, 9 Oct 2005 22:41:25 +0000 (22:41 +0000)]
Release clean buffer with wrong size and no dependencies also for non-VMIO
case.

18 years agoAdjust totread argument passed to cluster_read() to account for offset not
Tor Egge [Sun, 9 Oct 2005 21:11:25 +0000 (21:11 +0000)]
Adjust totread argument passed to cluster_read() to account for offset not
being block aligned.

18 years agoWhen breaking up a large request into smaller ones for the strategy
Peter Edwards [Sun, 9 Oct 2005 21:11:05 +0000 (21:11 +0000)]
When breaking up a large request into smaller ones for the strategy
routine, create all the child bio objects before starting the
requests, rather than starting them as created. This closes a race
whereby some number of child operations could complete before the
rest were ever created, and prematurely freeing the parent bio.
This fixes the panics installing in VMWare and qemu

18 years agoFix numerous errors of >= 1 ulp for cosf(x) and sinf(x) (1 line)
Bruce Evans [Sun, 9 Oct 2005 21:07:23 +0000 (21:07 +0000)]
Fix numerous errors of >= 1 ulp for cosf(x) and sinf(x) (1 line)
and add a comment about related magic (many lines)).

__kernel_cos[f]() needs a trick to reduce the error to below 1 ulp
when |x| >= 0.3 for the range-reduced x.  Modulo other bugs, naive
code that doesn't use the trick would have an error of >= 1 ulp
in about 0.00006% of cases when |x| >= 0.3 for the unreduced x,
with a maximum relative error of about 1.03 ulps.  Mistransation
of the trick from the double precision case resulted in errors in
about 0.2% of cases, with a maximum relative error of about 1.3 ulps.

The mistranslation involved not doing implicit masking of the 32-bit
float word corresponding to to implicit masking of the lower 32-bit
double word by clearing it.

sinf() uses __kernel_cosf() for half of all cases so its errors from
this bug are similar.  tanf() is not affected.

The error bounds in the above and in my other recent commit messages
are for amd64.  Extra precision for floats on i386's accidentally masks
this bug, but only if k_cosf.c is compiled with -O.  Although the extra
precision helps here, this is accidental and depends on longstanding
gcc precision bugs (not clipping extra precision on assignment...),
and the gcc bugs are mostly avoided by compiling without -O.  I now
develop libm mainly on amd64 systems to simplify error detection and
debugging.

18 years agoDon't pretend that a failed sync write was succesful.
Tor Egge [Sun, 9 Oct 2005 20:49:01 +0000 (20:49 +0000)]
Don't pretend that a failed sync write was succesful.

18 years agoReduce probability for a deadlock that can occur when a snapshot inode is
Tor Egge [Sun, 9 Oct 2005 20:15:15 +0000 (20:15 +0000)]
Reduce probability for a deadlock that can occur when a snapshot inode is
updated by a process holding the snapshot lock.  Another process updating a
different inode in the same inodeblock will do copy on write checks and lock in
the opposite direction.

The snapshot code force a copy on write of these blocks manually (cf. start of
expunge_ufs[12]) and these inode blocks are later put on snapblklist.

This partial fix is to 'drain' the relevant ffs_copyonwrite() operation after
installing new snapblklist.  This is not a 100% solution since a failed block
allocation can cause implicit fsync() which might deadlock before the new
snapblklist has been installed.

18 years agoEliminate a deadlock that can occur when a dirty block belonging to a snapshot
Tor Egge [Sun, 9 Oct 2005 20:07:51 +0000 (20:07 +0000)]
Eliminate a deadlock that can occur when a dirty block belonging to a snapshot
file is flushed by a process not holding snaplk (e.g. bufdaemon).  Another
process might hold snaplk and try to access the block due to ffs_copyonwrite
processing.

18 years agoEliminate a deadlock that can occur during the cgaccount() processing due to
Tor Egge [Sun, 9 Oct 2005 20:00:16 +0000 (20:00 +0000)]
Eliminate a deadlock that can occur during the cgaccount() processing due to
the cg map buffer being held when writing indirect blocks.  The process ends up
in ffs_copyonwrite(), attempting to get snaplk while holding the cg map buffer
lock.

Another process might be in ffs_copyonwrite(), trying to allocate a new block
for a copy.  It would hold snaplk while trying to get the cg map buffer lock.

Release the cg map buffer early and use the copy for most of the cgaccount
processing to avoid this deadlock.

18 years agoReduce the probability of low block numbers passed to ffs_snapblkfree() by
Tor Egge [Sun, 9 Oct 2005 19:45:01 +0000 (19:45 +0000)]
Reduce the probability of low block numbers passed to ffs_snapblkfree() by
skipping the call from ffs_snapremove() if the block number is zero.

Simplify snapshot locking in ffs_copyonwrite() and ffs_snapblkfree() by using
the same locking protocol for low block numbers as for larger block numbers.
This removes a lock leak that could happen if vn_lock() succeeded after
lockmgr() failed in ffs_snapblkfree().

Check if snapshot is gone before retrying a lock in ffs_copyonwrite().

18 years agoReinitialize v_type and v_op fields in case vnode has been reused without
Tor Egge [Sun, 9 Oct 2005 19:06:34 +0000 (19:06 +0000)]
Reinitialize v_type and v_op fields in case vnode has been reused without
reclamation.  If the vnode previously was a fifo then v_op would point to
ffs_fifoops[12] instead of the expected ffs_vnodeops[12], causing a panic at
the end of ffsext_strategy.

18 years agoAdd RELENG_6_0.
Dag-Erling Smørgrav [Sun, 9 Oct 2005 18:01:55 +0000 (18:01 +0000)]
Add RELENG_6_0.

18 years agoRough implementation of the create and add verbs. The verbs cause
Marcel Moolenaar [Sun, 9 Oct 2005 17:10:35 +0000 (17:10 +0000)]
Rough implementation of the create and add verbs. The verbs cause
in-memory changes only and as such are only useful for prototyping
and regression testing purposes.

18 years agoMake sure that the created fifo gets deleted if the top level make instance
Scott Long [Sun, 9 Oct 2005 06:36:51 +0000 (06:36 +0000)]
Make sure that the created fifo gets deleted if the top level make instance
exits due to a signal.

18 years agoFinish off style(9) fixes which I started two revisions ago. This basically
Christian S.J. Peron [Sun, 9 Oct 2005 04:45:41 +0000 (04:45 +0000)]
Finish off style(9) fixes which I started two revisions ago. This basically
changes the indentation style from 4 spaces to 8 spaces which we expect to
see in other FreeBSD source files.

18 years ago- Do not hardcode the bsize to a sectorsize of 2048, even though
Craig Rodrigues [Sun, 9 Oct 2005 04:45:33 +0000 (04:45 +0000)]
- Do not hardcode the bsize to a sectorsize of 2048, even though
  the UDF specification specifies a logical sectorsize of 2048.
  Instead, get it from GEOM.
- When reading the UDF Anchor Volume Descriptor, use the logical
  sectorsize of 2048 when calculating the offset to read from, but
  use the actual sectorsize to determine how much to read.

- works with reading a DVD disk and a DVD disk image file via mdconfig
- correctly returns EINVAL if we try to mount_udf an audio CD, instead
  of panicking inside GEOM when INVARIANTS is set

18 years agoSync whitespace change that is found uniquely in RELENG_6, to reduce diff
Xin LI [Sun, 9 Oct 2005 04:44:51 +0000 (04:44 +0000)]
Sync whitespace change that is found uniquely in RELENG_6, to reduce diff
against it.

18 years agoWoops, in my previous commit, I actually committed some style changes with
Christian S.J. Peron [Sun, 9 Oct 2005 04:40:56 +0000 (04:40 +0000)]
Woops, in my previous commit, I actually committed some style changes with
a functional change. I know this is a big no no, so this is a forced commit
to note the functional changes from my previous revision:

@@ -196,7 +176,7 @@ wait_for_lock(const char *name, int flag
     int fd;

     if ((fd = open(name, O_CREAT|O_RDONLY|O_EXLOCK|flags, 0666)) == -1) {
- if (errno == ENOENT || errno == EINTR || errno == EAGAIN)
+ if (errno == EINTR || errno == EAGAIN)
      return (-1);
  err(EX_CANTCREAT, "cannot open %s", name);
     }

18 years agoOops, the last-minute optimization in rev.1.8 wasn't a good idea. The
Bruce Evans [Sun, 9 Oct 2005 04:29:08 +0000 (04:29 +0000)]
Oops, the last-minute optimization in rev.1.8 wasn't a good idea.  The
17+17+24 bit pi/2 must only be used when subtraction of the first 2
terms in it from the arg is exact.  This happens iff the the arg in
bits is one of the 2**17[-1] values on each side of (float)(pi/2).

Revert to the algorithm in rev.1.7 and only fix its threshold for using
the 3-term pi/2.  Use the threshold that maximizes the number of values
for which the 3-term pi/2 is used, subject to not changing the algorithm
for comparing with the threshold.  The 3-term pi/2 ends up being used
for about half of its usable range (about 64K values on each side).

18 years agoLock object while we iterate through it's backing objects.
Christian S.J. Peron [Sun, 9 Oct 2005 02:37:27 +0000 (02:37 +0000)]
Lock object while we iterate through it's backing objects.

Discussed with: alc

18 years agoFixed syntax error (a missing brace) in previous commit.
Bruce Evans [Sat, 8 Oct 2005 22:55:36 +0000 (22:55 +0000)]
Fixed syntax error (a missing brace) in previous commit.

18 years agobridge.4 is now mlinked to if_bridge.4 so do not list it for deletion.
Andrew Thompson [Sat, 8 Oct 2005 22:51:47 +0000 (22:51 +0000)]
bridge.4 is now mlinked to if_bridge.4 so do not list it for deletion.

18 years agoFixed range reduction near (but not very near) +-pi/2. A bug caused
Bruce Evans [Sat, 8 Oct 2005 22:43:55 +0000 (22:43 +0000)]
Fixed range reduction near (but not very near) +-pi/2.  A bug caused
a maximum error of 2.905 ulps for cosf(), but the algorithm for cosf()
is good for < 1 ulps and happens to give perfect rounding (< 0.5 ulps)
near +-pi/2 except for the bug.  The extra relative errors for tanf()
were similar (slightly larger).  The bug didn't affect sinf() since
sinf'(+-pi/2) is 0.

For range reduction in ~[-3pi/4, -pi/4] and ~[pi/4, 3pi/4] we must
subtract +-pi/2 and the only complication is that this must be done
in extra precision.  We have handy 17+24-bit and 17+17+24-bit
approximations to pi/2.  If we always used the former then we would
lose up to 24 bits of accuracy due to cancelation of leading bits, but
we need to keep at least 24 bits plus a guard digit or 2, and should
keep as many guard bits as efficiency permits.  So we used the
less-precise pi/2 not very near +-pi/2 and switched to using the
more-precise pi/2 very near +-pi/2.  However, we got the threshold for
the switch wrong by allowing 19 bits to cancel, so we ended up with
only 21 or 22 bits of accuracy in some cases, which is even worse than
naively subtracting pi/2 would have done.

Exhaustive checking shows that allowing only 17 bits to cancel (min.
accuracy ~24 bits) is sufficient to reduce the maximum error for cosf()
near +-pi/2 to 0.726 ulps, but allowing only 6 bits to cancel (min.
accuracy ~35-bits) happens to give perfect rounding for cosf() at
little extra cost so we prefer that.

We actually (in effect) allow 0 bits to cancel and always use the
17+17+24-bit pi/2 (min. accuracy ~41 bits).  This is simpler and
probably always more efficient too.  Classifying args to avoid using
this pi/2 when it is not needed takes several extra integer operations
and a branch, but just using it takes only 1 FP operation.

The patch also fixes misspelling of 17 as 24 in many comments.

For the double-precision version, the magic numbers include 33+53 bits
for the less-precise pi/2 and (53-32-1 = 20) bits being allowed to
cancel, so there are ~33-20 = 13 guard bits.  This is sufficient except
probably for perfect rounding.  The more-precise pi/2 has 33+33+53
bits and we still waste time classifying args to avoid using it.

The bug is apparently from mistranslation of the magic 32 in 53-32-1.
The number of bits allowed to cancel is not critical and we use 32 for
double precision because it allows efficient classification using a
32-bit comparison.  For float precision, we must use an explicit mask,
and there are fewer bits so there is less margin for error in their
allocation.  The 32 got reduced to 4 but should have been reduced
almost in proportion to the reduction of mantissa bits.

18 years agoUe a better msleep identifier. Fix some whitespace.
Scott Long [Sat, 8 Oct 2005 22:41:57 +0000 (22:41 +0000)]
Ue a better msleep identifier.  Fix some whitespace.

18 years agoaac_intr0 rotted long ago, remove it.
Scott Long [Sat, 8 Oct 2005 22:36:54 +0000 (22:36 +0000)]
aac_intr0 rotted long ago, remove it.

18 years agoAs alc pointed out to me, vm_page.c 1.305 was incomplete: uma_startup()
Dag-Erling Smørgrav [Sat, 8 Oct 2005 21:03:54 +0000 (21:03 +0000)]
As alc pointed out to me, vm_page.c 1.305 was incomplete: uma_startup()
still uses the constant UMA_BOOT_PAGES.  Change it to accept boot_pages
as an additional argument.

MFC after: 2 weeks

18 years agoMega Update to the aac driver to support a whole new family of cards and
Scott Long [Sat, 8 Oct 2005 15:55:09 +0000 (15:55 +0000)]
Mega Update to the aac driver to support a whole new family of cards and
the modified interface that they use.  Changes include:

- Register a different interrupt handler for the new interface.  This one is
  INTR_MPSAFE, not INTR_FAST, and directly processes completions and AIFs.
- Add an event registration and callback mechanism for the ioctl and CAM
  modules can know when a resource shortage clears.  This condition was
  previously fatal in CAM due to programming oversights.
- Fix locking to play better with newbus.
- Provide access methods for talking to cards with the NEWCOMM interface.
- Fix up the CAM module to be better suited for dealing with newer firmware
  on the PERC Si/Di series that requires talking to plain SCSI via aac.
- Add a whole slew of new PCI Id's.

Thanks to Adaptec for providing an initial version of this work and for
answering countless questions about it.  There are still some rough edges in
this, but it works well enough to commit and test for now.

Obtained from: Adaptec, Inc.

18 years agoIn ngt_input(), do not derefer sc (= (sc_p) tp->t_lsc) before making
Seigo Tanimura [Sat, 8 Oct 2005 11:03:29 +0000 (11:03 +0000)]
In ngt_input(), do not derefer sc (= (sc_p) tp->t_lsc) before making
sure sc != NULL.

18 years agoMFP4: More removal of unused stuff.
Warner Losh [Sat, 8 Oct 2005 06:58:51 +0000 (06:58 +0000)]
MFP4: More removal of unused stuff.

18 years agoMFP4: Changes to hopefully make the new power code work better
Warner Losh [Sat, 8 Oct 2005 06:57:13 +0000 (06:57 +0000)]
MFP4: Changes to hopefully make the new power code work better

o Rather than just try to turn off EXCA_INTR_RESET, set the entire register
  to 0.  This is slightly faster, and a better hammer.
o Move attempted clearing of the output enable (EXCA_PWRCTL_OE) back to
  after we turn off the power.  Modify it to write 0 so that we don't get
  Bad Vcc messages on TI bridges (untested, but ru@ sent me a similar patch)
  while at the same time avoiding interrupt storms on Ricoh bridges (tested
  by me on my Sony).

# Many of my observations of 'breakage' for this patch are due to some bug
# in the load/unload of cbb.ko unlreated to this change.  I'll be investigating
# and fixing that bug in the fullness of time.

18 years agoMFP4: We no longer use intr_handlers, so remove it.
Warner Losh [Sat, 8 Oct 2005 06:53:17 +0000 (06:53 +0000)]
MFP4: We no longer use intr_handlers, so remove it.

18 years agoMFP4: Note why we do the dance we do for waiting for the thread to die.
Warner Losh [Sat, 8 Oct 2005 06:51:47 +0000 (06:51 +0000)]
MFP4: Note why we do the dance we do for waiting for the thread to die.

18 years agoRemove a couple of explicit memset(0) ops that were zeroing past the end of
Scott Long [Sat, 8 Oct 2005 05:16:45 +0000 (05:16 +0000)]
Remove a couple of explicit memset(0) ops that were zeroing past the end of
an allocation.  This fixes the malloc 'use after free' panic on boot that
many were seeing.  It doesn't solve the problem of the allocations being
cached and then written past their bounds later.  That will take more work.

Submitted by: kan

18 years agoNow that bridge(4) has been removed, link bridge.4 to if_bridge.4
Andrew Thompson [Sat, 8 Oct 2005 01:20:53 +0000 (01:20 +0000)]
Now that bridge(4) has been removed, link bridge.4 to if_bridge.4

Reviewed by: mlaier

18 years agoFixed profiling of main() for amd64 and i386. This started rotting
Bruce Evans [Fri, 7 Oct 2005 22:13:17 +0000 (22:13 +0000)]
Fixed profiling of main() for amd64 and i386.  This started rotting
in 1993 in rev.1.5 of the i386 a.out version (csu/i386/crt0.c).
Profiling uses a magic label "eprol" to delimit the start of the part
of the text section covered by profiling.  This label must be placed
before the call to main() to get main() properly profiled.  It was
placed there in rev.1.1 of crt0.c.  Rev.1.5 imported the initial
implementation of shared libraries in FreeBSD and misplaced the label.
Fortunately, the misplaced label was misspelled and the old label
wasn't removed, so the new label had no effect.  Unfortunately, when
profiling was implemented for the ELF in 1998 in rev.1.2 of
csu/i386-elf/crt1.c, only the incorrectly placed label was copied
(after fixing its name).  The bug was then copied to all other arches.
The label seems to be still misplaced in NetBSD for most arches.  It
is in common.c for most arches so it is even further from being inside
the function that calls main().

I think "eprol" is short for "end of prologue", but it must be placed
before the end of the prologue so that it covers main().  crt0.c has
it before the calls atexit(_mcleanup) and monstartup(...), but it
cannot affect these calls so I moved it after the call to monstartup().
It now also covers the call to _init() but not the newer call to
_init_tls().  Profiling of _init() seems to be harmless, and the call
to _init_tls() seems to be misplaced.

Reviewed by: jdp (long ago, for a slightly different i386 version)

18 years agoImport iwi-specific tools. Can help debug firmware or connection issues.
Damien Bergamini [Fri, 7 Oct 2005 18:27:21 +0000 (18:27 +0000)]
Import iwi-specific tools.  Can help debug firmware or connection issues.

18 years agoFixes my previous commit (rev 1.20)
Damien Bergamini [Fri, 7 Oct 2005 18:11:32 +0000 (18:11 +0000)]
Fixes my previous commit (rev 1.20)

MFC after: 1 day

18 years agoA deja vu of:
Gleb Smirnoff [Fri, 7 Oct 2005 14:14:47 +0000 (14:14 +0000)]
A deja vu of:

  http://lists.freebsd.org/pipermail/cvs-src/2004-October/033496.html

The same problem applies to if_bridge(4), too.

- Copy-and-paste the if_bridge(4) related block from
  if_ethersubr.c to ng_ether.c
- Add XXXs, so that copy-and-paste would be noticed by
  any future editors of this code.
- Also add XXXs near if_bridge(4) declarations.

Silence from: thompsa

18 years agoAdd parse_uuid() that creates a binary representation of an UUID from
Marcel Moolenaar [Fri, 7 Oct 2005 13:37:10 +0000 (13:37 +0000)]
Add parse_uuid() that creates a binary representation of an UUID from
a string representation.

18 years agoCatch up with increasing the resolution suitable for high-res kernel
Bruce Evans [Fri, 7 Oct 2005 11:58:46 +0000 (11:58 +0000)]
Catch up with increasing the resolution suitable for high-res kernel
profiling from microseconds to nanoseconds in 1996.  Picoseconds are
already needed.

Describe the choice of units for the per-call times in detail.

18 years agoDo not ignore ENOENT
Christian S.J. Peron [Fri, 7 Oct 2005 11:49:27 +0000 (11:49 +0000)]
Do not ignore ENOENT

Pointed out by: Amir Shalem

18 years agoImprove printing of self times in the flat profile for functions that
Bruce Evans [Fri, 7 Oct 2005 10:59:41 +0000 (10:59 +0000)]
Improve printing of self times in the flat profile for functions that
appear to be never called:

(1) If a function is never called according to its call count but it
    must have been called because its child time is nonzero, then print
    it in the flat profile.  Previously, if its call count was zero
    then we only printed it in the flat profile if its self time was
    nonzero.

(2) If a function has a zero call count but has a nonzero self or child
    time, then print its total self time in the self time per call
    column as a percentage of the total (self + child) time.  It is
    not possible to print the times per call in this case because the
    call count is zero.  Previously, this was handled by leaving both
    per-call columns blank.  The self time is printed in another column
    but there was no way to recover the total time.

(1) partially fixes the case of the "never called" function main() and
prepares for (2) to apply to main() and other functions.  Profiling
of main() was lost in the conversion from a.out to ELF, so main()'s
call count has always been zero for many years; then in the common
case where main() is a tiny function, it gets no profiling ticks, so
main() was completely lost in the flat profile.

(2) improves mainly cases like kernel threads.  Most kernel threads
appear to be never called because they are always started before
userland can run to turn on profiling.  As for main(), the fact that
they are called is not very interesting and their callers are
uninteresting, but their relative self time is interesting since they
are long-running.

Almost always printing percentages in the per-call columns would be
more useful than almost always printing 0.0ms.  0.1ms is now a long
time, so only very large functions take that long per call.  The accuracy
per call can approach 1-10 nsec provided programs are run for about
100000 times as long as is necessary to get this accuracy with high
resolution kernel profiling.

18 years agoWe don't need 'imp' here.
Pawel Jakub Dawidek [Fri, 7 Oct 2005 10:30:47 +0000 (10:30 +0000)]
We don't need 'imp' here.

18 years agoSync usage screen with manpage.
Yaroslav Tykhiy [Fri, 7 Oct 2005 10:18:44 +0000 (10:18 +0000)]
Sync usage screen with manpage.

MFC after: 5 days

18 years agoDocument the -d flag to mail(1) better, which comes handy when
Yaroslav Tykhiy [Fri, 7 Oct 2005 10:16:41 +0000 (10:16 +0000)]
Document the -d flag to mail(1) better, which comes handy when
you want to see, e.g., sendmail arguments mail(1) will use.

-H is not an independent flag, it's a modifier.  Also explicitly
say that -H will cause mail(1) to exit as soon as it prints the headers.

MFC after: 5 days

18 years agoPolling is now configured with help of ifconfig(8), not sysctl.
Gleb Smirnoff [Fri, 7 Oct 2005 09:23:51 +0000 (09:23 +0000)]
Polling is now configured with help of ifconfig(8), not sysctl.

Prodded by:     maxim

18 years agoPolling is now configured with help of ifconfig(8), not sysctl.
Gleb Smirnoff [Fri, 7 Oct 2005 08:55:58 +0000 (08:55 +0000)]
Polling is now configured with help of ifconfig(8), not sysctl.

Prodded by:  maxim

18 years agoo Mention the fact dcons(4) depends on "options GDB".
Maxim Konovalov [Fri, 7 Oct 2005 06:43:04 +0000 (06:43 +0000)]
o Mention the fact dcons(4) depends on "options GDB".

Reviewed by: simokawa, ru (mdoc markup)
MFC after: 1 week

18 years agoSwitch from K&R-style C prototypes to ISO/ANSI-style C prototypes.
Craig Rodrigues [Fri, 7 Oct 2005 06:39:08 +0000 (06:39 +0000)]
Switch from K&R-style C prototypes to ISO/ANSI-style C prototypes.

18 years agosnd_ess needs snd_sbc, so add a note about that.
Joel Dahl [Fri, 7 Oct 2005 06:32:11 +0000 (06:32 +0000)]
snd_ess needs snd_sbc, so add a note about that.

18 years agoWork around an apparent mdoc(7) bug.
Tom Rhodes [Fri, 7 Oct 2005 02:32:16 +0000 (02:32 +0000)]
Work around an apparent mdoc(7) bug.

Spotted by: marius
Discussed with: ru

18 years agoDocument recently added security.mac.seeotheruids.suser_privileged sysctl.
Tom Rhodes [Fri, 7 Oct 2005 02:29:50 +0000 (02:29 +0000)]
Document recently added security.mac.seeotheruids.suser_privileged sysctl.

18 years agoBump WARNS up to 3.
Craig Rodrigues [Fri, 7 Oct 2005 02:22:48 +0000 (02:22 +0000)]
Bump WARNS up to 3.

18 years agoIn prmount(), use an unsigned int variable to eliminate
Craig Rodrigues [Fri, 7 Oct 2005 02:22:04 +0000 (02:22 +0000)]
In prmount(), use an unsigned int variable to eliminate
'comparison between signed and unsigned' compiler warning.

18 years agoSwitch from K&R-style C prototypes to ISO/ANSI-style C prototypes.
Craig Rodrigues [Fri, 7 Oct 2005 02:18:20 +0000 (02:18 +0000)]
Switch from K&R-style C prototypes to ISO/ANSI-style C prototypes.
Make prototype in extern.h match prototype in mount_ufs.c

18 years agoDisplay the status of the spanning tree for each port.
Andrew Thompson [Fri, 7 Oct 2005 00:32:16 +0000 (00:32 +0000)]
Display the status of the spanning tree for each port.

        member: xl0 flags=7<LEARNING,DISCOVER,STP>
        member: gem0 flags=7<LEARNING,DISCOVER,STP>
to:
        member: xl0 flags=7<LEARNING,DISCOVER,STP>
                port 3 priority 128 path cost 55 forwarding
        member: gem0 flags=7<LEARNING,DISCOVER,STP>
                port 1 priority 128 path cost 55 learning

18 years agoEliminate __RMAN_RESOURCE_VISIBLE hack entirely by moving the struct
Poul-Henning Kamp [Thu, 6 Oct 2005 21:49:31 +0000 (21:49 +0000)]
Eliminate __RMAN_RESOURCE_VISIBLE hack entirely by moving the struct
resource_ to subr_rman.c where it belongs.

18 years agoo Use firmware extended scan command; this one doesn't crash when scanning
Damien Bergamini [Thu, 6 Oct 2005 20:11:01 +0000 (20:11 +0000)]
o Use firmware extended scan command; this one doesn't crash when scanning
  the 5GHz band.
o Enable 802.11a channels scanning for 2915ABG adapters.
o Fix a typo (negociated->negotiated).

With hints from NetBSD.

MFC after: 2 days

18 years agoMake sure that the worker thread knows the type early enough to
Poul-Henning Kamp [Thu, 6 Oct 2005 19:47:04 +0000 (19:47 +0000)]
Make sure that the worker thread knows the type early enough to
grab Giant for vnode backing.

Found by: pho & tegge

18 years agoAdding myself to calendar.freebsd
Emanuel Haupt [Thu, 6 Oct 2005 19:16:55 +0000 (19:16 +0000)]
Adding myself to calendar.freebsd

Approved by: novel (mentor)

18 years agoBackout strtok() addition to libkern, strsep() is enough and strtok()
Pawel Jakub Dawidek [Thu, 6 Oct 2005 19:06:07 +0000 (19:06 +0000)]
Backout strtok() addition to libkern, strsep() is enough and strtok()
is not safe.

Discussed with: stefanf, njl

18 years ago- Use strsep() instead of strtok().
Pawel Jakub Dawidek [Thu, 6 Oct 2005 19:04:08 +0000 (19:04 +0000)]
- Use strsep() instead of strtok().
- strdup() uses M_WAITOK, so we don't need to check it's return value
  against NULL.

MFC after: 2 weeks

18 years agoFix another edge case I just noticed when committing the previous changes:
John Baldwin [Thu, 6 Oct 2005 18:41:31 +0000 (18:41 +0000)]
Fix another edge case I just noticed when committing the previous changes:
If bus_setup_intr() fails, cleanup the ifnet setup in vx_attach() by
calling ether_ifdetach() and if_free().

MFC after: 1 week

18 years agoRototill vx(4), add locking, and mark MPSAFE:
John Baldwin [Thu, 6 Oct 2005 18:27:59 +0000 (18:27 +0000)]
Rototill vx(4), add locking, and mark MPSAFE:
- Rename vxfoo() functions to vx_foo() to improve readability and
  consistency with other drivers.
- Prefix most the softc members with 'vx_' (the other members already had
  the prefix).
- Switch to using callout_init_mtx() and callout_*() rather than
  timeout() and untimeout().
- Add some missing calls to if_free() in some failure cases in vx_attach().
- Use if_printf() and remove the unit number from the softc.
- Remove uses of the 'register' keyword and spls.
- Add locked variants of vx_init() and vx_start().
- Add a mutex to the softc and lock it in various appropriate places.
- Setup the interrupt handler last during attach.

Tested by: imp
MFC after: 1 week

18 years agoEliminate need for __RMAN_RESOURCE_VISIBLE
Poul-Henning Kamp [Thu, 6 Oct 2005 17:39:18 +0000 (17:39 +0000)]
Eliminate need for __RMAN_RESOURCE_VISIBLE

Reviewed by: marcel@

18 years agoAdd support for setting the SG list segment size.
Søren Schmidt [Thu, 6 Oct 2005 15:44:07 +0000 (15:44 +0000)]
Add support for setting the SG list segment size.
Use this for the SiI3112 workaround to get rid of the "oversized DMA" errors.

MFC to 6.0 candidate.

18 years agoEliminate some unneeded code bits.
Yaroslav Tykhiy [Thu, 6 Oct 2005 15:05:55 +0000 (15:05 +0000)]
Eliminate some unneeded code bits.

18 years agoDon't hard-code port numbers, let the user specify them.
Robert Watson [Thu, 6 Oct 2005 12:20:33 +0000 (12:20 +0000)]
Don't hard-code port numbers, let the user specify them.

18 years agoExport PAGE_SIZE from genassym.c, and include assym.s in bcopy_page.S,
Olivier Houchard [Thu, 6 Oct 2005 11:26:37 +0000 (11:26 +0000)]
Export PAGE_SIZE from genassym.c, and include assym.s in bcopy_page.S,
instead of <machine/param.h>.

18 years agoAdd boot.nfsroot.options loader tunable.
Pawel Jakub Dawidek [Thu, 6 Oct 2005 11:18:34 +0000 (11:18 +0000)]
Add boot.nfsroot.options loader tunable.
It allows to specify options for NFS root file system.
Currently supported options are: soft, intr, conn, lockd.

I'm adding this functionality mostly for 'lockd' option, which is only
honored when performing the initial mount and will be silently ignored
if used while updating the mount options.

This will allow to use flock(2) without the need of using varmfs or
rpc.lockd and friends.

Example of use:
boot.nfsroot.options="intr,lockd"

MFC after: 2 weeks

18 years agoAdd strtok() and strtok_r() function to libkern.
Pawel Jakub Dawidek [Thu, 6 Oct 2005 11:10:09 +0000 (11:10 +0000)]
Add strtok() and strtok_r() function to libkern.

MFC after: 2 weeks

18 years agoImprove realism of benchmark httpd: return some HTTP headers as part
Robert Watson [Thu, 6 Oct 2005 10:28:31 +0000 (10:28 +0000)]
Improve realism of benchmark httpd: return some HTTP headers as part
of the sendfile() system call.

18 years agoCompile with -DHAVE_LSTAT since, for whatever reason, the configure script
Tim J. Robbins [Thu, 6 Oct 2005 09:49:37 +0000 (09:49 +0000)]
Compile with -DHAVE_LSTAT since, for whatever reason, the configure script
shipped with GNU cpio 2.6 fails to test for it.

18 years agoAdd basic simplified HTTP benchmark tools to the netrate suite:
Robert Watson [Thu, 6 Oct 2005 08:41:08 +0000 (08:41 +0000)]
Add basic simplified HTTP benchmark tools to the netrate suite:

- http is a lightweight, multithreaded HTTP query tool, which performs
  a timed measurement of the rate at which it can download files using
  single-fetch HTTP/1.0.  Other than specifying the IP and a URL path,
  it requires zero configuration.

- httpd is a lightweight, multithreaded HTTP server tool, which exports
  a single file of choice to the HTTP client, and responds with it no
  matter what the request.  Other than specifying the file to export,
  it requires zero configuration.

The goal of these tools is to measure the network costs associated with
HTTP serving, rather than file system, HTTP protocol parsing, error
handling, etc, and as such, parts relating to less interesting components
of HTTP testing are intentionally omitted.  Both are linked against
libpthread by default.

18 years agoFix a nasty typo. Change:
Pawel Jakub Dawidek [Thu, 6 Oct 2005 08:30:40 +0000 (08:30 +0000)]
Fix a nasty typo. Change:
if (foo);
bar();
to:
if (foo)
bar();
Really, really nasty bug and a very nice catch of mine.

Unfortunately, I'll not become a hero of the day, because the code is
commented out.