dragonfly.git
17 years agoAdd entry for the CAPS IPC library. It is now possible to refer to the
Hiten Pandya [Mon, 10 May 2004 13:37:35 +0000 (13:37 +0000)]
Add entry for the CAPS IPC library.  It is now possible to refer to the
CAPS library in manual pages.

17 years agoCorrect the use of the .Dx/.Fx macro.
Hiten Pandya [Mon, 10 May 2004 13:22:50 +0000 (13:22 +0000)]
Correct the use of the .Dx/.Fx macro.

17 years agoRemove erroneous use of the `Fl' mdoc macro and replace it with
Hiten Pandya [Mon, 10 May 2004 13:17:41 +0000 (13:17 +0000)]
Remove erroneous use of the `Fl' mdoc macro and replace it with
a an escaped hyphen.

17 years agoMdoc(7) police:
Hiten Pandya [Mon, 10 May 2004 13:16:43 +0000 (13:16 +0000)]
Mdoc(7) police:

* use .Po/.Pc for parenthesis that extend more than one line

* correct position of the .Fx macro to silence mdoc errors

17 years agoMdoc(7) police:
Hiten Pandya [Mon, 10 May 2004 13:11:12 +0000 (13:11 +0000)]
Mdoc(7) police:

* move the .Dx macro onto second line so that it does not generate
  an mdoc error.

* correct and simplify a nearby sentence.

17 years agoRemove unneeded empty line to silence mdoc(7) warnings.
Hiten Pandya [Mon, 10 May 2004 13:07:18 +0000 (13:07 +0000)]
Remove unneeded empty line to silence mdoc(7) warnings.

17 years agoCorrect mdoc(7).
Hiten Pandya [Mon, 10 May 2004 13:06:53 +0000 (13:06 +0000)]
Correct mdoc(7).

* use .Po/.Pc for parenthesis which extend more than a line

* .In is not a callable macro from anything other than SYNOPSIS,
  use .Pa (pathname) macro instead

17 years agoUpdate the suser(9) manual page about reality.
Hiten Pandya [Mon, 10 May 2004 13:00:37 +0000 (13:00 +0000)]
Update the suser(9) manual page about reality.

* cleanup prototypes and add suser_proc(9) and suser_cred(9)

* use correct english and grammer, nuke hard sentence breaks

* remove deprecated and old information

* inform about the necessity of doing credential checks
  (i.e. only if it is attached to a process)

* cleanup mdoc(7) and bump date

17 years agoUpdate the KASSERT(9) manual page to reality.
Hiten Pandya [Mon, 10 May 2004 12:22:36 +0000 (12:22 +0000)]
Update the KASSERT(9) manual page to reality.

* document the KKASSERT(9) macro

* cleanup sentences and grammar, consolidate information

* use correct mdoc(7)

* update EXAMPLES section

17 years agoUpdate the DELAY(9) manual page about the header file where
Hiten Pandya [Mon, 10 May 2004 12:07:20 +0000 (12:07 +0000)]
Update the DELAY(9) manual page about the header file where
it lives.  Cleanup some mdoc(7) while I am here.

17 years agoUpdate the tsleep(9) manual page about our reality.
Hiten Pandya [Mon, 10 May 2004 12:04:36 +0000 (12:04 +0000)]
Update the tsleep(9) manual page about our reality.

* update prototype of tsleep(9)

* remove information about deprecated interfaces which existed
  in FreeBSD-3.x/4.x land, such as asleep/await etc.

* provide an IMPLEMENTATION NOTES section which informs the user
  about why we do not require priority information for tsleep(9).

* explain the P_SINTR flag.

