Commit Graph

1245 Commits

Author SHA1 Message Date
Peter Wemm
94c8fcd8fb Implementation of posix-style clock_* and nanosleep syscalls as implemented
in NetBSD.  The core of settimeofday() is moved to a seperate static
function settime() which both clock_settime() and settimeofday() call.

Note that I picked up the securelevel > 1 check from NetBSD that prevents
the clock being set backwards in high securelevel mode (this was a hole
that allowed resetting of inode access timestamps to arbitary values)

Obtained from:  mostly from NetBSD, but the settime() function is from
our gettimeofday(), some tweaks by me.
1997-05-08 14:16:25 +00:00
Peter Wemm
3a5322f2f0 regenerate 1997-05-08 14:08:49 +00:00
Peter Wemm
851679e514 oops. NODIDE -> NOHIDE 1997-05-08 14:07:11 +00:00
Peter Wemm
b6f031b70b Define entries for the posix-style clock/timer syscalls including
nanosleep().  Also, note some syscall conflicts with other systems and
indicate slots tagged for use with other syscalls some day.
1997-05-08 14:04:37 +00:00
Steve Passe
c2855f6e47 fix bug in get_isa_apic_mask() where EISA bus was ignored.
Submitted by:	 Peter Wemm <peter@spinner.DIALix.COM>
1997-05-07 22:25:27 +00:00
Peter Wemm
835834c085 md_regs is now a struct trapframe * 1997-05-07 20:08:53 +00:00
Doug Rabson
cea6c86c11 This is the kernel linker. To use it, you will first need to apply
the patches in freefall:/home/dfr/ld.diffs to your ld sources and set
BINFORMAT to aoutkld when linking the kernel.

Library changes and userland utilities will appear in a later commit.
1997-05-07 16:05:47 +00:00
Poul-Henning Kamp
8670684a2f Fix a race condition that did, after all, exist.
Reviewed by:	phk
Submitted by:	dfr
1997-05-06 15:19:38 +00:00
Steve Passe
75877d5a93 removed the "#error ..." line preventing casual invokation of SMP_AUTOSTART.
autostart appears to be working now, at least on my dual P6.
I have no explanation why....
1997-05-06 07:10:06 +00:00
Steve Passe
2479ac60b9 Code to handle SMP/APIC_IO mapping of ISA INTs to APIC pins above IRQ15.
- doesn't break my system.
 - NOT yet verified on the affected motherboard.

Submitted by:	"John S. Dyson" <toor@dyson.iquest.net>
1997-05-05 22:56:37 +00:00
John Dyson
b332d9a66e Make sure that *fork() always returns with %edx == 1 in the
child.  This was sometimes not happening correctly during my
threads code work.
1997-05-05 04:08:12 +00:00
Peter Wemm
b455e1e981 don't #ifdef out reference to i586_ctr_freq. 1997-05-04 14:28:22 +00:00
Poul-Henning Kamp
b15a966ec6 1. Add a {pointer, v_id} pair to the vnode to store the reference to the
".." vnode.  This is cheaper storagewise than keeping it in the
    namecache, and it makes more sense since it's a 1:1 mapping.

2.  Also handle the case of "." more intelligently rather than stuff
    the namecache with pointless entries.

3.  Add two lists to the vnode and hang namecache entries which go from
    or to this vnode.  When cleaning a vnode, delete all namecache
    entries it invalidates.

4.  Never reuse namecache enties, malloc new ones when we need it, free
    old ones when they die.  No longer a hard limit on how many we can
    have.

5.  Remove the upper limit on namelength of namecache entries.

6.  Make a global list for negative namecache entries, limit their number
    to a sysctl'able (debug.ncnegfactor) fraction of the total namecache.
    Currently the default fraction is 1/16th.  (Suggestions for better
    default wanted!)

7.  Assign v_id correctly in the face of 32bit rollover.

8.  Remove the LRU list for namecache entries, not needed.  Remove the
    #ifdef NCH_STATISTICS stuff, it's not needed either.

