Commit Graph

1595 Commits

Author SHA1 Message Date
John Dyson
483140ead1 Add the vnode interlock back around vref. 1997-12-29 16:54:03 +00:00
Bruce Evans
b2ef07b7a2 Fixed style bugs in previous commit. 1997-12-29 08:54:52 +00:00
John Dyson
60f8d46448 Fix the decl of vfs_ioopt, allow LFS to compile again, fix a minor problem
with the object cache removal.
1997-12-29 01:03:55 +00:00
John Dyson
2be70f79f6 Lots of improvements, including restructring the caching and management
of vnodes and objects.  There are some metadata performance improvements
that come along with this.  There are also a few prototypes added when
the need is noticed.  Changes include:

1) Cleaning up vref, vget.
2) Removal of the object cache.
3) Nuke vnode_pager_uncache and friends, because they aren't needed anymore.
4) Correct some missing LK_RETRY's in vn_lock.
5) Correct the page range in the code for msync.

Be gentle, and please give me feedback asap.
1997-12-29 00:25:11 +00:00
Bruce Evans
f82057be9e Handle "%...p" as "%#...x" instead of "0x%...x". This is a quick fix
for field widths being 2 larger than specified for "%<number>p".  Only
printing of null pointers is "wrong" now (it is actually "right", but
inconsistent with printf(3)).
1997-12-28 05:03:33 +00:00
Bruce Evans
64cfdf460e Restored used include of <sys/malloc.h>. malloc() is not used
here, but kmem_malloc() is used and it takes the same "flags" as
malloc().

Use the mbuf allocation "flags" M_WAIT and M_DONTWAIT consistently.
There is really only one boolean flag, M_DONTWAIT, but the "flags"
were always treated as enum-like values, except in some places here
where the values are tacitly converted to boolean flags.  Treat
them as enum-like values everywhere, except where we tacitly assume
that there are only two values in order to convert them to the
corresponding two kmem_malloc() "flags".
1997-12-28 01:01:13 +00:00
Bruce Evans
675ea6f083 Unspammed nested include of <vm/vm_zone.h>. 1997-12-27 02:56:39 +00:00
Poul-Henning Kamp
71f461f86a Rename "i586_ctr" to "tsc" (both upper and lower case instances).
Fix a couple of printfs too.

Warning: This changes the names of a couple of kernel options!
1997-12-26 20:42:37 +00:00
Gary Palmer
b3b84d9b17 Make kern.ncpu reports the number of detected processors when running
with a SMP kernel.
1997-12-25 13:14:21 +00:00
Nate Williams
e1d6dc656d This patch causes the "calltodo" timer list to be decremented by the amount
of time that the laptop was suspending.  Thus, select() calls that might have
suspended rather than firing  at 1hr + "time suspended" since the timer was
posted.

Adding:

    options  APM_FIXUP_CALLTODO

to the kernel config enables the patch.

[
This patch was slightly modified to use a consistant indent style and
I removed some unused local variables.  After this has been tested a
few weeks we'll make the options the default, so for now I'm now
documenting it in LINT.  Mike can later if he wants.
]

Reviewed by:	Mike Smith <msmith@freebsd.org>
Submitted by:	Ken Key  <key@cs.utk.edu>
1997-12-23 16:32:35 +00:00
John Dyson
6d94bea461 Improve my copyright. 1997-12-22 11:54:00 +00:00
Sean Eric Fagan
d5f81602a7 Clear the p_stops field on change of user/group id, unless the correct
flag is set in the p_pfsflags field.  This, essentially, prevents an SUID
proram from hanging after being traced.  (E.g., "truss /usr/bin/rlogin" would
fail, but leave rlogin in a stopevent state.)  Yet another case where procctl
is (hopefully ;)) no longer needed in the general case.

Reviewed by:	bde (thanks bruce :))
1997-12-20 03:05:47 +00:00
Bruce Evans
214279cec9 Use __inline instead of inline to prevent pedantic compiler warnings. 1997-12-19 23:25:16 +00:00
Bruce Evans
1aa9ea7cb9 Removed some bogus casts. 1997-12-19 23:18:37 +00:00
John Dyson
1efb74fbcc Some performance improvements, and code cleanups (including changing our
expensive OFF_TO_IDX to btoc whenever possible.)
1997-12-19 09:03:37 +00:00
Garrett Wollman
e51d1e8707 Revert poll() for UFS files to traditional behavior where polling for read-
or writability always returns true.  This works around bugs in netscape and
squid, at a minimum.
1997-12-17 14:44:23 +00:00
Eivind Eklund
4027779c22 Regenerate after changing makesyscalls.sh. 1997-12-16 22:27:22 +00:00
Eivind Eklund
0b3c4d50c2 Move around opt_compat include to accomodate Linulator brokenness (for
the time being).
1997-12-16 18:51:45 +00:00
Eivind Eklund
5591b823d1 Make COMPAT_43 and COMPAT_SUNOS new-style options. 1997-12-16 17:40:42 +00:00
David Greenman
c7ce9e2634 Fix bug where a struct buf was free()'d back to the system malloc pool.
Quite amazing that the system runs at all with this bug. Also present in
2.2.5. The bug appears to have come in with changes in rev 1.53.

