13 years agoRemove extraneous line in comment.
Peter Avalos [Thu, 5 Jul 2007 04:56:38 +0000 (04:56 +0000)]
Remove extraneous line in comment.

Obtained-from: FreeBSD

13 years agoFix a race condition in the flushing of commands that
Peter Avalos [Thu, 5 Jul 2007 04:39:25 +0000 (04:39 +0000)]
Fix a race condition in the flushing of commands that
have completed across the bus but not to the host before
processing of an exception condition (busfree, bus reset,
etc.).  When flushing the controller of completed commands,
we also look for packetized commands that have completed
with good status and are stored in the "good status fifo".
The hardware will post to the good status fifo even if
data for that command is still active in a FIFO.  In
one particular failure case, a command outstanding on the
bus reconnected, transferred data into a FIFO, and provided
good status while the host driver was processing an expected
busfree event (PPR message negotiation).  This resulted in
an entry in the good status fifo that we completed, but
since the sequencer was paused, the data in the data FIFO
for this command had never been transferred to the host.
Once the busfree processing was complete, the sequencer
was unpaused, and the data completed its transfer to the
host.  In some instances, the client for the data was notified
of the completion and attempted to view the data before
it arrived.  This case only occurred during the
multi-target probe of the SCSI bus while some devices are
negotiating to go packetized and some devices are already
running in packetized.

The fix is to run and FIFOs active with a context in the
good status fifo to completion before completing the command
to the SCSI layer.  This requies duplicating the FIFO rundown
operations in the host driver that would usually be handled
by the firmware, but there is no other alternative.

Don't blindly shutdown the SCB dma engine when restarting
the sequencer.  We may be killing an operation that is
not supposed to be cancelled.  The cases where we need to
shutdown these dma engines are already handled elsewhere in
the driver.

Fix a few more ahd_in?() -> ahd_in?_scbram() instances.

Obtained-from: FreeBSD

13 years agoaic79xx.h:
Peter Avalos [Thu, 5 Jul 2007 02:47:43 +0000 (02:47 +0000)]
Add softc flag to indicate that we have seen at
least one selection since the last bus reset or
SE/LVD bus change.

Fix a few style nits.

In ahd_update_pending_scbs(), only touch card registers
once we have found an SCB that needs to be updated.
This removes lots of clutter from PCI traces taken of
error recovery performed by the driver.

Short circuit the first selection iocell workaround handler
if we've run once since the last bus reset or iocell change.
This also removes clutter from PCI traces.

Note if completions are pending in the qoutfifo when we dump
card state.

Obtained-from: FreeBSD

13 years agoUse clr instead of an explicit mov from ALLZEROS
Peter Avalos [Thu, 5 Jul 2007 01:21:56 +0000 (01:21 +0000)]
Use clr instead of an explicit mov from ALLZEROS
to clear SCB_FIFO_USE_COUNT.  This is just a
syntactic change.

Obtained-from: FreeBSD

13 years agoImplement ahd_inq_scbram() and change the implemention
Peter Avalos [Thu, 5 Jul 2007 01:13:05 +0000 (01:13 +0000)]
Implement ahd_inq_scbram() and change the implemention
of ahd_inl_scbram to use ahd_inw_scbram instead of

Obtained-from: FreeBSD

13 years agoCorrect a typo in a comment.
Peter Avalos [Wed, 4 Jul 2007 23:52:04 +0000 (23:52 +0000)]
Correct a typo in a comment.

Add a comment in ahd_clear_critical_sections() about
our need to leave ENBUSFREE set in SIMODE1 while single

Re-arrange some delay loops so that we always perform
a read after any register write and before the delay.
This should make the delay loop more accurate.

When completing message processing for a packetized
commention, return the controller to a state where
invalid non-packetized phases will still cause protocol
violations.  These are the same operations as those
performed in the clear_target_state routine in the

Now that we have a chip with working ABORTPENDING
support (the 7901B), comment out the automatic use
of this feature until we can adequately test it.
The previous checkin updated the bug mask for the
7901B so this code was exercised.

When resetting the bus, perform an ahd_flush_device_writes()
call so that our reset assertion delay is acurately
timed from when the reset bit is written to the controller.

Obtained-from: FreeBSD

13 years agoFix an insufficient test of the message flags when determining whether
Matthew Dillon [Wed, 4 Jul 2007 23:36:26 +0000 (23:36 +0000)]
Fix an insufficient test of the message flags when determining whether
an abortable request has already completed or not.

Abort requests are sent to the same port as the original message which
means that the original message will have been processes and either replied
to or queued before the abort message is acted upon.  However, when an
abort message is replied the MSGF_DONE bit is *NOT* set until the reply
reaches the reply port, potentially requiring an IPI.