9.  Use the vnode freelist as a true LRU list, also for namecache accesses.

10. Reuse vnodes more aggresively but also more selectively, if we can't
    reuse, malloc a new one.  There is no longer a hard limit on their
    number, they grow to the point where we don't reuse potentially
    usable vnodes.  A vnode will not get recycled if still has pages in
    core or if it is the source of namecache entries (Yes, this does
    indeed work :-)  "." and ".." are not namecache entries any longer...)

11. Do not overload the v_id field in namecache entries with whiteout
    information, use a char sized flags field instead, so we can get
    rid of the vpid and v_id fields from the namecache struct.  Since
    we're linked to the vnodes and purged when they're cleaned, we don't
    have to check the v_id any more.

12. NFS knew about the limitation on name length in the namecache, it
    shouldn't and doesn't now.

Bugs:
        The namecache statistics no longer includes the hits for ".."
        and "." hits.

Performance impact:
        Generally in the +/- 0.5% for "normal" workstations, but
        I hope this will allow the system to be selftuning over a
        bigger range of "special" applications.  The case where
        RAM is available but unused for cache because we don't have
        any vnodes should be gone.

Future work:
        Straighten out the namecache statistics.

        "desiredvnodes" is still used to (bogusly ?) size hash
        tables in the filesystems.

        I have still to find a way to safely free unused vnodes
        back so their number can shrink when not needed.

        There is a few uses of the v_id field left in the filesystems,
        scheduled for demolition at a later time.

        Maybe a one slot cache for unused namecache entries should
        be implemented to decrease the malloc/free frequency.
1997-05-04 09:17:38 +00:00
Peter Wemm
653abe61a6 Finish off and activate the smp_active sysctl handler.. 1997-05-04 02:08:09 +00:00
Steve Passe
9999694073 code to allow range checking on smp_active.
disabled by default, not sure its ready for prime time.

Submitted by:	 Peter Wemm <peter@spinner.DIALix.COM>
1997-05-03 18:24:25 +00:00
Steve Passe
462e62c9a0 new function to turn an APIC pin# into an INT mask.
added missing APIC_IO define.

Submitted by:	"John S. Dyson" <toor@dyson.iquest.net>
1997-05-03 17:42:01 +00:00
Steve Passe
f3a946e800 fixed spelling error.
Submitted by:	Bruce Albrecht <bruce@zuhause.mn.org>
1997-05-01 19:27:58 +00:00
Peter Wemm
29c70804e6 This is obvious to people who've been using the smp kernel for a while,
but now that we've widened the scope of the smp work to -current, it might
be an idea to warn new people that might not have read all the docs yet
that the SMP support needs to be activated via a sysctl.
1997-05-01 14:18:05 +00:00
John Dyson
82b8e119b4 Staticize an unnecessarily global function: vputrele.
Submitted by:	 Michael Hancock <michaelh@cet.co.jp>
1997-04-30 03:09:15 +00:00
Steve Passe
04964d153d Enabled 'FIX_MP_TABLE_WORKS' code.
This code re-numbers PCI busses in the MP table to match PCI semantics
when the MP BIOS fails to do it properly.

Reviewed by:	Peter Wemm <peter@spinner.DIALix.COM>
1997-04-29 22:12:32 +00:00
Steve Passe
34e63b4cd7 removed all the TEST_UPPERPRIO crud. 1997-04-28 01:08:47 +00:00
Steve Passe
2c5d02fff3 remove all the SMP_INVLTLB defines, making the code default for APIC_IO.
Reviewed by:	informal discussion with Peter Wemm <peter@spinner.DIALix.COM>
1997-04-28 00:25:00 +00:00
Steve Passe
9caa2d558d remove all the SMP_INVLTLB defines, making the code default for APIC_IO.
replace invldebug with invltlb_ok for throttling smp_invltlb() during boot.