PR:		might fix PR#5313
Submitted by:	bde
1997-12-16 15:40:29 +00:00
Garrett Wollman
1cbbd625cc Add support for poll(2) on files. vop_nopoll() now returns POLLNVAL
if one of the new poll types is requested; hopefully this will not break
any existing code.  (This is done so that programs have a dependable
way of determining whether a filesystem supports the extended poll types
or not.)

The new poll types added are:

	POLLWRITE - file contents may have been modified
	POLLNLINK - file was linked, unlinked, or renamed
	POLLATTRIB - file's attributes may have been changed
	POLLEXTEND - file was extended

Note that the internal operation of poll() means that it is impossible
for two processes to reliably poll for the same event (this could
be fixed but may not be worth it), so it is not possible to rewrite
`tail -f' to use poll at this time.
1997-12-15 03:09:59 +00:00
Mike Smith
0bec68bf7c Consult sa_len before trampling it with MSG_COMPAT set.
PR:             kern/5291
Submitted by:   pb@fasterix.freenix.org (Pierre Beyssac)
1997-12-15 02:29:11 +00:00
Tor Egge
5c623cb649 Add support for low resolution SMP kernel profiling.
- A nonprofiling version of s_lock (called s_lock_np) is used
    by mcount.

  - When profiling is active, more registers are clobbered in
    seemingly simple assembly routines. This means that some
    callers needed to save/restore extra registers.

  - The stack pointer must have space for a 'fake' return address
    in idle, to avoid stack underflow.
1997-12-15 02:18:35 +00:00
Tor Egge
549a42942d Don't forward hardclock or statclock to stopped cpus. Disable forwarding
when a panic has occured.
1997-12-15 01:14:10 +00:00
John Polstra
a8e99ec909 Make gzipped dynamically linked executables work again. There was
an old bug here that failed to copy the a.out header into memory
properly.  It didn't matter until changes were made recently to
the dynamic linker.
1997-12-14 19:36:24 +00:00
Mike Smith
5af7db2b73 As described by the submitter:
... fix a bug with orecvfrom() or recvfrom() called with
the MSG_COMPAT flag on kernels compiled with the COMPAT_43 option.
The symptom is that the fromaddr is not correctly returned.

This affects the Linux emulator.

Submitted by:	pb@fasterix.freenix.org (Pierre Beyssac)
1997-12-14 03:15:21 +00:00
John Dyson
8256655132 After one of my analysis passes to evaluate methods for SMP TLB mgmt, I
noticed some major enhancements available for UP situations.  The number
of UP TLB flushes is decreased much more than significantly with these
changes.  Since a TLB flush appears to cost minimally approx 80 cycles,
this is a "nice" enhancement, equiv to eliminating between 40 and 160
instructions per TLB flush.

Changes include making sure that kernel threads all use the same PTD,
and eliminate unneeded PTD switches at context switch time.
1997-12-14 02:11:23 +00:00
Tor Egge
80db913bd6 Add needed #include.
Problem found by: Bruce Evans <bde@zeta.org.au>
1997-12-12 21:45:23 +00:00
John Dyson
74b2192ae6 We have had support for running the kernel daemons as threads for
quite a while, but forgot to do so.  For now, this code supports
most daemons  running as kernel threads in UP kernels, and as
full processes in SMP.  We will soon be able to run them as
threads in SMP, but not yet.
1997-12-12 04:00:59 +00:00
John Dyson
648899413d Quiet some lint. 1997-12-10 04:14:23 +00:00
Steve Passe
eae8fc2c8a The improvements to clock statistics by Tor Egge
Wrappered and enabled by the define BETTER_CLOCK (on by default in smpyests.h)

Reviewed by:	smp@csn.net
Submitted by:	Tor Egge <Tor.Egge@idi.ntnu.no>
1997-12-08 23:00:24 +00:00
John-Mark Gurney
0c2a51b49e add process id to tmp files... this prevents two runs from stomping
over each other's tmp files...  (usr.bin/truss uncovered this bug)
1997-12-08 09:00:47 +00:00
John Dyson
78922e413c Correct prototypes to match POSIX. Correct return code for aio_cancel.
Submitted by:	Alex Nash <nash@mcs.com>
1997-12-08 02:18:25 +00:00
Sean Eric Fagan
847e5f5f9a Use at_exit() to invoke procfs_exit() instead of calling it directly.
Note that an unload facility should be used to call rm_at_exit() (if
procfs is being loaded as an LKM and is subsequently removed), but it
was non-obvious how to do this in the VFS framework.

Reviewed by:	Julian Elischer
1997-12-08 01:06:36 +00:00
Sean Eric Fagan
ed1b05436a Surround the call to procfs_exit() by #ifdef PROCFS/#endif -- much to my
surprise, procfs actually is optional, and some people truly do generate
kernels without it.  Wow.  I built a kernel without 'options PROCFS' and
it compiled and linked.
1997-12-07 18:16:43 +00:00
John Dyson
f2e6e69d92 Slight performance improvement, removal of unneeded SPLs. 1997-12-07 04:06:41 +00:00
Bruce Evans
df1c78063c Use ENOIOCTL instead of -1 (= ERESTART) for diskslice ioctls that are
not handled at a particular level.
1997-12-06 14:27:56 +00:00
Bruce Evans
239b7b699e Use ENOIOCTL instead of -1 (= ERESTART) for tty ioctls that are
not handled at a particular level.  This fixes mainly restarting
of interrupted TIOCDRAINs and TIOCSETA{W,F}s.
1997-12-06 13:25:01 +00:00
Sean Eric Fagan
2a024a2b05 Changes to allow event-based process monitoring and control. 1997-12-06 04:11:14 +00:00
Bruce Evans
1cd52ec333 Don't include <sys/lock.h> in headers when only `struct simplelock' is
required.  Fixed everything that depended on the pollution.
1997-12-05 19:55:52 +00:00
John Dyson
d4060a8751 Some fixes from John Hood:
1) Fix the initialization of malloc structure that changed
		due to perf opt.
	2) Remove unneeded include.
	3) An initialization assert added to malloc.
