dragonfly.git
16 years agoRegister keyword removal
Robert Garrett [Sat, 26 Jul 2003 21:48:49 +0000 (21:48 +0000)]
Register keyword removal

Approved by: Matt Dillon

16 years agoRegister keyword removal
Robert Garrett [Sat, 26 Jul 2003 21:13:15 +0000 (21:13 +0000)]
Register keyword removal

Approved by: Matt Dillon

16 years agoRegister keyword removal
Robert Garrett [Sat, 26 Jul 2003 21:00:04 +0000 (21:00 +0000)]
Register keyword removal

Approved by: Matt Dillon

16 years agoAdd a handy macro, called FOREACH_PROC_IN_SYSTEM(p) for better
Hiten Pandya [Sat, 26 Jul 2003 20:58:09 +0000 (20:58 +0000)]
Add a handy macro, called FOREACH_PROC_IN_SYSTEM(p) for better
clarity in code and reduce duplication, followup commits will
make use of this macro.

While I am there, change an 'of' to 'if' in a comment for
clarity.

16 years agoRegister keyword removal
Robert Garrett [Sat, 26 Jul 2003 20:40:10 +0000 (20:40 +0000)]
Register keyword removal

Approved by: Matt Dillon

16 years agoRegister keyword removal
Robert Garrett [Sat, 26 Jul 2003 20:36:58 +0000 (20:36 +0000)]
Register keyword removal

Approved by: Matt Dillon

16 years agoRegister keyword removal
Robert Garrett [Sat, 26 Jul 2003 20:19:34 +0000 (20:19 +0000)]
Register keyword removal

Approved by: Matt Dillon

16 years agoRegister keyword removal
Robert Garrett [Sat, 26 Jul 2003 20:08:38 +0000 (20:08 +0000)]
Register keyword removal

Approved by: Matt Dillon

16 years agoRegister keyword removal
Robert Garrett [Sat, 26 Jul 2003 19:42:11 +0000 (19:42 +0000)]
Register keyword removal

Approved by: Matt Dillon

16 years agoRegister keyword removal
Robert Garrett [Sat, 26 Jul 2003 19:27:41 +0000 (19:27 +0000)]
Register keyword removal

Approved by: Matt Dillon

16 years agoRegister keyword removal
Robert Garrett [Sat, 26 Jul 2003 19:20:33 +0000 (19:20 +0000)]
Register keyword removal

Approved by: Matt Dillon

16 years agoRegister keyword removal
Robert Garrett [Sat, 26 Jul 2003 19:07:50 +0000 (19:07 +0000)]
Register keyword removal

Approved by: Matt Dillon

16 years agoRegister keyword removal
Robert Garrett [Sat, 26 Jul 2003 18:53:21 +0000 (18:53 +0000)]
Register keyword removal

Approved by: Matt Dillon

16 years agosyscall messaging 2: Change the standard return value storage for system
Matthew Dillon [Sat, 26 Jul 2003 18:12:47 +0000 (18:12 +0000)]
syscall messaging 2: Change the standard return value storage for system
calls from proc->p_retval[] to the message structure embedded in the syscall.
System calls used to set their non-error return value in p_retval[] but
must now set it in the message structure.  This is a necessary precursor to
any sort of asynchronizatino, for obvious reasons.

This work was particularly annoying because all the emualtion code declares
and manually fills in syscall argument structures.

This commit could potentially destabilize some of the emulation code but I
went through the most important Linux emulation code three times and tested it
with linux-mozilla, so I am fairly confident that I got it right.

Note: proper linux emulation requires setting the fallback elf brand to 3 or
it will default to SVR4.  It really ought to default to linux (3), not SVR4.

    sysctl -w kern.fallback_elf_brand=3

16 years agoFix minor bug in last commit, add the required register keyword back in
Matthew Dillon [Sat, 26 Jul 2003 18:09:03 +0000 (18:09 +0000)]
Fix minor bug in last commit, add the required register keyword back in
for a (very rare) __asm register override declaration.

16 years agoRegister keyword removal
Robert Garrett [Sat, 26 Jul 2003 14:25:27 +0000 (14:25 +0000)]
Register keyword removal

Approved by: Matt Dillon

16 years agoRegister keyword removal
Robert Garrett [Sat, 26 Jul 2003 14:18:51 +0000 (14:18 +0000)]
Register keyword removal

Approved by: Matt Dillon

16 years agoregister keyword removal
Robert Garrett [Sat, 26 Jul 2003 14:12:24 +0000 (14:12 +0000)]
register keyword removal

Approved by:Matt Dillon

16 years agoMore register axe work (remove the register keyword)
Robert Garrett [Sat, 26 Jul 2003 14:07:18 +0000 (14:07 +0000)]
More register axe work (remove the register keyword)