This can lead to a race where the code processing an abort request
incorrectly determines that the message has not yet been replied when in
fact it has, leading to a double-reply and a panic.

The solution is to test the MSGF_REPLY bit, which is set by the target
cpu (the one processing the original message) when replying to the message
prior to issuing any IPI.

Reported-by: Peter Avalos <pavalos@crater.dragonflybsd.org>
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue717>

13 years agoRemove an old comment that no longer applies.
Peter Avalos [Wed, 4 Jul 2007 23:04:13 +0000 (23:04 +0000)]
Remove an old comment that no longer applies.

Fix a jump in our unexpected non-packetized phase
handler to use an explicit label.  The old code
had a hardcoded jump offset that was off by one

Obtained-from: FreeBSD

13 years agoaic79xx.h:
Peter Avalos [Wed, 4 Jul 2007 22:56:30 +0000 (22:56 +0000)]
Add a 7901A specific feature definition.

Split out the general aic790X setup into it's own
setup handler that works on single and dual controllers.
Adjust all other PCI setup handlers to initialize the
chips basic features and type before calling the generic

Turn off a few Rev B workarounds that are not required
on the 7901B.

Obtained-from: FreeBSD

13 years agoTry to catch double-replies a little earlier so we get a more meaningful
Matthew Dillon [Wed, 4 Jul 2007 19:40:35 +0000 (19:40 +0000)]
Try to catch double-replies a little earlier so we get a more meaningful

13 years agoUpdate list of supported drivers in hostapd(8).
Sascha Wildner [Wed, 4 Jul 2007 16:52:40 +0000 (16:52 +0000)]
Update list of supported drivers in hostapd(8).

Add references to hostapd(8) on the pages of supported drivers.

13 years agoAdd a hostapd rc script.
Sascha Wildner [Wed, 4 Jul 2007 16:28:45 +0000 (16:28 +0000)]
Add a hostapd rc script.

Obtained-from: FreeBSD

13 years agoFix stupid mistake. Sorry.
Hasso Tepper [Wed, 4 Jul 2007 06:06:48 +0000 (06:06 +0000)]
Fix stupid mistake. Sorry.

13 years agoFix logic to avoid a potential deadlock in ahd_run_qoutfifo()
Peter Avalos [Tue, 3 Jul 2007 21:13:35 +0000 (21:13 +0000)]
Fix logic to avoid a potential deadlock in ahd_run_qoutfifo()
if we happen to catch the DMA engine in just the right state.

Obtained-from:  FreeBSD

13 years agoConvert to use cam_calc_geometry().
Peter Avalos [Tue, 3 Jul 2007 20:55:42 +0000 (20:55 +0000)]
Convert to use cam_calc_geometry().

Obtained-from:  FreeBSD

13 years agoRemove last usb_port.h defines usages from the tree - selwakeuppri(),
Hasso Tepper [Tue, 3 Jul 2007 19:28:16 +0000 (19:28 +0000)]
Remove last usb_port.h defines usages from the tree - selwakeuppri(),
config_pending_*(), config_detach(), clalloc(), clfree(), usb_malloc_type
and usb_proc_ptr.

Move some defines to bus/usb/usb.h and remove bus/usb/usb_port.h include
from there. Drivers that want to use portability macros have to include
<bus/usb/usb_port.h> directly.

13 years agoFrom FreeBSD's log:
Peter Avalos [Tue, 3 Jul 2007 18:51:45 +0000 (18:51 +0000)]
From FreeBSD's log:

Fixed about 50 million errors of infinity ulps and about 3 million errors
of between 1.0 and 1.8509 ulps for lgammaf(x) with x between -2**-21 and

As usual, the cutoff for tiny args was not correctly translated to
float precision.  It was 2**-70 but 2**-21 works.  Not as usual, having
a too-small threshold was worse than a pessimization.  It was just a
pessimization for (positive) args between 2**-70 and 2**-21, but for
the first ~50 million (negative) args below -2**-70, the general code
overflowed and gave a result of infinity instead of correct (finite)
results near 70*log(2).  For the remaining ~361 million negative args
above -2**21, the general code gave almost-acceptable errors (lgamma[f]()
is not very accurate in general) but the pessimization was larger than
for misclassified tiny positive args.

Now the max error for lgammaf(x) with |x| < 2**-21 is 0.7885 ulps, and
speed and accuracy are almost the same for positive and negative args
in this range.  The maximum error overall is still infinity ulps.

A cutoff of 2**-70 is probably wastefully small for the double precision
case.  Smaller cutoffs can be used to reduce the max error to nearly
0.5 ulps for tiny args, but this is useless since the general algrorithm
for nearly-tiny args is not nearly that accurate -- it has a max error of
about 1 ulp.