Submitted by:	John Hood <cgull@smoke.marlboro.vt.us>
1997-12-05 05:36:58 +00:00
John-Mark Gurney
4d9deedb49 document and make the NO_F00F_HACK a proper option...
also, sort some option includes while I'm here..

Forgotten by:	sef
1997-12-04 21:21:26 +00:00
Jordan K. Hubbard
e41b6f2db7 After consultation with David, change
#ifndef NO_F00F_HACK
to
#if defined(I586_CPU) && !defined(NO_F00F_HACK)
1997-12-04 14:35:40 +00:00
Sean Eric Fagan
c4fbf2774d Work around for the Intel Pentium F00F bug; this is Intel's recommended
workaround.  Note that this currently eats up two pages extra in the system;
this could be alleviated by aligning idt correctly, and then only dealing with
that (as opposed to the current method of allocated two pages and copying the
IDT table to that, and then setting that to be the IDT table).
1997-12-03 02:45:50 +00:00
Poul-Henning Kamp
ab3f746966 In all such uses of struct buf: 's/b_un.b_addr/b_data/g' 1997-12-02 21:07:20 +00:00
Bruce Evans
52aef196f7 Cleaned up __getcwd(). This should be cosmetic except disabled calls
are now counted.

Reviewed by:	phk
1997-12-02 10:32:21 +00:00
John Dyson
b4b3edc1f4 Fix a serious problem during resizing buffers where old buffers
address space wasn't being properly reclaimed.
Submitted by:	Bruce Evans <bde@freebsd.org>
1997-12-01 19:04:00 +00:00
John Dyson
e499ed6f86 Fix a problem when creating a new kernel thread. In some cases, aio_read
or aio_write can return the pid of the new thread.  This is due to the
way that return values from system calls being passed by side-effect in
the proc structure now.  This commit fixes the problem with aio_read and
aio_write.
1997-12-01 18:41:08 +00:00
Julian Elischer
1b0493988c Cleanup my last patch here
Reviewed by: sef@kthrup.com and phk@freebsd.org
1997-12-01 11:34:41 +00:00
John Dyson
11783b142b Fix error handling for VCHR type I/O. Also, fix another spl problem, and
remove alot of overly verbose debugging statements.
ioproclist {
	int aioprocflags;			/* AIO proc flags */
	TAILQ_ENTRY(aioproclist) list;		/* List of processes */
	struct proc *aioproc;			/* The AIO thread */
	TAILQ_HEAD (,aiocblist) jobtorun;	/* suggested job to run */
};

/*
 * data-structure for lio signal management
 */