Approved By: Matt Dillon

16 years agoregister keyword removal
Robert Garrett [Sat, 26 Jul 2003 13:59:53 +0000 (13:59 +0000)]
register keyword removal

APPROVED BY: Matt Dillon

16 years agoBegin register keyword removal commits
Robert Garrett [Sat, 26 Jul 2003 13:40:57 +0000 (13:40 +0000)]
Begin register keyword removal commits

Aproved by: Matt Dillon

16 years agoFix __asm syntax error from previous commit.
Matthew Dillon [Sat, 26 Jul 2003 01:04:08 +0000 (01:04 +0000)]
Fix __asm syntax error from previous commit.

16 years agoPerformance cleanup. Greatly reduce the number of %fs prefixed globaldata
Matthew Dillon [Fri, 25 Jul 2003 05:51:19 +0000 (05:51 +0000)]
Performance cleanup.  Greatly reduce the number of %fs prefixed globaldata
lookups by taking advantage of the fact that DragonFly does not preemptively
switch threads to other cpus to cache the globaldata pointer, to pass the
current thread to certain inlines rather then force them to reload it from
%fs, and to use td->td_gd to access the globaldata pointer when td is
available rather then mycpu.

This coupled with the curthread optimization done in a prior commit improved
syscall overheads by 60-100ns (about 7%).