Obtained-from:  FreeBSD

13 years agoAdd a section on how to build the world inside a virtual kernel.
Matthew Dillon [Tue, 3 Jul 2007 18:05:55 +0000 (18:05 +0000)]
Add a section on how to build the world inside a virtual kernel.

13 years agoFix an issue which arises with the TAP interface when the highly
Matthew Dillon [Tue, 3 Jul 2007 17:40:51 +0000 (17:40 +0000)]
Fix an issue which arises with the TAP interface when the highly
experimental kern.intr_mpsafe is set.  TAP has to obtain the MP lock
when handling SIGIO.

Reported-by: Pawel Biernacki <kaktus@acn.pl>
13 years agoFix a number of races in the controlling terminal open/close code.
Matthew Dillon [Tue, 3 Jul 2007 17:22:14 +0000 (17:22 +0000)]
Fix a number of races in the controlling terminal open/close code.
This does not completely fix issue 715 but it should help reduce the
problem set.

* Integrate the revoke into ttyclosesession() so it can be issued as part
  of the same locking op.
* Check for races after acquiring the vnode lock and retry if necessary.
* Use vhold/vdrop to prevent destruction of the vnode during a possible
  race while we are attempting to obtain the lock.

Reported-by: Thomas Nikolajsen <thomas.nikolajsen@mail.dk> added the comment:
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue715>

13 years agoFix typo.
Hasso Tepper [Tue, 3 Jul 2007 07:21:08 +0000 (07:21 +0000)]
Fix typo.

13 years agoNuke USB_DO_ATTACH and remove device_t dv, since it is no longer needed.
Hasso Tepper [Tue, 3 Jul 2007 06:58:50 +0000 (06:58 +0000)]
Nuke USB_DO_ATTACH and remove device_t dv, since it is no longer needed.

Obtained-from: FreeBSD

13 years agoNuke the code specific to other BSDs.
Hasso Tepper [Tue, 3 Jul 2007 06:38:36 +0000 (06:38 +0000)]
Nuke the code specific to other BSDs.

13 years agoOptimizations, expanded comments, and accuracy fixes.
Peter Avalos [Tue, 3 Jul 2007 04:54:07 +0000 (04:54 +0000)]
Optimizations, expanded comments, and accuracy fixes.

For in-depth comments, see the FreeBSD cvs logs:
s_cbrt.c:  1.8-1.14
s_sbrtf.c: 1.8-1.17

Obtained-from:  FreeBSD

Hasso Tepper [Mon, 2 Jul 2007 23:52:05 +0000 (23:52 +0000)]

13 years agoOops, forgot space.
Sascha Wildner [Mon, 2 Jul 2007 19:32:34 +0000 (19:32 +0000)]
Oops, forgot space.

13 years agoAdd break after parsing the -n option.
Joe Talbott [Mon, 2 Jul 2007 17:44:00 +0000 (17:44 +0000)]
Add break after parsing the -n option.

13 years agoIf more then 2 virtual cpus are present, dedicate one to handle I/O
Matthew Dillon [Mon, 2 Jul 2007 17:15:10 +0000 (17:15 +0000)]
If more then 2 virtual cpus are present, dedicate one to handle I/O

13 years agoAdd usched_mastermask - a master cpu mask specifying which cpus user
Matthew Dillon [Mon, 2 Jul 2007 17:06:56 +0000 (17:06 +0000)]
Add usched_mastermask - a master cpu mask specifying which cpus user
processes can run on.  Default to all cpus.

13 years agoThe vkernel's copyin/copyout implementation is not MP safe, acquire and
Matthew Dillon [Mon, 2 Jul 2007 16:52:25 +0000 (16:52 +0000)]
The vkernel's copyin/copyout implementation is not MP safe, acquire and
release the MP lock.

13 years agoImplement an architecture call for contended spinlocks so the vkernel can
Matthew Dillon [Mon, 2 Jul 2007 16:52:01 +0000 (16:52 +0000)]
Implement an architecture call for contended spinlocks so the vkernel can
insert a usleep().

13 years agoA virtual kernel can cause a vm_page's hold_count to exceed 32768. Make
Matthew Dillon [Mon, 2 Jul 2007 15:57:48 +0000 (15:57 +0000)]
A virtual kernel can cause a vm_page's hold_count to exceed 32768.  Make
the field an int like it should have been in the first place.

13 years agoGive virtual kernels access to sysctl() prototypes and clean up warnings.
Matthew Dillon [Mon, 2 Jul 2007 15:18:53 +0000 (15:18 +0000)]
Give virtual kernels access to sysctl() prototypes and clean up warnings.