struct aio_liojob {
	int lioj_flags;
	int	lioj_buffer_count;
	int	lioj_buffer_finished_count;
	int	lioj_queue_count;
	int	lioj_queue_finished_count;
	struct sigevent lioj_signal;	/* signal on all I/O done */
	TAILQ_ENTRY (aio_liojob) lioj_list;
	struct kaioinfo *lioj_ki;
};
#define	LIOJ_SIGNAL			0x1 /* signal on all done (lio) */
#define	LIOJ_SIGNAL_POSTED	0x2	/* signal has been posted */

/*
 * per process aio data structure
 */
struct kaioinfo {
	int	kaio_flags;			/* per process kaio flags */
	int	kaio_maxactive_count;	/* maximum number of AIOs */
	int	kaio_active_count;	/* number of currently used AIOs */
	int	kaio_qallowed_count;	/* maxiumu size of AIO queue */
	int	kaio_queue_count;	/* size of AIO queue */
	int	kaio_ballowed_count;	/* maximum number of buffers */
	int	kaio_queue_finished_count;	/* number of daemon jobs finished */
	int	kaio_buffer_count;	/* number of physio buffers */
	int	kaio_buffer_finished_count;	/* count of I/O done */
	struct proc *kaio_p;			/* process that uses this kaio block */
	TAILQ_HEAD (,aio_liojob) kaio_liojoblist;	/* list of lio jobs */
	TAILQ_HEAD (,aiocblist)	kaio_jobqueue;	/* job queue for process */
	TAILQ_HEAD (,aiocblist)	kaio_jobdone;	/* done queue for process */
	TAILQ_HEAD (,aiocblist)	kaio_bufqueue;	/* buffer job queue for process */
	TAILQ_HEAD (,aiocblist)	kaio_bufdone;	/* buffer done queue for process */
};

#define KAIO_RUNDOWN 0x1		/* process is being run down */
#define KAIO_WAKEUP 0x2			/* wakeup process when there is a significant
								   event */


TAILQ_HEAD (,aioproclist) aio_freeproc, aio_activeproc;
TAILQ_HEAD(,aiocblist) aio_jobs;			/* Async job list */
TAILQ_HEAD(,aiocblist) aio_bufjobs;			/* Phys I/O job list */
TAILQ_HEAD(,aiocblist) aio_freejobs;		/* Pool of free jobs */

static void aio_init_aioinfo(struct proc *p) ;
static void aio_onceonly(void *) ;
static int aio_free_entry(struct aiocblist *aiocbe);
static void aio_process(struct aiocblist *aiocbe);
static int aio_newproc(void) ;
static int aio_aqueue(struct proc *p, struct aiocb *job, int type) ;
static void aio_physwakeup(struct buf *bp);
static int aio_fphysio(struct proc *p, struct aiocblist *aiocbe, int type);
static int aio_qphysio(struct proc *p, struct aiocblist *iocb);
static void aio_daemon(void *uproc);

SYSINIT(aio, SI_SUB_VFS, SI_ORDER_ANY, aio_onceonly, NULL);

static vm_zone_t kaio_zone=0, aiop_zone=0,
	aiocb_zone=0, aiol_zone=0, aiolio_zone=0;

/*
 * Single AIOD vmspace shared amongst all of them
 */
static struct vmspace *aiovmspace = NULL;

/*
 * Startup initialization
 */
void
aio_onceonly(void *na)
{
	TAILQ_INIT(&aio_freeproc);
	TAILQ_INIT(&aio_activeproc);
	TAILQ_INIT(&aio_jobs);
	TAILQ_INIT(&aio_bufjobs);
	TAILQ_INIT(&aio_freejobs);
	kaio_zone = zinit("AIO", sizeof (struct kaioinfo), 0, 0, 1);
	aiop_zone = zinit("AIOP", sizeof (struct aioproclist), 0, 0, 1);
	aiocb_zone = zinit("AIOCB", sizeof (struct aiocblist), 0, 0, 1);
	aiol_zone = zinit("AIOL", AIO_LISTIO_MAX * sizeof (int), 0, 0, 1);
	aiolio_zone = zinit("AIOLIO",
		AIO_LISTIO_MAX * sizeof (struct aio_liojob), 0, 0, 1);
	aiod_timeout = AIOD_TIMEOUT_DEFAULT;
	aiod_lifetime = AIOD_LIFETIME_DEFAULT;
	jobrefid = 1;
}

/*
 * Init the per-process aioinfo structure.
 * The aioinfo limits are set per-process for user limit (resource) management.
 */
void
aio_init_aioinfo(struct proc *p)
{
	struct kaioinfo *ki;
	if (p->p_aioinfo == NULL) {
		ki = zalloc(kaio_zone);
		p->p_aioinfo = ki
1997-12-01 07:01:45 +00:00