* cleanup mdoc(7), bump the date and provide more informationa in
  the description line of the manual page so it easily appears when
  an apropos for `sleep' or 'block' is done.

Note, the MLINKs to the deprecated interfaces have not been removed
so that if someone comes hoping along looking for it, they are
directed to a manual page which at the least provides some information
on the subject of waiting on events.

17 years agoAdd MLINK busdma(9) which points to bus_dma(9).
Hiten Pandya [Mon, 10 May 2004 11:20:46 +0000 (11:20 +0000)]
Add MLINK busdma(9) which points to bus_dma(9).

17 years agoRemove newline from panic(9) message, it is redundant.
Hiten Pandya [Mon, 10 May 2004 11:05:13 +0000 (11:05 +0000)]
Remove newline from panic(9) message, it is redundant.

17 years agoRemove newline from panic(9) message, it is redundant.
Hiten Pandya [Mon, 10 May 2004 10:51:32 +0000 (10:51 +0000)]
Remove newline from panic(9) message, it is redundant.

17 years agoRemove redundant newline in a call to panic(9).
Hiten Pandya [Mon, 10 May 2004 10:37:46 +0000 (10:37 +0000)]
Remove redundant newline in a call to panic(9).

17 years agoSync em(4) with FreeBSD current. Most important is the initial bus DMA support.
Joerg Sonnenberger [Mon, 10 May 2004 10:36:25 +0000 (10:36 +0000)]
Sync em(4) with FreeBSD current. Most important is the initial bus DMA support.
Also use callout directly and not timeout.

17 years agoFix a bug in bsd.port.mk that was causing 'make clean' to fail in some
Chris Pressey [Mon, 10 May 2004 04:46:01 +0000 (04:46 +0000)]
Fix a bug in bsd.port.mk that was causing 'make clean' to fail in some
ports directories with mysterious symptoms like 'cd: can't cd to &&'.

The problem was that the text of the DragonFly port override warning
message was mistakenly being injected into the output of the
'*-depends-list' targets.  Although the message was being explicitly
filtered out if the target was 'all-depends-list', the targets
'build-depends-list' and 'run-depends-list', exercised indirectly by
'make clean', still allowed it to slip through.

Encountered-by: walt <wa1ter@myrealbox.com> and others
Detective-work-by: walt <wa1ter@myrealbox.com>
Patch-written-by: cpressey
Approved-by: dillon
17 years agoAdd a readonly sysctl for the `kern.mmxopt' loader tunable (same name).
Hiten Pandya [Sun, 9 May 2004 22:56:22 +0000 (22:56 +0000)]
Add a readonly sysctl for the `kern.mmxopt' loader tunable (same name).

17 years agoMake a small grammar correction: "...most forms of the disklabel
Chris Pressey [Sun, 9 May 2004 22:55:31 +0000 (22:55 +0000)]
Make a small grammar correction: "...most forms of the disklabel
command access the..." instead of "...most disklabel access the..."

17 years agoStyle(9) cleanup to src/sys/vfs, stage 17/21: udf.
Chris Pressey [Sun, 9 May 2004 22:15:00 +0000 (22:15 +0000)]
Style(9) cleanup to src/sys/vfs, stage 17/21: udf.

- Convert K&R-style function definitions to ANSI style.

Note: I chose to leave the formatting of the existing ANSI declarations
alone, as changes to them would mess up the alignment of the associated
comments and the net effect would fail to make the source any more
readable.  A future cleanup could move these comments into the comment
blocks preceding each function definition.

Submitted-by: Andre Nathan <andre@digirati.com.br>
Additional-reformatting-by: cpressey
17 years agoFix two bugs in the lockf code. The first one is a missing reinitialization
Joerg Sonnenberger [Sun, 9 May 2004 11:51:10 +0000 (11:51 +0000)]
Fix two bugs in the lockf code. The first one is a missing reinitialization
of the type field if an existing lock is extended to cover a bigger range
with a different type. The second is related to the problem reported by
Joerg Anslik <joerg@anslik.de> and comes from capturing real uid changes,
but using the effective uid userinfo structure for the accounting.

17 years agoMove accounting of sendfile header bytes sent down one level to handle
Jeffrey Hsu [Sun, 9 May 2004 00:32:41 +0000 (00:32 +0000)]
Move accounting of sendfile header bytes sent down one level to handle
non-blocking sockets properly.

17 years agoKKASSERT that we require inp->inp_pcbinfo, in in_pcbinswildcardhash().
Hiten Pandya [Sat, 8 May 2004 13:30:52 +0000 (13:30 +0000)]
KKASSERT that we require inp->inp_pcbinfo, in in_pcbinswildcardhash().

17 years agoPeter Edwards brought up an interesting NFS bug which we both originally
Matthew Dillon [Sat, 8 May 2004 04:11:48 +0000 (04:11 +0000)]
Peter Edwards brought up an interesting NFS bug which we both originally
thought would be a fairly straightforward bug fix.  But it turns out to
require a nasty hack to fix.

The issue is that near the file EOF NFS uses piecemeal writes and
piecemeal buffer cache buffers.  The result is that manipulation through
the buffer cache only sets some of the m->valid bits in the associated
vm_page(s).  This case may also occur in the middle of a file if for
example a file is piecemeal written and then ftruncated to be much
larger (or lseek/write at a much higher seek position).

The nfs_getpages() routine was assuming that if m->valid was non-0, the
page is basically valid and no read rpc is required to fill it.

The problem is that if you mmap() a piecemeal VM page and fault it in,
m->valid is set to VM_PAGE_BITS_ALL (0xFF). Then, later, when NFS flushes
the buffer cache, only some of the m->valid bits are clear (e.g. 0xFC).
A later page fault will cause NFS to believe that the page is sufficiently
valid and vm_fault will then zero-out the first X bytes of the page when,
in fact, we really should have done an I/O to refill those X bytes.

The fix in PR misc/64816 (FreeBSD) tried to solve this by checking to see
if the m->valid bits were 'sufficiently valid' in the file EOF case but
tesing with fsx resulted in several failure modes.  This doesn't work
because (1) if you extend the file w/ ftruncate or lseek/write these
partially valid pages can end up in the middle of the file rather then
just at the end and (2) There may be a dirty buffer associated with these
pages, meaning that the pages may contain dirty data, and we cannot safely
overwrite the pages with a new read I/O.

The solution in this patch is to deal with the screwy m->valid bit clearing
but special-casing NFS and then having the BIO system clear ALL the m->valid
bits instead of just some of them when NFS calls vinvalbuf().  That way
m->valid will be set to 0 when the buffer is invalidated and the
nfs_getpages() code can be left doing it's simple 'if any m->valid bits
are set assume the whole page is valid' test.  In order for the BIO system
to safely be able to do this (so as not to invalidate portions of a VM page
associated with an adjacent buffer), the NFS io size has been further
restricted to be an integral multiple of PAGE_SIZE.

This is a terrible hack but there is no other way to fix the problem short
of rewriting the entire buffer cache.  We will do that eventually, but not
now.

Reported-by: Peter Edwards <peter.edwards@vordel.com>
Referencing-PR: misc/64816 by Patrick Mackinlay <patrick@spacesurfer.com>

17 years agoFix IPV6 listen(). It was simply a matter of a missing
Matthew Dillon [Sat, 8 May 2004 02:38:36 +0000 (02:38 +0000)]
Fix IPV6 listen().  It was simply a matter of a missing
in_pcbinswildcardhash() call.

Submitted-by: Jeffrey Hsu <hsu@freebsd.org>
Reported-by: "Erik P. Skaalerud" <erik@pentadon.com> and others
17 years agoMove the fsx filesystem tester program from /usr/src/tools/regression to
Matthew Dillon [Fri, 7 May 2004 18:04:46 +0000 (18:04 +0000)]
Move the fsx filesystem tester program from /usr/src/tools/regression to
/usr/src/test/stress and add a sample script.

17 years agoAdd the filesystem/NFS stress tester program, adapted for BSD by Jordan
Matthew Dillon [Fri, 7 May 2004 17:51:02 +0000 (17:51 +0000)]
Add the filesystem/NFS stress tester program, adapted for BSD by Jordan
Hubbard of Apple, originally written by Silicon Graphics, Inc, and
modified by many people, including the SUSE Linux project.

17 years agoMerge rev 1.10 from FreeBSD:
Joerg Sonnenberger [Fri, 7 May 2004 14:37:31 +0000 (14:37 +0000)]
Merge rev 1.10 from FreeBSD:
- stream bus spce access functions, which do not perform a byte order
  conversion (while the normal access functinos would if the bus endianess
  differs from the CPU endianess).

17 years agoFix panic due to the way change_ruid handles the userinfo.
Joerg Sonnenberger [Fri, 7 May 2004 10:09:25 +0000 (10:09 +0000)]
Fix panic due to the way change_ruid handles the userinfo.
The old code assumed that both the structure for the old and the new
user exists. This works fine if change_ruid is called for a real change,
but doesn't if new_ruid == ruid since the old structure == new struct, which
is dropped in the middle.

17 years agoOne of the lf_create_range() calls in lf_clearlock() was passing a bogus
Matthew Dillon [Fri, 7 May 2004 05:45:31 +0000 (05:45 +0000)]
One of the lf_create_range() calls in lf_clearlock() was passing a bogus
owner (nrange->lf_owner instead of range->lf_owner), causing a panic
later on.  'atq now' triggers the panic.  This minor bug was introduced in
the recent fix to the malloc blocking issues.

Noticed-by: David Rhodus <drhodus@machdep.com>
17 years agoFollowup, fix some missing ODFM->OFDM conversions.
Matthew Dillon [Thu, 6 May 2004 20:46:37 +0000 (20:46 +0000)]
Followup, fix some missing ODFM->OFDM conversions.

Reported-by: Joerg Anslik <joerg@anslik.de>
17 years agoDocument the fact that SYSTIMERS operate without the MP lock.
Matthew Dillon [Thu, 6 May 2004 18:09:29 +0000 (18:09 +0000)]
Document the fact that SYSTIMERS operate without the MP lock.

17 years agoTwo more defines from FreeBSD.
Joerg Sonnenberger [Thu, 6 May 2004 16:34:51 +0000 (16:34 +0000)]
Two more defines from FreeBSD.

17 years agoAdd ifmedia infrastructure for the generic IEEE 802.11 support.
Joerg Sonnenberger [Thu, 6 May 2004 16:33:24 +0000 (16:33 +0000)]
Add ifmedia infrastructure for the generic IEEE 802.11 support.

Obtained-from: FreeBSD 5

17 years agoSwitch to the callout interface and rename the associated entry to sis_timer,
Joerg Sonnenberger [Thu, 6 May 2004 10:15:37 +0000 (10:15 +0000)]
Switch to the callout interface and rename the associated entry to sis_timer,
which is more accurate.

17 years agoUse M_INTWAIT instead of M_NOWAIT for the rest of the acpica support code.
Matthew Dillon [Wed, 5 May 2004 22:19:24 +0000 (22:19 +0000)]
Use M_INTWAIT instead of M_NOWAIT for the rest of the acpica support code.
Also remove (now unneeded) NULL checks.

17 years agoDo not trust the third-party ACPI code. Track memory mapping requests
Matthew Dillon [Wed, 5 May 2004 22:18:10 +0000 (22:18 +0000)]
Do not trust the third-party ACPI code.  Track memory mapping requests
via AcpiOsMapMemory() and match them up to unmapping requests.

Use M_INTWAIT instead of M_NOWAIT.

17 years agopmap_qremove() takes a page count, not a byte count. This should fix
Matthew Dillon [Wed, 5 May 2004 22:09:16 +0000 (22:09 +0000)]
pmap_qremove() takes a page count, not a byte count.  This should fix
acpica related booting issues that people have reported.

17 years agoAnother major mmx/xmm/FP commit. This is a combination of several patches
Matthew Dillon [Wed, 5 May 2004 19:26:44 +0000 (19:26 +0000)]
Another major mmx/xmm/FP commit.  This is a combination of several patches
but since the earlier patches didn't actually fix the crashing and corruption
issues we were seeing everything has been rolled into one well tested commit.

Make the FP more deterministic by requiring that npxthread and the FP state
be properly synchronized, and that the FP be in a 'safe' state (meaning
that mmx/xmm registers be useable) when npxthread is NULL.  Allow the FP
save area to be revectored.  Kernel entities which use the FP unit,
such as the bcopy code, must save the app state if it hasn't already been
saved, then revector the save area.

Note that combinations of operations must be protected by a critical section
or interrupt disablement.  Any clearing or setting npxthread combined with
an fxsave/fnsave/frstor/fxrstor/fninit must be protected as an atomic entity.
Since interrupts are threads and can preempt, such preemption will cause
a thread switch to occur and thus cause npxthread and the FP state to be
manipulated.  The kernel can only depend on the FP state being stable for its
use after it has revectored the FP save area.

This commit fixes a number of issues, including potential filesystem
corruption and kernel crashes.

17 years agoAdd bus_alloc_resource_any(9).
Hiten Pandya [Wed, 5 May 2004 16:57:11 +0000 (16:57 +0000)]
Add bus_alloc_resource_any(9).

Obtained-from: FreeBSD-4

17 years agoSerialize access to lockf via pool tokens.
Joerg Sonnenberger [Wed, 5 May 2004 09:17:04 +0000 (09:17 +0000)]
Serialize access to lockf via pool tokens.

17 years agoAdd restrict keyword to string functions.
Jeffrey Hsu [Wed, 5 May 2004 00:17:45 +0000 (00:17 +0000)]
Add restrict keyword to string functions.

Identical to my changes to FreeBSD on Feb 9, 2003.

17 years agoFix an exit-race with ^T. If a process is exiting it may be detached from
Matthew Dillon [Tue, 4 May 2004 23:22:43 +0000 (23:22 +0000)]
Fix an exit-race with ^T.  If a process is exiting it may be detached from
its thread.  p_wmesg is actually p_thread->td_wmesg, so do not dereference
p_wmesg unless a thread is still attached to the process!

Reported-by: "Jonas Trollvik" <Jonas.Trollvik@telia.com>
17 years agoip6_input() must call the IP6_EXTHDR_CHECK() macro with a specified return
Matthew Dillon [Tue, 4 May 2004 23:08:43 +0000 (23:08 +0000)]
ip6_input() must call the IP6_EXTHDR_CHECK() macro with a specified return
value of EASYNC instead of <empty>.

17 years agoA memory ordering barrier is needed in crit_exit() ensure that td_pri
Matthew Dillon [Tue, 4 May 2004 17:13:04 +0000 (17:13 +0000)]
A memory ordering barrier is needed in crit_exit() ensure that td_pri
is adjusted before gd_reqflags is tested.

Reorder the tests in crit_exit() as a branch prediction optimization.
Check gd_reqflags first, since it is likely to be NULL, and td_pri second,
since thd td_pri check may oscillate depending on the critical section's
nesting level.

Load the globaldata pointer before adjusting td_pri in crit_exit_quick()
as an instruction ordering optimization.

17 years agoFix races in lf_getlock and lf_clearlock when waiting for memory.
Joerg Sonnenberger [Tue, 4 May 2004 17:00:55 +0000 (17:00 +0000)]
Fix races in lf_getlock and lf_clearlock when waiting for memory.

The current solution pre-allocates memory in the beginning of both
functions and frees unused before returning. If this is too costly,
keeping the last two lockf_range allocations in a per-CPU cache can
improve the performance further with minimal code changes.

17 years agoCorrect pre-processor conditional surrounding mmxopt's declaration by
Hiten Pandya [Tue, 4 May 2004 12:22:46 +0000 (12:22 +0000)]
Correct pre-processor conditional surrounding mmxopt's declaration by
taking CPU_DISABLE_SSE into account.

Noticed-by: LINT
17 years agonetif/cx/cx.c:
Hiten Pandya [Tue, 4 May 2004 12:12:13 +0000 (12:12 +0000)]
netif/cx/cx.c:
* Provide arguments to strlcpy() in correct order.

netif/cx/if_cx.c
* Comment-out unwanted prototypes and externs.

Noticed-by: LINT
17 years agoBring le(4) up-to-speed with 64-bit physical addressing.
Hiten Pandya [Tue, 4 May 2004 12:09:36 +0000 (12:09 +0000)]
Bring le(4) up-to-speed with 64-bit physical addressing.

Noticed-by: LINT
17 years agoCatch up with if_ioctl prototype changes (see rev. 1.10 of net/if_var.h).
Hiten Pandya [Tue, 4 May 2004 12:08:45 +0000 (12:08 +0000)]
Catch up with if_ioctl prototype changes (see rev. 1.10 of net/if_var.h).

Noticed-by: LINT
17 years agoJust pass NULL to sync(), no need to create a `dummyarg'.
Hiten Pandya [Tue, 4 May 2004 12:06:44 +0000 (12:06 +0000)]
Just pass NULL to sync(), no need to create a `dummyarg'.

Noticed-by: LINT
17 years agoHandle UIO_USERISPACE (just fallthrough to UIO_NOCOPY), to silence
Hiten Pandya [Tue, 4 May 2004 12:05:29 +0000 (12:05 +0000)]
Handle UIO_USERISPACE (just fallthrough to UIO_NOCOPY), to silence
build warnings.

Noticed-by: LINT
17 years agoBring the I4B layer up-to-speed with 64-bit physical addressing.
Hiten Pandya [Tue, 4 May 2004 12:03:49 +0000 (12:03 +0000)]
Bring the I4B layer up-to-speed with 64-bit physical addressing.

While I am there, add some preprocessor conditionals to deal with
FreeBSD-5 and DragonFly differences.

Noticed-by: LINT
17 years agoAdd a forward declaration of 'struct uidinfo'.
Hiten Pandya [Tue, 4 May 2004 11:58:26 +0000 (11:58 +0000)]
Add a forward declaration of 'struct uidinfo'.

Noticed-by: LINT
17 years agoMove around some #ifdefs to silence warnings.
Hiten Pandya [Tue, 4 May 2004 11:56:54 +0000 (11:56 +0000)]
Move around some #ifdefs to silence warnings.

While I am cleaning, add a #warning about spp_usrreq() not being
up-to-speed with reality.

Noticed-by: LINT
17 years agoUse the correct cast, ns_ifra_addr -> ns_ifaddr.
Hiten Pandya [Tue, 4 May 2004 11:54:40 +0000 (11:54 +0000)]
Use the correct cast, ns_ifra_addr -> ns_ifaddr.

Noticed-by: LINT
17 years agoClean warnings under DIAGNOSTIC.
Hiten Pandya [Tue, 4 May 2004 11:53:26 +0000 (11:53 +0000)]
Clean warnings under DIAGNOSTIC.

Noticed-by: LINT
17 years agoMerge with FreeBSD (RELENG_4) src/sys/msdosfs/msdosfs_vfsops.c,
Chris Pressey [Mon, 3 May 2004 19:08:08 +0000 (19:08 +0000)]
Merge ... FreeBSD (RELENG_4) src/sys/msdosfs/msdosfs_vfsops.c,
revision 1.60.2.8:

Handle the "next free cluster" field of an FSInfo block more
intelligently when it has the value 0xFFFFFFFF (details in FreeBSD
PR kern/62826).

Reviewed-by: hmp
17 years agoMerge with FreeBSD (RELENG_4) src/bin/mv/mv.c, revision 1.24.2.6:
Chris Pressey [Mon, 3 May 2004 18:54:37 +0000 (18:54 +0000)]
Merge ... FreeBSD (RELENG_4) src/bin/mv/mv.c, revision 1.24.2.6:

Fix a bug that would not allow a symbolic link to be moved if its
destination was a mount point (details in FreeBSD PR bin/64430).

Reviewed-by: hmp
17 years agoStyle(9) cleanup to src/sys/vfs, stage 17/21: specfs.
Chris Pressey [Mon, 3 May 2004 18:46:34 +0000 (18:46 +0000)]
Style(9) cleanup to src/sys/vfs, stage 17/21: specfs.

- Convert K&R-style function definitions to ANSI style.

Submitted-by: Andre Nathan <andre@digirati.com.br>
Additional-reformatting-by: cpressey
17 years agoipstat needs thread2.h for MP stuff and mycpu.
Matthew Dillon [Mon, 3 May 2004 18:43:22 +0000 (18:43 +0000)]
ipstat needs thread2.h for MP stuff and mycpu.

Reported-by: David Rhodus <drhodus@machdep.com>
17 years agoPOSIX lock resource limit part 3/4
Joerg Sonnenberger [Mon, 3 May 2004 16:06:27 +0000 (16:06 +0000)]
POSIX lock resource limit part 3/4

This splits "struct lockf" into the general book-keeping of ranges and
blocked request and the "struct lockf_range" which constists of the data
for a specific range. Adjust the interface of lf_advlock to remove one
level of pointer indirection and embedded "struct lockf" directly in the
inodes. Don't mess with wait channels any more.

Change the algorithm for determing locks to a more direct approach, which
both simplifies the lock acquisition and proper book-keeping of the number
of ranges currently used. The later is necessary to prevent local resource
exhaustion.

The code is not fully malloc block-safe, but as good or bad as
the old code.

Add the kernel part of the posixlocks rlimit. This is the maximum number of
POSIX lock ranges any user can acquire. These numbers are tracked for each
user and process and checked at lock/unlock time. If a process changes uid,
its locks are transfered to the new uid which can effectivly boost that
number above the limit.

This is based on the patch set from Devon H. O'Dell <dodell@sitetronics.com>
for the general infrastructure with some adjustment to better integrate with
the new lockf code.

17 years agoMake IP statistics counters per-CPU so they can be updated safely.
Hiten Pandya [Mon, 3 May 2004 15:18:25 +0000 (15:18 +0000)]
Make IP statistics counters per-CPU so they can be updated safely.

* For SMP, we index into the array with the current CPU's
  as ipstats_ary[gd->gd_cpuid], and for UP we just return
  struct at ipstats_ary[0] (CPU-0).

* Rename the structure from ipstat to ip_stats.

* Wrap function definition of CPU counter aggregation in a
  macro called CPU_STATS_FUNC() to avoid duplication.

* Retain support for resetting the counters using netstat(1).

17 years agoStyle(9) cleanup to src/sys/vfs, stage 16/21: smbfs.
Chris Pressey [Mon, 3 May 2004 05:19:50 +0000 (05:19 +0000)]
Style(9) cleanup to src/sys/vfs, stage 16/21: smbfs.

- Convert K&R-style function definitions to ANSI style.

Submitted-by: Andre Nathan <andre@digirati.com.br>
Additional-reformatting-by: cpressey
17 years ago(non bug) The hash routines are never called with a size of 1, but make
Matthew Dillon [Sun, 2 May 2004 07:59:34 +0000 (07:59 +0000)]
(non bug) The hash routines are never called with a size of 1, but make
the minimum size 2 to avoid a degenerate masking case.

17 years agoWe must pmap_qremove() pages that we previously pmap_qenter()'d before
Matthew Dillon [Sun, 2 May 2004 07:57:45 +0000 (07:57 +0000)]
We must pmap_qremove() pages that we previously pmap_qenter()'d before
we can safely call kmem_free().  This corrects a serious corruption issue
that occured when using PIPE algorithms other then the default.

The default SFBUF algorithm was not effected by this bug.

17 years agoStyle(9) cleanup to src/sys/vfs, stage 15/21: procfs.
Chris Pressey [Sun, 2 May 2004 03:05:11 +0000 (03:05 +0000)]
Style(9) cleanup to src/sys/vfs, stage 15/21: procfs.

- Convert K&R-style function definitions to ANSI style.

Submitted-by: Andre Nathan <andre@digirati.com.br>
Additional-reformatting-by: cpressey
17 years agoCommit an update to the pipe code that implements various pipe algorithms.
Matthew Dillon [Sat, 1 May 2004 18:16:46 +0000 (18:16 +0000)]
Commit an update to the pipe code that implements various pipe algorithms.
Note that the newer algorithms are either experimental or only exist for
testing purposes.  The default remains the same (sfbuf mode), which is
considered to be stable.  The code is just too useful not to commit it.

Add pmap_qenter2() for installing cpu-localized KVM mappings.

Add pmap_page_assertzero() which will be used in a later diagnostic commit.

17 years agoAdd bcopyb() back in for the PCVT driver. bcopyb() is explicitly
Matthew Dillon [Sat, 1 May 2004 03:38:36 +0000 (03:38 +0000)]
Add bcopyb() back in for the PCVT driver.  bcopyb() is explicitly
byte-granular for the few (one?) memory mapped device which cannot always
handle 16 or 32 bit ops.

Reported-by: David Rhodus
17 years agoClear npxthread before setting CR0_TS.
Matthew Dillon [Sat, 1 May 2004 00:28:55 +0000 (00:28 +0000)]
Clear npxthread before setting CR0_TS.

Turn off MMX/XMM copy support by default until I track down all the bugs.
It can be turned on by setting kern.mmxopt=1 in /boot/loader.conf.

17 years agoFix another bug in the recent bcopy revamp. The range checking was
Matthew Dillon [Fri, 30 Apr 2004 09:44:16 +0000 (09:44 +0000)]
Fix another bug in the recent bcopy revamp.   The range checking was
branching to the wrong copyin_fault/copyout_fault address.

17 years agoFix a race in the FP copy code. If we setup our temporary FP save area
Matthew Dillon [Fri, 30 Apr 2004 02:59:14 +0000 (02:59 +0000)]
Fix a race in the FP copy code.  If we setup our temporary FP save area
before we check npxthread it is possible for a one-instruction-window
interrupt to come along and save the application FP state to our temporary
area and then clear npxthread, causing the application FP state to be thrown
away.

Also, if there is no app FP state (npxthread is NULL), it is possible
once we set npxthread=curthread for an interrupt to come along and save
bogus FP state to our temporary save area before we have a chance to
fninit (one instruction window since we clts just prior to the fninit),
causing the fninit to fault and npxdna to restore the bogus state.

Use a critical section to prevent these cases from occuring.

17 years agoFix a race in npxdna(). If an interrupt occurs after we have set npxthread
Matthew Dillon [Fri, 30 Apr 2004 02:52:28 +0000 (02:52 +0000)]
Fix a race in npxdna().  If an interrupt occurs after we have set npxthread
but before we call fxrstor() the thread switch would save someone else's
FP state to our PCB.

Fix a minor link problem when using CPU_DISABLE_SSE.

17 years agoCorrect a bug in the last FPU optimized bcopy commit. The user FPU state
Matthew Dillon [Fri, 30 Apr 2004 00:59:55 +0000 (00:59 +0000)]
Correct a bug in the last FPU optimized bcopy commit.  The user FPU state
was being corrupted by interrupts.

Fix the bug by implementing a feature described as a missif in the original
FreeBSD comments... add a pointer to the FP saved state in the thread
structure so routines which 'borrow' the FP unit can simply revector the
pointer temporarily to avoid corruption of the original user FP state.

The MMX_*_BLOCK macros in bcopy.s have also been simplified somewhat.  We
can simplify them even more (in the future) by reserving FPU save space in
the per-cpu structure instead of on the stack.

17 years agoRemove the (now non existant) i486_bzero assignment for I486_CPU.
Matthew Dillon [Thu, 29 Apr 2004 19:43:35 +0000 (19:43 +0000)]
Remove the (now non existant) i486_bzero assignment for I486_CPU.

17 years agoMake SF_BUF_HASH() into an inline routine, sf_buf_hash(), and add an
Matthew Dillon [Thu, 29 Apr 2004 17:31:02 +0000 (17:31 +0000)]
Make SF_BUF_HASH() into an inline routine, sf_buf_hash(), and add an
additional offset to avoid folding that might occur due to cache line
selection effects.  This does not appear to make much of a difference but
I decided to keep it anyway.

17 years agoMake hash tables one power of 2 larger so they don't (generally) fold
Matthew Dillon [Thu, 29 Apr 2004 17:29:16 +0000 (17:29 +0000)]
Make hash tables one power of 2 larger so they don't (generally) fold
nodes as much.  Before if you requested a hash table of 63 elements
it would create a 32 entry hash table.  Now it creates a 64 entry hash
table (and 128 entry if you specify 65 elements).

17 years agoRewrite the optimized memcpy/bcopy/bzero support subsystem. Rip out the
Matthew Dillon [Thu, 29 Apr 2004 17:25:03 +0000 (17:25 +0000)]
Rewrite the optimized memcpy/bcopy/bzero support subsystem.  Rip out the
old FreeBSD code almost entirely.

* Add support for stacked ONFAULT routines, allowing copyin and copyout to
  call the general memcpy entry point instead of rolling their own.

* Split memcpy/bcopy and bzero into their own files

* Add support for XMM (128 bit) and MMX (64 bit) media instruction copies

* Rewrite the integer code.  Also note that most of the previous integer
  and FP special case support had been ripped out of DragonFly long ago
  in that the assembly was no longer being referenced.  It doesn't make
  sense to have a dozen different zeroing/copying routines so focus on
  the ones that work well with recent (last ~5 years) cpus.

* Rewrite the FP state handling code.  Instead of restoring the FP state
  let it hang, which allows userland to make multiple syscalls and/or for
  the system to make multiple bcopy()/memcpy() calls without having to
  save/restore the FP state on each call.  Userland will take a fault when
  it needs the FP again.

  Note that FP optimized copies only occur for block sizes >= 2048 bytes,
  so this is not something that userland, or the kernel, will trip up on
  every time it tries to do a bcopy().

* LWKT threads need to be able to save the FP state, add the simple
  conditional and 5 lines of assembly required to do that.

AMD Athlon notes: 64 bit media instructions will get us 90% of the way
there.  It is possible to squeeze out slightly more memory bandwidth from
the 128 bit XMM instructions (SSE2).  While it does not exist in this commit
there are two additional features that can be used:  prefetching and
non-temporal writes.  Prefetching is a 3dNOW instruction and can squeeze
out significant additionaL performance if you fetch ~128 bytes ahead of
the game, but I believe it is AMD-only.  Non-temporal writes can double
UNCACHED memory bandwidth, but they have a horrible effect on L1/L2
performance and you can't mix non-temporal writes with normal writes without
completely destroying memory performance (e.g. multiple GB/s -> less then
100 MBytes/sec).

Neither prefetching nor non-temporal writes are implemented in this commit.

17 years agoAdd mem1 and mem2 .... memory copying and zeroing test suites, making it
Matthew Dillon [Thu, 29 Apr 2004 16:14:53 +0000 (16:14 +0000)]
Add mem1 and mem2 .... memory copying and zeroing test suites, making it
fairly easy for anyone to test various copying and zeroing memory algorithms
and compare them against other algorithms.

17 years agoDue to pipe buffer chunking the reader side of the pipe was not traversing
Matthew Dillon [Thu, 29 Apr 2004 16:05:21 +0000 (16:05 +0000)]
Due to pipe buffer chunking the reader side of the pipe was not traversing
its entire buffer, creating skewed statistics for block sizes > 64K.

Reduce the timing interval from 6 seconds to 3.

17 years agoMove the Plug'n'Play BIOS support into a separate file. This is included
Joerg Sonnenberger [Thu, 29 Apr 2004 12:11:16 +0000 (12:11 +0000)]
Move the Plug'n'Play BIOS support into a separate file. This is included
with "device pnpbios" instead of "options PNPBIOS".

This is still not included by default in GENERIC.

While at it, convert some u_intXX_t, u_short and u_int to uintXX_t in
preparation for AMD64.

17 years ago1) Move the tcp_stats structure back to netinet/tcp_var.h.
Hiten Pandya [Thu, 29 Apr 2004 10:06:41 +0000 (10:06 +0000)]
1) Move the tcp_stats structure back to netinet/tcp_var.h.
2) Remove netinet/tcp_stats.h because it is no longer needed.

Requested by: Jeffrey Hsu

17 years agoFix compilation of profiling.
Hiten Pandya [Wed, 28 Apr 2004 22:05:09 +0000 (22:05 +0000)]
Fix compilation of profiling.

Requested by: David Rhodus <drhodus@machdep.com>

17 years agoRemember if an inpcb was entered into the wildcard table to save
Jeffrey Hsu [Wed, 28 Apr 2004 08:00:35 +0000 (08:00 +0000)]
Remember if an inpcb was entered into the wildcard table to save
some cycles when a connection is closed.

17 years agoConditionalize accept_filter variable on defined(INET).
Joerg Sonnenberger [Wed, 28 Apr 2004 06:59:27 +0000 (06:59 +0000)]
Conditionalize accept_filter variable on defined(INET).

17 years agoRevamp the PIPE test a bit. Use a calibration loop to make the test always
Matthew Dillon [Wed, 28 Apr 2004 00:08:55 +0000 (00:08 +0000)]
Revamp the PIPE test a bit.  Use a calibration loop to make the test always
run for a consistent period of time (around 6 seconds) no matter what the
specified block size is.  Allow a third 'label' argument to be specified
and reformat the MB/sec output to include the label and block size
to make it easier to pick off results for gnuplot.  Finally, use mmap()
instead of malloc() to create a cache-friendly read and write buffer to
reduce noise in the performance results.

17 years agoBring in the following revs from FreeBS-4:
Matthew Dillon [Mon, 26 Apr 2004 20:26:59 +0000 (20:26 +0000)]
Bring in the following revs from FreeBS-4:

    1.250.2.25  +3 -2      src/sys/i386/i386/pmap.c
    1.33.2.6    +2 -2      src/sys/vm/pmap.h
    1.187.2.25  +3 -2      src/sys/vm/vm_map.c

Suggested-by: Alan Cox <alc@cs.rice.edu>
17 years agonextsoftcheck must be a volatile pointer, not a pointer to a volatile.
Matthew Dillon [Mon, 26 Apr 2004 20:06:28 +0000 (20:06 +0000)]
nextsoftcheck must be a volatile pointer, not a pointer to a volatile.

Reported-by: YONETANI Tomokazu <qhwt+dragonfly-commits@les.ath.cx>
17 years agoFix a bug noted by David Rhodus and removes minor redundancy.
Matthew Dillon [Mon, 26 Apr 2004 19:57:18 +0000 (19:57 +0000)]
Fix a bug noted by David Rhodus and removes minor redundancy.

Submitted-by: Sascha Wildner <saw@online.de>
17 years agoIf the server goes away while the client is trying to copy a message from
Matthew Dillon [Mon, 26 Apr 2004 17:06:18 +0000 (17:06 +0000)]
If the server goes away while the client is trying to copy a message from
it, the kernel may panic with a null-pointer indirection through the caps
ci_td field (which becomes NULL).  The field is properly becoming NULL,
the culprit was some debugging code that indirected through it without
checking first.

Reported-by: Chris Pressey <cpressey@catseye.mine.nu>
17 years agoAdd missing function prototype.
Chris Pressey [Sun, 25 Apr 2004 18:54:32 +0000 (18:54 +0000)]
Add missing function prototype.

17 years agoCosmetic changes.
David Rhodus [Sun, 25 Apr 2004 18:18:43 +0000 (18:18 +0000)]
Cosmetic changes.

17 years agoLeave out acpica5 from the device build path for a little longer, well
David Rhodus [Sun, 25 Apr 2004 17:40:21 +0000 (17:40 +0000)]
Leave out acpica5 from the device build path for a little longer, well
at least until the stabilization faze is over.

17 years agoCosmetic changes.
David Rhodus [Sun, 25 Apr 2004 17:28:34 +0000 (17:28 +0000)]
Cosmetic changes.

17 years agoSync libcr with libc.
Joerg Sonnenberger [Sun, 25 Apr 2004 12:40:50 +0000 (12:40 +0000)]
Sync libcr with libc.

17 years agoSmall style fix
Joerg Sonnenberger [Sun, 25 Apr 2004 12:22:14 +0000 (12:22 +0000)]
Small style fix

17 years agoFix bsd.port.subdir.mk by adding the normal environment hacks
Joerg Sonnenberger [Sun, 25 Apr 2004 11:02:18 +0000 (11:02 +0000)]
Fix bsd.port.subdir.mk by adding the normal environment hacks

17 years agoSupport for more video modes: accept mode names like MODE_<NUMBER> where
Matthew Dillon [Sun, 25 Apr 2004 06:35:32 +0000 (06:35 +0000)]
Support for more video modes: accept mode names like MODE_<NUMBER> where
<NUMBER> is the video mode number from the vidcontrol -i mode output.
MODE_13 is 320x200, for example...

Change the default geometry of raster modes: calculate rows and columns
using the font width and height. This results in the row * col geometry
being as large as possible if no geometry is specified by the user. If
no font is specified the current font's height is used. The old
vidcontrol used a default geometry of 80x25 for raster modes.

Remove restrictions on the range of background colors for graphics modes.

Implement a cleaner revert mechanism: in case something goes wrong we
restore the previous settings and give a message telling what exactly
went wrong. Unfortunately, there are several parameters that cannot
(yet) be saved and restored due to restrictions in the syscons driver:
screen saver timeout, cursor type, mouse character, mouse show/hide
state, vty switching on/off state, history buffer size and history
buffer contents are not saved because the syscons driver doesn't provide
ioctl()s to read those parameters. Font maps are not restored because
the syscons driver won't let us load a font map without setting it.

Submitted-by: Sascha Wildner <saw@online.de>
17 years agoThe "Hashed Timers and Hierarchical Wheels: Data Structures for the
Hiten Pandya [Sun, 25 Apr 2004 04:04:59 +0000 (04:04 +0000)]
The "Hashed Timers and Hierarchical Wheels: Data Structures for the
Efficient Implementation of a Timer Facility" paper was co-author'ed
by T. Lauk, not A. Lauk.

Adjust nearby whitespace at the same time.

17 years ago#ifdef out the PCATCH/CURSIG code for userland (libcaps), it only applies
Matthew Dillon [Sat, 24 Apr 2004 20:59:10 +0000 (20:59 +0000)]
#ifdef out the PCATCH/CURSIG code for userland (libcaps), it only applies
to kernelland.

include <machine/cpufunc.h> in order to get the memory barrier functions.