13 years agoMake the virtual kernel's systimer work with SMP builds. Have it
Matthew Dillon [Mon, 2 Jul 2007 14:47:27 +0000 (14:47 +0000)]
Make the virtual kernel's systimer work with SMP builds.  Have it
use the real system's systimer instead of gettimeofday().

13 years agoThere is no need to have ETHER_ALIGN define here.
Hasso Tepper [Mon, 2 Jul 2007 07:07:08 +0000 (07:07 +0000)]
There is no need to have ETHER_ALIGN define here.

13 years agoNuke USB_GET_SC and USB_GET_SC_OPEN macros.
Hasso Tepper [Mon, 2 Jul 2007 06:43:31 +0000 (06:43 +0000)]
Nuke USB_GET_SC and USB_GET_SC_OPEN macros.

13 years agoBecause the objcache caches up to two magazines on each cpu some pretty
Matthew Dillon [Mon, 2 Jul 2007 06:34:26 +0000 (06:34 +0000)]
Because the objcache caches up to two magazines on each cpu some pretty
bad degenerate conditions will be hit if the cluster limit is set too small
or the magazine size is set too large.

Detect the problem and reduce the magazine size to compensate.  If we hit
the minimum magazine size (16), increase the cluster limit to compensate.
Report the corrections on the console.

We also have the option of stealing magazines from other cpus, or reducing
the magazine size even further to handle extreme cases.

This should solve most of the objcache issues when ncpus is set to 31.

13 years agoPut a timeout on the umtx_sleep() in the idle loop and add conditional
Matthew Dillon [Mon, 2 Jul 2007 06:30:26 +0000 (06:30 +0000)]
Put a timeout on the umtx_sleep() in the idle loop and add conditional
debugging code to try to detect races.

13 years agoExhaust the virtual kernel network interface even if we cannot allocate
Matthew Dillon [Mon, 2 Jul 2007 05:38:28 +0000 (05:38 +0000)]
Exhaust the virtual kernel network interface even if we cannot allocate
mbufs, otherwise we stop getting interrupts and the packets just build up
in the TUN device.

13 years agosigwinch has to run with the big giant lock so use the DragonFly
Matthew Dillon [Mon, 2 Jul 2007 04:19:14 +0000 (04:19 +0000)]
sigwinch has to run with the big giant lock so use the DragonFly
interrupt API to handle it rather then running it directly from the
signal handler.  Fixes a panic.

13 years agoIncrease SMP_MAXCPU to 31. Can't do 32 (boo hoo!) because spinlocks need
Matthew Dillon [Mon, 2 Jul 2007 03:44:12 +0000 (03:44 +0000)]
Increase SMP_MAXCPU to 31.  Can't do 32 (boo hoo!) because spinlocks need
a bit in the cpumask.

Add DELAY()'s (usleep()'s) in the AP startup code where we spin on the MP
lock.  This greatly improves startup speed when you specify 31 cpus.

Fix a bug in the kqueue interrupt init.  The kqueue code was not registering
its interrupt soon enough which could cause the timer to stop generating

13 years agoAdd an option (-n ncpus) to specify the number of cpus a virtual kernel
Matthew Dillon [Mon, 2 Jul 2007 02:37:05 +0000 (02:37 +0000)]
Add an option (-n ncpus) to specify the number of cpus a virtual kernel
should simulate.  The virtual kernel must be built with options SMP.
1-32 cpus may be simulated regardless of the number of real cpus.  The
virtual kernel will create a thread for each cpu.

13 years agoThe real-kernel madvise and mcontrol system calls handle SMP interactions
Matthew Dillon [Mon, 2 Jul 2007 02:23:00 +0000 (02:23 +0000)]
The real-kernel madvise and mcontrol system calls handle SMP interactions
when manipulating virtual page tables.  Construct a new set of functions
for the virtual kernel to take advantage of this.

Add a cpu cache mask to the pmap structure for the virtual kernel which
allows us to invalidate per-cpu page table mappings simply by clearing
the mask.  Also reload PT1pde after a successful cache hit if the cpu
mask bit is found to be 0.

Redo most of the PTE handling code for the virtual kernel.  Use the new
invalidation function set and carefully deal with race conditions between
cpus.  Race conditions are far more serious with a SMP virtual kernel then
with a real kernel because there are effectively two levels of page table
caching instead of one, since the real kernel maintains a separate pmap
for each VM space under the virtual kernel's control in addition to the
standard TLB interactions.

13 years agoThe kernel perfmon support (options PERFMON) was trying to initialize its
Matthew Dillon [Mon, 2 Jul 2007 02:14:32 +0000 (02:14 +0000)]
The kernel perfmon support (options PERFMON) was trying to initialize its
device way too early in the boot sequence, resulting in a panic on SMP
boxes.  Move initialization to a bit later in the boot sequence.