16 years agoRemove thread->td_cpu. thread->td_gd (which points to the globaldata
Matthew Dillon [Fri, 25 Jul 2003 05:28:54 +0000 (05:28 +0000)]
Remove thread->td_cpu.  thread->td_gd (which points to the globaldata
structure) is sufficient.  Add e_cpuid to eproc to compensate.

16 years agoFix a minor bug in lwkt_init_thread() (the thread was being added to the
Matthew Dillon [Fri, 25 Jul 2003 05:26:52 +0000 (05:26 +0000)]
Fix a minor bug in lwkt_init_thread() (the thread was being added to the
wrong td_allq).

Remove thread->td_cpu.  thread->td_gd (which points to the globaldata
structure) is sufficient.  Add e_cpuid to eproc to compensate.

16 years agoOops, need to update truss's conf files re: new syscall support header
Matthew Dillon [Fri, 25 Jul 2003 03:43:15 +0000 (03:43 +0000)]
Oops, need to update truss's conf files re: new syscall support header
file.

Report-by: David Rhodus <drhodus@catpa.com>
16 years agoRegenerate all system calls
Matthew Dillon [Thu, 24 Jul 2003 23:55:10 +0000 (23:55 +0000)]
Regenerate all system calls

16 years agoSyscall messaging work 2: Continue with the implementation of sendsys(),
Matthew Dillon [Thu, 24 Jul 2003 23:52:39 +0000 (23:52 +0000)]
Syscall messaging work 2: Continue with the implementation of sendsys(),
using int 0x81.  This entry point will be responsible for sending system
call messages or waiting for messages / port activity.

With this commit system call messages can be run through 0x81 but at the
moment they will always run synchronously. Here's the core interface
code for IA32:

    static __inline int
    sendsys(void *port, void *msg, int msgsize)
    {
int error;
__asm __volatile("int $0x81" : "=a"(error) :
"a"(port), "c"(msg), "d"(msgsize) : "memory");
return(error);
    }

Performance verses a direct system call is currently excellent considering
that this is my initial attempt.

600MHzC3 1.2GHzP3x2(SMP)

getuid() 1300 ns  909 ns
getuid_msg() 1700 ns 1077 ns

16 years agoAdd support for RFC 3390, which allows for a variable-sized
Jeffrey Hsu [Thu, 24 Jul 2003 23:33:33 +0000 (23:33 +0000)]
Add support for RFC 3390, which allows for a variable-sized
initial congestion window.

This decreases the number of round-trip delays required for
short HTTP transfers which never make it out of slow-start.

16 years agolibcr copy: Retarget build paths from ../libc to ../libcr and retarget
Matthew Dillon [Thu, 24 Jul 2003 21:41:57 +0000 (21:41 +0000)]
libcr copy: Retarget build paths from ../libc to ../libcr and retarget
the library name from libc to libcr.

16 years agoFix NULL td crash in net/if.c when detaching a net interface.
Matthew Dillon [Thu, 24 Jul 2003 20:46:47 +0000 (20:46 +0000)]
Fix NULL td crash in net/if.c when detaching a net interface.

Report-by: Joerg Sonnenberger <joerg@britannica.bec.de>
16 years agoHave MFS register a device as a VCHR instead of VBLK, fixing a panic.
Matthew Dillon [Thu, 24 Jul 2003 20:43:18 +0000 (20:43 +0000)]
Have MFS register a device as a VCHR instead of VBLK, fixing a panic.

Report-by: Joerg Sonnenberger <joerg@britannica.bec.de>
16 years agoFix some stub prototypes (some missed proc->thread conversions).
Matthew Dillon [Thu, 24 Jul 2003 20:42:33 +0000 (20:42 +0000)]
Fix some stub prototypes (some missed proc->thread conversions).

Report-by: Joerg Sonnenberger <joerg@britannica.bec.de>
16 years agoBring RCNG in from 5.x and adjust config files and scripts accordingly.
Matthew Dillon [Thu, 24 Jul 2003 06:35:39 +0000 (06:35 +0000)]
Bring RCNG in from 5.x and adjust config files and scripts accordingly.
Bring in the 5.x mergemaster.
Bring in the 5.x rcorder.
Adjust Makefile's and mtree to deal with /etc/rc.d

Submitted-by: ROBERT GARRETT <rg70@sbcglobal.net>
Additional-work-by: dillon
16 years agoPreliminary syscall messaging work. Adjust all <syscall>_args structures
Matthew Dillon [Thu, 24 Jul 2003 01:41:27 +0000 (01:41 +0000)]
Preliminary syscall messaging work.  Adjust all <syscall>_args structures
to include an lwkt_msg at their base which will eventually allow syscalls
to run asynch.  Note that this is for the kernel copy of the arguments, the
userland argument format has not changed for the standard syscall entry
point.

Begin abstracting a messaging syscall interface (#if 0'd out at the moment).

Change the syscall2 entry point to take the new expanded argument structure
into account.  Change sysent argument calculation (AS macro) to take the
new expanded argument structure into account.

Note: existing linux, svr4, and ibcs2 emulation may break with this commit,
though it is not intentional.

16 years agoAdd all_sysent target to /usr/src/sys/Makefile to rebuild syscalls.
Matthew Dillon [Thu, 24 Jul 2003 01:36:22 +0000 (01:36 +0000)]
Add all_sysent target to /usr/src/sys/Makefile to rebuild syscalls.

16 years agoHere is an implementation of Limited Transmit (RFC 3042) for DragonFlyBSD.
Matthew Dillon [Thu, 24 Jul 2003 01:31:07 +0000 (01:31 +0000)]
Here is an implementation of Limited Transmit (RFC 3042) for DragonFlyBSD.
This reduces the high latency problems that NewReno often exhibits in the face
of packet loss.

Submitted-by: Jeffrey Hsu <hsu@FreeBSD.org>
16 years ago2003-07-22 Hiten Pandya <hmp@nxad.com>
Matthew Dillon [Wed, 23 Jul 2003 07:14:19 +0000 (07:14 +0000)]
2003-07-22 Hiten Pandya <hmp@nxad.com>

        * MFC FreeBSD rev. 1.189 of kern_exit.c (DONE)
          (shmexit to take vmspace instead of proc)
          (sort the sys/lock.h include in vm_map.c too)

        * MFC FreeBSD rev. 1.143 of kern_sysctl.c (DONE)
          (don't panic if sysctl is unregistrable)

        * Don't panic when enumerating SYSCTL_NODE()
          without children nodes. (DONE)

        * MFC FreeBSD rev. 1.113 of kern_sysctl.c (DONE)
          (Fix ogetkerninfo() handling  for KINFO_BSD_SYSINFO)

        * MFC FreeBSD rev. 1.103 of kern_sysctl.c (DONE)
          (Never reuse AUTO_OID values)

        * MFC FreeBSD rev 1.21 of i386/include/bus_dma.h
          (BUS_DMAMEM_NOSYNC -> BUS_DMA_COHERENT)

        * MFC FreeBSD rev. 1.19 of i386/include/bus_dma.h (DONE)
          (Implement real read/write barriers for i386)

Submitted by: Hiten Pandya <hmp@FreeBSD.ORG>

16 years agoMerge from FreeBSD 2003/07/15 15:49:53 PDT commit to sys/netinet.
Matthew Dillon [Wed, 23 Jul 2003 06:21:01 +0000 (06:21 +0000)]
Merge from FreeBSD 2003/07/15 15:49:53 PDT commit to sys/netinet.
Unify the "send high" and "recover" variables as specified in the
lastest rev of the spec.  Use an explicit flag for Fast Recovery. [1]

Fix bug with exiting Fast Recovery on a retransmit timeout
diagnosed by Lu Guohan. [2]

Original Commit by: Jeffrey Hsu <hsu@FreeBSD.org>

16 years agoLINT cleanup, add a static function back in which I thought wasn't used.
Matthew Dillon [Wed, 23 Jul 2003 06:02:38 +0000 (06:02 +0000)]
LINT cleanup, add a static function back in which I thought wasn't used.

16 years agoLINT pass. Cleanup missed proc->thread conversions and get rid of warnings.
Matthew Dillon [Wed, 23 Jul 2003 02:30:24 +0000 (02:30 +0000)]
LINT pass.  Cleanup missed proc->thread conversions and get rid of warnings.

16 years agoRemove two unnecessary volatile qualifications.
Matthew Dillon [Tue, 22 Jul 2003 22:10:51 +0000 (22:10 +0000)]
Remove two unnecessary volatile qualifications.

16 years agoDEV messaging stage 2/4: In this stage all DEV commands are now being
Matthew Dillon [Tue, 22 Jul 2003 17:03:35 +0000 (17:03 +0000)]
DEV messaging stage 2/4: In this stage all DEV commands are now being
funneled through the message port for action by the port's beginmsg function.
CONSOLE and DISK device shims replace the port with their own and then
forward to the original.  FB (Frame Buffer) shims supposedly do the same
thing but I haven't been able to test it.   I don't expect instability
in mainline code but there might be easy-to-fix, and some drivers still need
to be converted.  See primarily: kern/kern_device.c (new dev_*() functions and
inherits cdevsw code from kern/kern_conf.c), sys/device.h, and kern/subr_disk.c
for the high points.

In this stage all DEV messages are still acted upon synchronously in the
context of the caller.  We cannot create a separate handler thread until
the copyin's (primarily in ioctl functions) are made thread-aware.

Note that the messaging shims are going to look rather messy in these early
days but as more subsystems are converted over we will begin to use
pre-initialized messages and message forwarding to avoid having to constantly
rebuild messages prior to use.

Note that DEV itself is a mess oweing to its 4.x roots and will be cleaned
up in subsequent passes.  e.g. the way sub-devices inherit the main device's
cdevsw was always a bad hack and it still is, and several functions
(mmap, kqfilter, psize, poll) return results rather then error codes, which
will be fixed since now we have a message to store the result in :-)

16 years agoThrow better sanity checks into vfs_hang_addrlist() for argp->ex_addrlen
Matthew Dillon [Tue, 22 Jul 2003 05:04:41 +0000 (05:04 +0000)]
Throw better sanity checks into vfs_hang_addrlist() for argp->ex_addrlen
and argp->ex_masklen which are otherwise totally unchecked from userland.

16 years agoLINT build test. Aggregated source code adjustments to bring most of the
Matthew Dillon [Mon, 21 Jul 2003 07:57:52 +0000 (07:57 +0000)]
LINT build test.  Aggregated source code adjustments to bring most of the
rest of the kernel source up to date, using the LINT build.

16 years agoDEV messaging stage 1/4: Rearrange struct cdevsw and add a message port
Matthew Dillon [Mon, 21 Jul 2003 07:06:45 +0000 (07:06 +0000)]
DEV messaging stage 1/4: Rearrange struct cdevsw and add a message port
and auto-queueing mask.  The mask will tell us which message functions
can be safely queued to another thread and which still need to run in the
context of the caller.   Primary configuration fields (name, cmaj, flags,
port, autoq mask) are now at the head of the structure.  Function vectors,
which may eventually go away, are at the end.  The port and autoq fields
are non-functional in this stage.

The old BDEV device major number support has also been removed from cdevsw,
and code has been added to translate the bootdev passed from the boot code
(the boot code has always passed the now defunct block device major numbers
and we obviously need to keep that compatibility intact).

16 years agoDEV messaging stage 1/4: Rearrange struct cdevsw and add a message port
Matthew Dillon [Mon, 21 Jul 2003 05:50:47 +0000 (05:50 +0000)]
DEV messaging stage 1/4: Rearrange struct cdevsw and add a message port
and auto-queueing mask.  The mask will tell us which message functions
can be safely queued to another thread and which still need to run in the
context of the caller.   Primary configuration fields (name, cmaj, flags,
port, autoq mask) are now at the head of the structure.  Function vectors,
which may eventually go away, are at the end.  The port and autoq fields
are non-functional in this stage.

The old BDEV device major number support has also been removed from cdevsw,
and code has been added to translate the bootdev passed from the boot code
(the boot code has always passed the now defunct block device major numbers
and we obviously need to keep that compatibility intact).

16 years agoFix a minor compile-time errors when INVARIANTS is not defined.
Matthew Dillon [Sun, 20 Jul 2003 07:46:19 +0000 (07:46 +0000)]
Fix a minor compile-time errors when INVARIANTS is not defined.

16 years agoMinor cleanups so GENERIC compiles. Fix underscores in assembly and an
Matthew Dillon [Sun, 20 Jul 2003 07:29:20 +0000 (07:29 +0000)]
Minor cleanups so GENERIC compiles.  Fix underscores in assembly and an
include file in if_fe.c

Report-by: Steve Mynott <steve@tighrope.demon.co.uk>
16 years agodoreti was improperly clearing the entire gd_reqflags field when, in
Matthew Dillon [Sun, 20 Jul 2003 07:14:27 +0000 (07:14 +0000)]
doreti was improperly clearing the entire gd_reqflags field when, in
fact, it was only supposed to clear RQF_INTPEND.  This resulted in
reschedules not being left flagged for userret.

16 years agoProfiling cleanup 1/2: fix crashes (all registers need to be left intact
Matthew Dillon [Sun, 20 Jul 2003 04:20:32 +0000 (04:20 +0000)]
Profiling cleanup 1/2: fix crashes (all registers need to be left intact
from assembly), and fix a few syntax issues, etc.   It isn't ticking away
properly yet but at least it isn't crashing.

Submitted-by: Kip Macy <kmacy@fsmware.com>
Additional-work: dillon

16 years agoAdd externs for *_nonlocked atomic extensions to avoid warning.
Matthew Dillon [Sun, 20 Jul 2003 03:55:25 +0000 (03:55 +0000)]
Add externs for *_nonlocked atomic extensions to avoid warning.

16 years agoThis is the initial implmentation of the LWKT messaging infrastructure.
Matthew Dillon [Sun, 20 Jul 2003 01:37:22 +0000 (01:37 +0000)]
This is the initial implmentation of the LWKT messaging infrastructure.
Messages are sent to message ports and typically replied to a message port
embedded in the originating thread's thread structure (td_msgport).
The port functions match up and optimization client sync/asynch requests
verses target synch/asynch responses.

In this initial implementation a port must be owned by a particular thread,
and we use *asynch* IPI messaging to forward queueing and dequeueing operations
to the correct cpu.  Most of the IPI overhead will be absorbed by the fact
that these same IPIs also tend to schedule the threads in question, which on
the correct cpu (which is the one it will be on) costs nothing.

Message ports have in-context dispatch functions for initiating, aborting,
and replying to a message which can be overriden and will queue by default.

This code compiles but is as yet unreferenced, and almost certainly needs more
work.

16 years agozfreei->zfree (there is no zfreei anymore)
Matthew Dillon [Sun, 20 Jul 2003 00:41:28 +0000 (00:41 +0000)]
zfreei->zfree (there is no zfreei anymore)

Report-by: Kip Macy <kmacy@fsmware.com>
16 years agoRemove references to the no longer existant PZERO.
Matthew Dillon [Sat, 19 Jul 2003 22:21:21 +0000 (22:21 +0000)]
Remove references to the no longer existant PZERO.

16 years agoNuke huge mbuf macros stage 2/2: Cleanup the MCL*() cluster inlines by
Matthew Dillon [Sat, 19 Jul 2003 21:53:06 +0000 (21:53 +0000)]
Nuke huge mbuf macros stage 2/2: Cleanup the MCL*() cluster inlines by
moving them into procedures, similar to 1/2.

Suggested-by: Bosko Milekic <bmilekic@technokratis.com>
16 years agoRemove the priority part of the priority|flags argument to tsleep(). Only
Matthew Dillon [Sat, 19 Jul 2003 21:14:53 +0000 (21:14 +0000)]
Remove the priority part of the priority|flags argument to tsleep().  Only
flags are passed now.  The priority was a user scheduler thingy that is not
used by the LWKT subsystem.  For process statistics assume sleeps without
P_SINTR set to be disk-waits, and sleeps with it set to be normal sleeps.

This commit should not contain any operational changes.

16 years agoNuke huge mbuf macros stage 1/2: Remove massive inline mbuf macros to reduce
Matthew Dillon [Sat, 19 Jul 2003 21:09:27 +0000 (21:09 +0000)]
Nuke huge mbuf macros stage 1/2: Remove massive inline mbuf macros to reduce
L1/L2 cache pollution.  Est. performance improvement of 4-6% and the kernel
is 42KB smaller.

Submitted-by: Bosko Milekic <bmilekic@technokratis.com>
16 years agoRemove an unnecessary cli that was causing 'trap 12 with interrupts disabled'
Matthew Dillon [Sat, 19 Jul 2003 17:00:33 +0000 (17:00 +0000)]
Remove an unnecessary cli that was causing 'trap 12 with interrupts disabled'
warnings from start_init() (harmless, but annoying).

16 years agoMake the kernel load properly recognize ABS symbols (.SET assembly
Matthew Dillon [Fri, 18 Jul 2003 05:12:41 +0000 (05:12 +0000)]
Make the kernel load properly recognize ABS symbols (.SET assembly
instruction) whos value is 0.  It was improperly assuming that symbols with
a 0 value could not be found, and also confusing ABS symbols with COMMON
symbols.

16 years agoGDB changes required for gdb -k kernel /dev/mem. Still selected by
Matthew Dillon [Sun, 13 Jul 2003 07:13:51 +0000 (07:13 +0000)]
GDB changes required for gdb -k kernel /dev/mem.  Still selected by
process, not thread.  A "thread" command still needs to be added.

16 years agoThe comment was wrong, ptmmap *is* used, put it back in (fix crash
Matthew Dillon [Sun, 13 Jul 2003 07:10:06 +0000 (07:10 +0000)]
The comment was wrong, ptmmap *is* used, put it back in (fix crash
accessing /dev/mem)

16 years agoFix minor compile warning.
Matthew Dillon [Sun, 13 Jul 2003 05:51:17 +0000 (05:51 +0000)]
Fix minor compile warning.

16 years agoFix minor buildworld issues, mainly #include file dependancies and fields
Matthew Dillon [Sun, 13 Jul 2003 05:45:17 +0000 (05:45 +0000)]
Fix minor buildworld issues, mainly #include file dependancies and fields
that have moved from struct proc to struct thread.

16 years agoAdd missing required '*' in indirect jmp (fix assembler warning).
Matthew Dillon [Sun, 13 Jul 2003 05:43:31 +0000 (05:43 +0000)]
Add missing required '*' in indirect jmp (fix assembler warning).

16 years agooops, fix bug in last commit, and adjust the p_slptime check.
Matthew Dillon [Sat, 12 Jul 2003 18:35:35 +0000 (18:35 +0000)]
oops, fix bug in last commit, and adjust the p_slptime check.

16 years agoMake the pigs display more meaningful by showing processes which haven't
Matthew Dillon [Sat, 12 Jul 2003 18:10:28 +0000 (18:10 +0000)]
Make the pigs display more meaningful by showing processes which haven't
slept recently even if they aren't using much cpu.  Things like buildworlds
were not showing up at all.  This combined with the graph display makes
pigs far more useful.

16 years agoCollapse gd_astpending and gd_reqpri together into gd_reqflags. gd_reqflags
Matthew Dillon [Sat, 12 Jul 2003 17:54:36 +0000 (17:54 +0000)]
Collapse gd_astpending and gd_reqpri together into gd_reqflags.  gd_reqflags
now rollsup requests made pending for doreti.  Cleanup a number of scheduling
primitives and note that we do not need to use locked bus cycles on per-cpu
variables.

Note that the aweful idelayed hack for certain softints (used only by the TTY
subsystem, BTW) gets slightly broken in this commit because idelayed has become
per-cpu and the clock ints aren't yet distributed.

16 years agoForward FAST interrupts to the MP lock holder + minor fixes.
Matthew Dillon [Sat, 12 Jul 2003 16:55:54 +0000 (16:55 +0000)]
Forward FAST interrupts to the MP lock holder + minor fixes.

16 years agopartially fix pctcpu and userland rescheduling. We really have to distribute
Matthew Dillon [Sat, 12 Jul 2003 03:10:35 +0000 (03:10 +0000)]
partially fix pctcpu and userland rescheduling.  We really have to distribute
hardclock/statclock to all cpus to make it work properly.

16 years agoaccount for the time array being in microseconds now, and allow the
Matthew Dillon [Sat, 12 Jul 2003 03:09:50 +0000 (03:09 +0000)]
account for the time array being in microseconds now, and allow the
interval to be specified as a fraction of a second.

16 years agoMake the cpu/stat display work properly again.
Matthew Dillon [Fri, 11 Jul 2003 23:34:08 +0000 (23:34 +0000)]
Make the cpu/stat display work properly again.

16 years agoFix overflow in delta percentage calculation due to the fact that our 32 bit
Matthew Dillon [Fri, 11 Jul 2003 23:33:24 +0000 (23:33 +0000)]
Fix overflow in delta percentage calculation due to the fact that our 32 bit
cp_time[] counters are now in microseconds.

16 years agoCleanup hardclock() and statclock(), making them work properly even though
Matthew Dillon [Fri, 11 Jul 2003 23:26:20 +0000 (23:26 +0000)]
Cleanup hardclock() and statclock(), making them work properly even though
we do not replicate the clock interrupts across all cpus.

16 years agomisc cleanup. Add a case where we don't want an idlethread to HLT (if there
Matthew Dillon [Fri, 11 Jul 2003 22:30:09 +0000 (22:30 +0000)]
misc cleanup.  Add a case where we don't want an idlethread to HLT (if there
are pending fast ints that need the MP lock).

16 years agoMP Implmentation 4/4: Final cleanup for this stage. Deal with a race
Matthew Dillon [Fri, 11 Jul 2003 17:42:11 +0000 (17:42 +0000)]
MP Implmentation 4/4: Final cleanup for this stage.  Deal with a race
that occurs due to not having to hold the MP lock through an lwkt_switch()
where another cpu may pull off a process from the userland scheduler and
schedule its thread before the original cpu has completely switched out it.
Oddly enough latencies were enough that this bug never caused a crash!

Cleanup the scheduling code and in particular the switch assembly code, save
and restore eflags (cli/sti state) when switching heavy weight processes
(this is already done for light weight threads), add some counters, and
optimize fork() to (statistically) stay on the current cpu for a short while
to take advantage of locality of cache reference, which greatly improves
fork/exec times.  Note that synchronous pipe operations between two procseses
already (statistically) stick to the same cpu (which is what we want).

16 years agoMP Implmentation 3B/4: Remove Xcpuast and Xforward_irq, replacing them
Matthew Dillon [Fri, 11 Jul 2003 01:23:24 +0000 (01:23 +0000)]
MP Implmentation 3B/4: Remove Xcpuast and Xforward_irq, replacing them
with IPI messaging functions.  Fix user scheduling issues so user processes
are dependably scheduled on available cpus.

16 years agoMP Implmentation 3A/4: Fix stupid bug introduced in last commit.
Matthew Dillon [Thu, 10 Jul 2003 18:36:13 +0000 (18:36 +0000)]
MP Implmentation 3A/4: Fix stupid bug introduced in last commit.

16 years agoMP Implmentation 3A/4: Cleanup MP lock operations to allow the MP lock to
Matthew Dillon [Thu, 10 Jul 2003 18:23:24 +0000 (18:23 +0000)]
MP Implmentation 3A/4: Cleanup MP lock operations to allow the MP lock to
occassionally be out of synch from td_mpcount, so we don't have to
disable interrupts and so we can call try_mplock() from the middle of a
switch function.

16 years agoMP Implmentation 3/4: MAJOR progress on SMP, full userland MP is now working!
Matthew Dillon [Thu, 10 Jul 2003 04:47:55 +0000 (04:47 +0000)]
MP Implmentation 3/4: MAJOR progress on SMP, full userland MP is now working!
A number of issues relating to MP lock operation have been fixed, primarily
that we have to read %cr2 before get_mplock() since get_mplock() may switch
away.  Idlethreads can now safely HLT without any performance detriment.
The userland scheduler has been almost completely rewritten and is now
using an extremely flexible abstraction with a lot of room to grow.  pgeflag
has been removed from mapdev (without per-page invalidation it isn't safe
to use PG_G even on UP).  Necessary locked bus cycles have been added for
the pmap->pm_active field in swtch.s.  CR3 has been unoptimized for the
moment (see comment in swtch.s).  Since the switch code runs without the
MP lock we have to adjust pm_active PRIOR to loading %cr3.
Additional sanity checks have been added to the code (see PARANOID_INVLTLB
and ONLY_ONE_USER_CPU in the code), plus many more in kern_switch.c.
A passive release mechanism has been implemented to optimize P_CURPROC/lwkt
priority shifting when going from user->kernel and kernel->user.
Note: preemptive interrupts don't care due to the way preemption works so
no additional complexity there.  non-locking atomic functions to protect
only against local interrupts have been added.  astpending now uses
non-locking atomic functions to set and clear bits.  private_tss has been
moved to a per-cpu variable.   The LWKT thread module has been considerably
enhanced and cleaned up, including some fixes to handle MPLOCKED vs td_mpcount
races (so eventually we can do MP locking without a pushfl/cli/popfl combo).
stopevent() needs critical section protection, maybe.

16 years agoThe syncer is not a process any more, deal with it as a thread.
Matthew Dillon [Tue, 8 Jul 2003 17:21:53 +0000 (17:21 +0000)]
The syncer is not a process any more, deal with it as a thread.

16 years agoMP Implmentation 2A/4: Post commit cleanup, fix missing token releases that
Matthew Dillon [Tue, 8 Jul 2003 09:57:14 +0000 (09:57 +0000)]
MP Implmentation 2A/4: Post commit cleanup, fix missing token releases that
were messing up td_pri's critical count, and add smart LWKT rescheduling
when a higher priority thread is scheduled (and could not preempt).  This
fixes the priority problems.

16 years agoMP Implementation 2/4: Implement a poor-man's IPI messaging subsystem,
Matthew Dillon [Tue, 8 Jul 2003 06:27:28 +0000 (06:27 +0000)]
MP Implementation 2/4: Implement a poor-man's IPI messaging subsystem,
get both cpus arbitrating the BGL for interrupts, IPIing foreign
cpu LWKT scheduling requests without crashing, and dealing with the cpl.

The APs are in a slightly less degenerate state now, but hardclock and
statclock distribution is broken, only one user process is being scheduled
at a time, and priorities are all messed up.

16 years agoMP Implementation 1/2: Get the APIC code working again, sweetly integrate the
Matthew Dillon [Sun, 6 Jul 2003 21:23:56 +0000 (21:23 +0000)]
MP Implementation 1/2: Get the APIC code working again, sweetly integrate the
MP lock into the LWKT scheduler, replace the old simplelock code with
tokens or spin locks as appropriate.  In particular, the vnode interlock
(and most other interlocks) are now tokens.  Also clean up a few curproc/cred
sequences that are no longer needed.

The APs are left in degenerate state with non IPI interrupts disabled as
additional LWKT work must be done before we can really make use of them,
and FAST interrupts are not managed by the MP lock yet.  The main thing
for this stage was to get the system working with an APIC again.

buildworld tested on UP and 2xCPU/MP (Dell 2550)

16 years agooops, forgot one. Remove another curproc/cred dependancy
Matthew Dillon [Sun, 6 Jul 2003 20:12:15 +0000 (20:12 +0000)]
oops, forgot one.  Remove another curproc/cred dependancy

16 years agoRemove td_proc dependancy on cred that is no longer used.
Matthew Dillon [Sun, 6 Jul 2003 20:11:25 +0000 (20:11 +0000)]
Remove td_proc dependancy on cred that is no longer used.

16 years agofix a bug in the exit td_switch function, curthread was not always being
Matthew Dillon [Sat, 5 Jul 2003 05:54:00 +0000 (05:54 +0000)]
fix a bug in the exit td_switch function, curthread was not always being
loaded correctly.

16 years agoIntegrate the interrupt related operations for /dev/random support
Matthew Dillon [Fri, 4 Jul 2003 05:57:27 +0000 (05:57 +0000)]
Integrate the interrupt related operations for /dev/random support
directly into kern/kern_intr.c to work around a bad design.  Eventually
the 5.x random code will be backported.

16 years agoGeneric MP rollup work.
Matthew Dillon [Fri, 4 Jul 2003 00:32:32 +0000 (00:32 +0000)]
Generic MP rollup work.

16 years agoadd gd_other_cpus
Matthew Dillon [Fri, 4 Jul 2003 00:26:00 +0000 (00:26 +0000)]
add gd_other_cpus

16 years agoDocument hardwired indexes for fields.
Matthew Dillon [Fri, 4 Jul 2003 00:25:48 +0000 (00:25 +0000)]
Document hardwired indexes for fields.

16 years agoMisc interrupts/LWKT 2/2: Fix a reentrancy issue with thread repriortization
Matthew Dillon [Thu, 3 Jul 2003 21:22:38 +0000 (21:22 +0000)]
Misc interrupts/LWKT 2/2: Fix a reentrancy issue with thread repriortization
when entering and leaving the kernel from userland.

16 years agomisc quota proc->thread
Matthew Dillon [Thu, 3 Jul 2003 18:35:27 +0000 (18:35 +0000)]
misc quota proc->thread

16 years agoSplit the struct vmmeter cnt structure into a global vmstats structure and
Matthew Dillon [Thu, 3 Jul 2003 18:34:00 +0000 (18:34 +0000)]
Split the struct vmmeter cnt structure into a global vmstats structure and
a per-cpu cnt structure.  Adjust the sysctls to accumulate statistics
over all cpus.

(userland syncup)

16 years agoSplit the struct vmmeter cnt structure into a global vmstats structure and
Matthew Dillon [Thu, 3 Jul 2003 18:20:03 +0000 (18:20 +0000)]
Split the struct vmmeter cnt structure into a global vmstats structure and
a per-cpu cnt structure.  Adjust the sysctls to accumulate statistics
over all cpus.

16 years agoproperly initialize ncpus for UP
Matthew Dillon [Thu, 3 Jul 2003 18:19:51 +0000 (18:19 +0000)]
properly initialize ncpus for UP

16 years agoSplit the struct vmmeter cnt structure into a global vmstats structure and
Matthew Dillon [Thu, 3 Jul 2003 17:24:04 +0000 (17:24 +0000)]
Split the struct vmmeter cnt structure into a global vmstats structure and
a per-cpu cnt structure.  Adjust the sysctls to accumulate statistics
over all cpus.

16 years agoAdd some temporary debugging.
Matthew Dillon [Thu, 3 Jul 2003 01:58:25 +0000 (01:58 +0000)]
Add some temporary debugging.

16 years agofix unused variable warning
Matthew Dillon [Thu, 3 Jul 2003 01:16:59 +0000 (01:16 +0000)]
fix unused variable warning

16 years agoRemove pre-ELF underscore prefix and asnames macro hacks.
Matthew Dillon [Tue, 1 Jul 2003 20:31:39 +0000 (20:31 +0000)]
Remove pre-ELF underscore prefix and asnames macro hacks.