Reviewed by:	informal discussion with Peter Wemm <peter@spinner.DIALix.COM>
1997-04-28 00:24:00 +00:00
Alexander Langer
cf72998ef3 Remove bogon from previous commit: doubly included sys/systm.h. 1997-04-27 21:26:29 +00:00
Steve Passe
2897614119 informal discussion between Bruce Evans <bde@zeta.org.au>,
Peter Wemm <peter@spinner.DIALix.COM>, Steve Passe <smp@csn.net>

removed all the IPI_INTS code.
made the XFAST_IPI32 code default, renaming Xfastipi32 to Xinvltlb.
1997-04-27 21:17:56 +00:00
Garrett Wollman
a29f300e80 The long-awaited mega-massive-network-code- cleanup. Part I.
This commit includes the following changes:
1) Old-style (pr_usrreq()) protocols are no longer supported, the compatibility
glue for them is deleted, and the kernel will panic on boot if any are compiled
in.

2) Certain protocol entry points are modified to take a process structure,
so they they can easily tell whether or not it is possible to sleep, and
also to access credentials.

3) SS_PRIV is no more, and with it goes the SO_PRIVSTATE setsockopt()
call.  Protocols should use the process pointer they are now passed.

4) The PF_LOCAL and PF_ROUTE families have been updated to use the new
style, as has the `raw' skeleton family.

5) PF_LOCAL sockets now obey the process's umask when creating a socket
in the filesystem.

As a result, LINT is now broken.  I'm hoping that some enterprising hacker
with a bit more time will either make the broken bits work (should be
easy for netipx) or dike them out.
1997-04-27 20:01:29 +00:00
Alexander Langer
ee7877dfec Prevent debugger attachment to init when securelevel > 0.
Noticed by:	Brian Buchanan <brian@wasteland.calbbs.com>
1997-04-27 19:02:37 +00:00
Peter Wemm
c76e95c3c7 Create sysctl kern.fast_vfork, on for uniprocessor by default, off for
SMP.
1997-04-26 15:59:50 +00:00
Peter Wemm
c32ba2484e Disable RFMEM in vfork for smp case.. It doesn't seem to work too well
yet..
1997-04-26 14:31:36 +00:00
Peter Wemm
477a642cee Man the liferafts! Here comes the long awaited SMP -> -current merge!
There are various options documented in i386/conf/LINT, there is more to
come over the next few days.

The kernel should run pretty much "as before" without the options to
activate SMP mode.

There are a handful of known "loose ends" that need to be fixed, but
have been put off since the SMP kernel is in a moderately good condition
at the moment.

This commit is the result of the tinkering and testing over the last 14
months by many people.  A special thanks to Steve Passe for implementing
the APIC code!
1997-04-26 11:46:25 +00:00
Doug Rabson
be4952f1df Don't zero b_dirtyoff and b_dirtyend on error.
Submitted by:	Hidetoshi Shimokawa <simokawa@sat.t.u-tokyo.ac.jp>
1997-04-25 11:14:00 +00:00
Peter Wemm
5f61c81d66 copyin the export network mask to the correct variable.
Submitted by: Mike Hibler <mike@marker.cs.utah.edu>, PR#3380
1997-04-25 06:47:12 +00:00
Andrey A. Chernov
0eaa559cbf Restore memory space separation (RFMEM) for vfork() after
shell imgact memory clobbering fixed
1997-04-23 22:13:18 +00:00
Andrey A. Chernov
5cf3d12ca5 Don't clobber user space argv0 memory on shell exec, mainly for vfork()
Fix another bug: if argv[0] is NULL, garbadge args might be added for
shell script
Submitted by: Tor Egge <Tor.Egge@idi.ntnu.no> (with yet one fault detect from me)
1997-04-23 22:07:05 +00:00
John Dyson
6b707440d3 Give up on the fast vfork() for a while. 1997-04-23 01:59:14 +00:00
John Dyson
c58494e476 Re-institute the efficent version of vfork. It appears to make a
difference of approx 3mins in make world on my P6!!!  This means
that vfork now has full address space sharing, so beware with
sloppy vfork programming.  Also, you really do need to apply
the previously committed popen fix in libc.
1997-04-20 16:57:12 +00:00
Bruce Evans
0e4f24a34e Avoid division by 0 in check_part(). (It occurred when max_nsectors == 0.
This case is clearly an error, but we keep calling check_part() to get
diagnostics.)

Fixed nearby indentation and commenting bugs.
1997-04-19 14:14:17 +00:00
Doug Rabson
18cab10cb3 Don't allow partial buffers to be cluster-comitted.
Zero the b_dirty{off,end} after cluster-comitting a group of buffers.

With these fixes, I was able to complete a 'make world' with remote src
and obj directories.
1997-04-18 14:12:17 +00:00
David Greenman
1ebd0c5945 Brought fix from the 2.2 branch forward (see rev 1.47.2.7): serious bugs
with reading the image header.
1997-04-18 02:43:05 +00:00
Poul-Henning Kamp
936342eff1 #include <sys/queue.h> 1997-04-14 18:23:48 +00:00
Bruce Evans
58611a61ed Fixed printing of registers in dbflalt_handler(). The registers
were always in a tss; that tss just changed from the one in the
pcb to common_tss (who knows where it was when there was no curpcb?).
Not using the pcb also fixed the problem that there is no pcb in
idle(), so we now always get useful register values.
1997-04-14 13:52:52 +00:00
John Dyson
d7f7f3f20e Make a problem that I cannot reproduce go away for now. This commit
is to decrease the inconvienience of other developers until I can
really fix the code.
Reviewed by:	Donald J. Maddox <dmaddox@scsn.net>
1997-04-14 01:28:58 +00:00
John Dyson
95395ca1c1 Improve the buffer cache memory policy by moving pages over to the
cache queue more often.  The pageout daemon had to be waken up
more often than necessary since pages were not put on the
cache queue, when they should have been.
Submitted by:	David Greenman <dg@freebsd.org>
1997-04-13 03:33:25 +00:00
John Dyson
492da96c9d Correct the previous thread-fix commit. I made a clerical error. 1997-04-13 03:05:31 +00:00
John Dyson
5856e12e69 Fully implement vfork. Vfork is now much much faster than even our
fork. (On my machine, fork is about 240usecs, vfork is 78usecs.)

Implement rfork(!RFPROC !RFMEM), which allows a thread to divorce its memory
	from the other threads of a group.

Implement rfork(!RFPROC RFCFDG), which closes all file descriptors, eliminating
	possible existing shares with other threads/processes.

Implement rfork(!RFPROC RFFDG), which divorces the file descriptors for a
	thread from the rest of the group.

Fix the case where a thread does an exec.  It is almost nonsense for a thread
	to modify the other threads address space by an exec, so we
	now automatically divorce the address space before modifying it.
1997-04-13 01:48:35 +00:00
John Dyson
c04b956c6f Effectively remove the previous commit to fix threads forking. The
change was a false-start, and needs more work.
1997-04-12 04:07:50 +00:00
John Dyson
af9ec88589 Allow a kernel-supported process thread to do an exec without blasting
away the VM space of all of the other, associated threads.
1997-04-11 23:37:23 +00:00
Bruce Evans
9dd8309d56 Removed support for OLD_PIPE. <sys/stat.h> is now missing the hack that
supported nameless pipes being indistinguishable from fifos.  We're not
going back.
1997-04-09 16:53:45 +00:00
Bruce Evans
4e7506495b Include <sys/buf.h> instead of <sys/vnode.h>. kern_sysctl.c no
longer has anything to do with vnodes and never had anything to do
with buffers, but it needs the definitions of B_READ and B_WRITE
for use with the bogus useracc() interface and was getting them
bogusly due to excessive cleanups in rev.1.49.
1997-04-09 15:23:09 +00:00
Peter Wemm
263a339213 Remove explicit zero of p_vmspace on creation, it's now in the startzero
section of the proc struct.
1997-04-07 09:38:39 +00:00