Reported-by: Thomas Nikolajsen <sinknull@crater.dragonflybsd.org>
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue714>

13 years agosched_ithd() must be called from within a critical section.
Matthew Dillon [Mon, 2 Jul 2007 01:47:22 +0000 (01:47 +0000)]
sched_ithd() must be called from within a critical section.

13 years agoCopy a junk file from pc32 needed for <time.h>
Matthew Dillon [Mon, 2 Jul 2007 01:43:30 +0000 (01:43 +0000)]
Copy a junk file from pc32 needed for <time.h>

13 years agoOnly use the symbol returned by dladdr() if its address is <= the
Matthew Dillon [Mon, 2 Jul 2007 01:42:07 +0000 (01:42 +0000)]
Only use the symbol returned by dladdr() if its address is <= the
address we are trying to decode.

13 years agoClean up a kprintf() that was missing a newline.
Matthew Dillon [Mon, 2 Jul 2007 01:41:26 +0000 (01:41 +0000)]
Clean up a kprintf() that was missing a newline.

Submitted-by: Joe Talbott <josepht@cstone.net>
13 years agoImplement an architecture function cpu_mplock_contested() which is
Matthew Dillon [Mon, 2 Jul 2007 01:37:11 +0000 (01:37 +0000)]
Implement an architecture function cpu_mplock_contested() which is
called by the LWKT thread scheduler when the only thread(s) it can
schedule need the MP lock and the scheduler was unable to acquire the
MP lock.

On real systems this function just executes the cpu 'pause' instruction,
and on virtual systems this functions sleeps for a millisecond.

Use umtx_sleep() instead of sigpause() in the virtual kernel's idle loop
to interlock threads scheduled via a signal with the idle loop sleep.
This fixes a race condition that caused the vkernel to stop scheduling
(but there may be more issues, stay tuned).

13 years agoDo not allow umtx_sleep() to restart on a restartable signal. We want to
Matthew Dillon [Mon, 2 Jul 2007 01:30:07 +0000 (01:30 +0000)]
Do not allow umtx_sleep() to restart on a restartable signal.  We want to
return EINTR so the caller can handle side effects from the signal.

13 years agoNuke USB_MATCH*, USB_ATTACH* and USB_DETACH* macros.
Hasso Tepper [Sun, 1 Jul 2007 21:24:04 +0000 (21:24 +0000)]

13 years agoRemove .Pp before .Sh.
Sascha Wildner [Sun, 1 Jul 2007 17:23:25 +0000 (17:23 +0000)]
Remove .Pp before .Sh.

13 years agoAdd markup and clean up a bit.
Sascha Wildner [Sun, 1 Jul 2007 10:49:36 +0000 (10:49 +0000)]
Add markup and clean up a bit.

13 years agoAlso credit lots of help from Aggelos Economopoulos <aoiko@cc.ece.ntua.gr>
Matthew Dillon [Sun, 1 Jul 2007 04:02:33 +0000 (04:02 +0000)]
Also credit lots of help from Aggelos Economopoulos <aoiko@cc.ece.ntua.gr>
in the SMP virtual kernel commit.

13 years agoUse dladdr() to obtain symbol names when possible and try to dump the
Matthew Dillon [Sun, 1 Jul 2007 03:28:54 +0000 (03:28 +0000)]
Use dladdr() to obtain symbol names when possible and try to dump the
entire stack backtrace instead of just the first call.

13 years agoConditionalize SMP bits for non-SMP builds.
Matthew Dillon [Sun, 1 Jul 2007 03:04:15 +0000 (03:04 +0000)]
Conditionalize SMP bits for non-SMP builds.

13 years agoBring in all of Joe Talbott's SMP virtual kernel work to date, which makes
Matthew Dillon [Sun, 1 Jul 2007 02:51:45 +0000 (02:51 +0000)]
Bring in all of Joe Talbott's SMP virtual kernel work to date, which makes
virtual kernel builds with SMP almost get through a full boot.  This work

    * Creation of 'cpu' threads via libthread_xu
    * Globaldata initialization
    * AP synchronization
    * Bootstrapping to the idle thread
    * SMP pmap (mmu) functions
    * IPI handling

My part of this commit:

    * Bring all the signal interrupts under DragonFly's machine independant
      interrupt handler API.  This will properly deal with the MP lock
      and critical section handling.

    * Some additional pmap bits to handle SMP invalidation issues.

Submitted-by: Joe Talbott <josepht@cstone.net>
Additional-bits-by: Matt Dillon
13 years agoMore multi-threaded support for virtualization. Move the save context
Matthew Dillon [Sun, 1 Jul 2007 01:11:38 +0000 (01:11 +0000)]
More multi-threaded support for virtualization.  Move the save context
from the process structure to the lwp structure, cleaning up the vmspace
support structures at the same time.  This allows multiple LWPs in the
same process to be running a virtualization context at the same time.

13 years agomi_switch() and cpu_switch() are gone. Remove manpage and prototype.
Sascha Wildner [Sun, 1 Jul 2007 00:03:49 +0000 (00:03 +0000)]
mi_switch() and cpu_switch() are gone. Remove manpage and prototype.

13 years agoA signal is sent to a particular LWP must be delivered to that LWP and never
Matthew Dillon [Sat, 30 Jun 2007 23:38:31 +0000 (23:38 +0000)]
A signal is sent to a particular LWP must be delivered to that LWP and never
posted to the process generically.  Otherwise things like seg faults can
end up being posted to the wrong LWP.

13 years agoUse the actual function name in the message.
Sascha Wildner [Sat, 30 Jun 2007 21:52:19 +0000 (21:52 +0000)]
Use the actual function name in the message.

13 years agotvtohz() was split into tvtohz_low() and tvtohz_high() in Jan 2004.
Sascha Wildner [Sat, 30 Jun 2007 21:47:54 +0000 (21:47 +0000)]
tvtohz() was split into tvtohz_low() and tvtohz_high() in Jan 2004.

Update the manual page with some words from the comments in kern_clock.c.

13 years agoNuke PROC_(UN)LOCK, usb_callout_t, usb_kthread_create* and uio_procp.
Hasso Tepper [Sat, 30 Jun 2007 20:39:22 +0000 (20:39 +0000)]
Nuke PROC_(UN)LOCK, usb_callout_t, usb_kthread_create* and uio_procp.

13 years agoFix KASSERT messages.
Hasso Tepper [Sat, 30 Jun 2007 20:17:36 +0000 (20:17 +0000)]
Fix KASSERT messages.

13 years agoClean up a bit.
Sascha Wildner [Sat, 30 Jun 2007 19:20:48 +0000 (19:20 +0000)]
Clean up a bit.

13 years agoUse .Va for errno.
Sascha Wildner [Sat, 30 Jun 2007 19:03:52 +0000 (19:03 +0000)]
Use .Va for errno.

13 years agoTry to avoid accidental foot shooting by not allowing a virtual kernel
Matthew Dillon [Sat, 30 Jun 2007 05:54:03 +0000 (05:54 +0000)]
Try to avoid accidental foot shooting by not allowing a virtual kernel
to be installed unless DESTDIR is explicitly specified.

13 years agoMove the P_WEXIT check from lwpsignal() to kern_kill(). That is, disallow
Matthew Dillon [Sat, 30 Jun 2007 02:33:04 +0000 (02:33 +0000)]
Move the P_WEXIT check from lwpsignal() to kern_kill().  That is, disallow
signals to exiting processes but allow signals to threads that have not gone
through the exit interlock yet.  This allows exit1() to interlock the process
and still signal its LWPs.

Fix a bug in exit1() which was improperly using lwp_signotify() to wake up
LWPs to force the to exit.  This function is basically a NOP if there are
no signals pending to the LWP.  Send a real SIGKILL to the LWP instead.

This fixes a bug where vkernels get stuck in an exiting state and cannot be

Reported-by: Joe Talbott <josepht@cstone.net>
13 years agoUpdate the documentation for sys_checkpoint().
Matthew Dillon [Sat, 30 Jun 2007 01:59:41 +0000 (01:59 +0000)]
Update the documentation for sys_checkpoint().

13 years agoAdd MLINKS for checkpoint.1, because most point looking for information
Matthew Dillon [Sat, 30 Jun 2007 01:40:56 +0000 (01:40 +0000)]
Add MLINKS for checkpoint.1, because most point looking for information
out of the cold on checkpointing will probably try 'man checkpoint' more
often then 'man checkpt'.

13 years agoFlag the checkpoint descriptor so on restore we can identify it and use the
Matthew Dillon [Fri, 29 Jun 2007 23:40:00 +0000 (23:40 +0000)]
Flag the checkpoint descriptor so on restore we can identify it and use the
descriptor for the restore rather then trying to look up the original
checkpoint file.  This issue occurs when a program calls sys_checkpoint()

This allows a checkpoint-resume to be done on a copied checkpoint file,
or a gzipped (then gunzipped) checkpoint file, etc.  The original checkpoint
file no longer needs to remain intact.

Requested-by: _why <why@ruby-lang.org>
13 years agoNuke usb_ callout macros.
Hasso Tepper [Fri, 29 Jun 2007 22:56:31 +0000 (22:56 +0000)]
Nuke usb_ callout macros.

13 years agoImplement struct lwp->lwp_vmspace. Leave p_vmspace intact. This allows
Matthew Dillon [Fri, 29 Jun 2007 21:54:15 +0000 (21:54 +0000)]
Implement struct lwp->lwp_vmspace.  Leave p_vmspace intact.  This allows
vkernels to run threaded and to run emulated VM spaces on a per-thread basis.
struct proc->p_vmspace is left intact, making it easy to switch into and out
of an emulated VM space.  This is needed for the virtual kernel SMP work.

This also gives us the flexibility to run emulated VM spaces in their own
threads, or in a limited number of separate threads.  Linux does this and
they say it improved performance.  I don't think it necessarily improved
performance but its nice to have the flexibility to do it in the future.

13 years agoAdd some useful references to various manual pages which deal with random
Sascha Wildner [Fri, 29 Jun 2007 19:34:41 +0000 (19:34 +0000)]
Add some useful references to various manual pages which deal with random

Suggested-by: Robin Carey <robin_carey5@yahoo.co.uk>
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue708>

13 years agoThis is a simple little syslink test program which ping-pongs a 64K
Matthew Dillon [Fri, 29 Jun 2007 17:18:42 +0000 (17:18 +0000)]
This is a simple little syslink test program which ping-pongs a 64K
buffer around.

13 years agoClean up syslink a bit and add an abstraction that will eventually allow
Matthew Dillon [Fri, 29 Jun 2007 05:14:00 +0000 (05:14 +0000)]
Clean up syslink a bit and add an abstraction that will eventually allow
zero-copy support for I/O on syslink DMA bufs.

13 years agoAdd O_MAPONREAD (not yet implemented). This will have the semantics of
Matthew Dillon [Fri, 29 Jun 2007 05:12:40 +0000 (05:12 +0000)]
Add O_MAPONREAD (not yet implemented).  This will have the semantics of
replacing the underlying VM with a copy-on-write page mapping when possible.
Ultimately when used with syslink this will have the semantics of allowing
a fully shared mapping for syslink DMA buffers.

13 years agoAdd a new flag, XIOF_VMLINEAR, which requires that the buffer being mapped
Matthew Dillon [Fri, 29 Jun 2007 05:09:15 +0000 (05:09 +0000)]
Add a new flag, XIOF_VMLINEAR, which requires that the buffer being mapped
be contiguous within a single VM object.

13 years agoGet out-of-band DMA buffers working for user<->user syslinks. This
Matthew Dillon [Fri, 29 Jun 2007 00:18:05 +0000 (00:18 +0000)]
Get out-of-band DMA buffers working for user<->user syslinks.  This
allows the syslink protocol to operate in a manner very similar to the
way sophisticated DMA hardware works, where you have a DMA buffer attached
to a command.

Augment the syslink protocol to implement read, write, and read-modify-write
style commands.

Obtain the MP lock in places where needed because fileops are called without
it held now.  Our VM ops are not MP safe yet.

Use an XIO to map VM pages between userland processes.  Add additional
XIO functions to aid in copying data to and from a userland context.  This
removes an extra buffer copy from the path and allows us to manipulate pure
vm_page_t's for just about everything.

13 years agoClarify cpu localization requirements when using callout_stop() and
Matthew Dillon [Thu, 28 Jun 2007 20:24:57 +0000 (20:24 +0000)]
Clarify cpu localization requirements when using callout_stop() and

Fix a SMP race in callout_stop() where the callout structure was being
modified in an unsafe manner.

13 years agoNuke SIMPLEQ_* and logprintf.
Hasso Tepper [Thu, 28 Jun 2007 13:55:13 +0000 (13:55 +0000)]
Nuke SIMPLEQ_* and logprintf.

13 years agoRemove duplicate.
Hasso Tepper [Thu, 28 Jun 2007 09:33:33 +0000 (09:33 +0000)]
Remove duplicate.

Hasso Tepper [Thu, 28 Jun 2007 06:32:33 +0000 (06:32 +0000)]
USBDEVPTRNAME() and Static with help from sed(1).

13 years agoFix a bug-a-boo, the type uuid was being printed instead of the storage
Matthew Dillon [Wed, 27 Jun 2007 18:15:57 +0000 (18:15 +0000)]
Fix a bug-a-boo, the type uuid was being printed instead of the storage
uuid (so the type was being printed twice).

13 years agoUse kernel functions. I don't understand how I could miss these ...
Hasso Tepper [Wed, 27 Jun 2007 13:26:18 +0000 (13:26 +0000)]
Use kernel functions. I don't understand how I could miss these ...

13 years agoNuke the code specific to NetBSD/OpenBSD/FreeBSD at first. I doubt anyone
Hasso Tepper [Wed, 27 Jun 2007 12:28:00 +0000 (12:28 +0000)]
Nuke the code specific to NetBSD/OpenBSD/FreeBSD at first. I doubt anyone
will update these pieces and I don't intend to review macros for all

There is the chance though that I might kill something which should stay
in the code in form "TODO: port it to DF". So, please review and kick me.

13 years agoFix files that included the posix scheduling headers that were merged earlier.
Joe Talbott [Tue, 26 Jun 2007 23:30:05 +0000 (23:30 +0000)]
Fix files that included the posix scheduling headers that were merged earlier.

13 years agoImplement jscan -o. Take the patch from Steve and add some additional
Matthew Dillon [Tue, 26 Jun 2007 20:47:58 +0000 (20:47 +0000)]
Implement jscan -o.  Take the patch from Steve and add some additional
checks to the write() to deal with EINTR and EAGAIN.

Submitted-by: "Steve O'Hara-Smith" <steve@sohara.org>
13 years agoA file descriptor of -1 is legal when accessing journal status. Just allow
Matthew Dillon [Tue, 26 Jun 2007 20:39:33 +0000 (20:39 +0000)]
A file descriptor of -1 is legal when accessing journal status.  Just allow
it generally, the journal command switch will recheck it on a per-command

13 years agoNuke USBDEV().
Hasso Tepper [Tue, 26 Jun 2007 19:52:10 +0000 (19:52 +0000)]
Nuke USBDEV().

13 years agoRepo-copy numerous files from sys/emulation/posix4 to sys/sys and sys/kern
Matthew Dillon [Tue, 26 Jun 2007 19:31:10 +0000 (19:31 +0000)]
Repo-copy numerous files from sys/emulation/posix4 to sys/sys and sys/kern
and adjust the build to suit.  posix scheduling is here to stay.

Submitted-by: Joe Talbott <josepht@cstone.net>
13 years agoIf RX csum calculation with pseudo header is enabled, bge(4)'s will
Sepherosa Ziehau [Tue, 26 Jun 2007 15:10:23 +0000 (15:10 +0000)]
If RX csum calculation with pseudo header is enabled, bge(4)'s will
miscalculate csum of frames carrying UDP datagrams.  If UDP datagrams
are not fragmented by IP, then the rate of miscalculation is low, but
if UDP datagrams are fragmented by IP, then most of the frames will be
delivered to the upper layer with wrong hardware csum, which is quite
common for NFS.

Disable hardware RX csum calculation with pseudo header; it will be
better than doing software csum if hardware csum error happens, since
the error rate is too high.

Reported-by: Thomas Nikolajsen <thomas.nikolajsen@mail.dk>
13 years agoOne callout_stop() is enough.
Hasso Tepper [Tue, 26 Jun 2007 14:56:50 +0000 (14:56 +0000)]
One callout_stop() is enough.

Suggested-by: Joerg
13 years agomalloc -> kmalloc
Hasso Tepper [Tue, 26 Jun 2007 11:53:16 +0000 (11:53 +0000)]
malloc -> kmalloc

13 years ago- Fix headphone jack sensing support for Olivetti Olibook 610-430 XPSE.
Hasso Tepper [Tue, 26 Jun 2007 11:04:50 +0000 (11:04 +0000)]
- Fix headphone jack sensing support for Olivetti Olibook 610-430 XPSE.
- Drain all callout handlers during driver detach appropriately.

Obtained-from: FreeBSD

13 years agoClean up sys/bus/usb/usb_port.h. Remove not used/dead/old code.
Hasso Tepper [Tue, 26 Jun 2007 08:36:24 +0000 (08:36 +0000)]
Clean up sys/bus/usb/usb_port.h. Remove not used/dead/old code.

13 years agoNuke "is is" stammering.
Hasso Tepper [Tue, 26 Jun 2007 07:47:28 +0000 (07:47 +0000)]
Nuke "is is" stammering.

13 years agoAdd a new option (-i) that allows the insane deviation value to be set, and
Matthew Dillon [Tue, 26 Jun 2007 02:40:20 +0000 (02:40 +0000)]
Add a new option (-i) that allows the insane deviation value to be set, and
change the default to 0.5 seconds.  For example, -i 0.025 would set the test
to be 25ms.

Change the insane check... just map out a server deemed to be insane for 60
minutes, do not disconnect or reset it (which might lead to excessive packet

Update the documentation.

13 years agoCreate a default dntpd.conf file for DragonFly using three pool.ntp.org
Matthew Dillon [Tue, 26 Jun 2007 01:41:38 +0000 (01:41 +0000)]
Create a default dntpd.conf file for DragonFly using three pool.ntp.org
hosts as the time source.

13 years agoAdjust debug output so columns line up better.
Matthew Dillon [Tue, 26 Jun 2007 00:40:35 +0000 (00:40 +0000)]
Adjust debug output so columns line up better.