Commit Graph

3496 Commits

Author SHA1 Message Date
David Xu
f5044aeb45 Better to not know anything about KSE. 2003-02-26 05:47:25 +00:00
Maxime Henrion
f6c912dd0c Correctly set BUS_SPACE_MAXSIZE in all the busdma backends.
It was bogusly set to 64 * 1024 or 128 * 1024 because it was
bogusly reused in the BUS_DMAMAP_NSEGS definition.
2003-02-26 02:16:06 +00:00
David E. O'Brien
6e818956c5 Move most everything back to a MI NOTES, and use "nodevice" in MD NOTES
Where needed.  Use 'sed' for now in place of "nooptions".  Add a sparc64
MD NOTES.

Reviewed by:	arch@
2003-02-25 20:59:23 +00:00
Jake Burkholder
0f1a7e05a2 - Added inlines pmap_is_current, pmap_is_alternate and pmap_set_alternate
for testing and setting the current and alternate address spaces.
- Changed PTDpde and APTDpde to arrays to support multiple page directory
  pages.

ponsored by:	DARPA, Network Associates Laboratories
2003-02-25 19:40:21 +00:00
David Xu
d9b05fa0b0 Remove an unsafe KASSERT. 2003-02-25 11:23:17 +00:00
Maxime Henrion
07159f9c56 Cleanup of the d_mmap_t interface.
- Get rid of the useless atop() / pmap_phys_address() detour.  The
  device mmap handlers must now give back the physical address
  without atop()'ing it.
- Don't borrow the physical address of the mapping in the returned
  int.  Now we properly pass a vm_offset_t * and expect it to be
  filled by the mmap handler when the mapping was successful.  The
  mmap handler must now return 0 when successful, any other value
  is considered as an error.  Previously, returning -1 was the only
  way to fail.  This change thus accidentally fixes some devices
  which were bogusly returning errno constants which would have been
  considered as addresses by the device pager.
- Garbage collect the poorly named pmap_phys_address() now that it's
  no longer used.
- Convert all the d_mmap_t consumers to the new API.

I'm still not sure wheter we need a __FreeBSD_version bump for this,
since and we didn't guarantee API/ABI stability until 5.1-RELEASE.

Discussed with:		alc, phk, jake
Reviewed by:		peter
Compile-tested on:	LINT (i386), GENERIC (alpha and sparc64)
Runtime-tested on:	i386
2003-02-25 03:21:22 +00:00
Jake Burkholder
5cd612b27e - Removed UMAXPTDI and UMAXPTEOFF.
- Changed VM_MAXUSER_ADDRESS to be defined in terms of PTDPTDI.  In order for
  assumptions about the recursive page table map to work it must be the base
  of the recursive map.  Any pte offset that's not NPTEPG will break these
  assumptions.

Sponsored by:	DARPA, Network Associates Laboratories
2003-02-24 20:29:52 +00:00
Yoshihiro Takahashi
2302407b21 The mpbiosreason variable does not used for pc98. 2003-02-24 14:36:03 +00:00
Jake Burkholder
28c9e1aa5c Use the direct mapping of IdlePTD setup in locore for proc0's page directory,
instead of allocating another page of kva and mapping it in again.  This was
likely an oversight in revision 1.174 (cut and paste from pmap_pinit).

Discussed with:	peter, tegge
Sponsored by:	DARPA, Network Associates Laboratories
2003-02-24 00:39:50 +00:00
Tor Egge
07d2563244 Allow machines with one CPU and a valid mp table to boot an SMP kernel. 2003-02-23 23:49:57 +00:00
Jake Burkholder
ef49a94104 Previous commit missed a 1 that should be NGPTD, and an NPDEPG that should
be NPDEPTD.  Grumble.

Sponsored by:	DARPA, Network Associates Laboratories
2003-02-23 22:12:08 +00:00
Jake Burkholder
910548dea7 - Added macros NPGPTD, NBPTD, and NPDEPTD, for dealing with the size of the
page directory.
- Use these instead of the magic constants 1 or PAGE_SIZE where appropriate.
  There are still numerous assumptions that the page directory is exactly
  1 page.

Sponsored by:	DARPA, Network Associates Laboratories
2003-02-23 21:20:00 +00:00
Jake Burkholder
e29632c9e1 - Added macros PDESHIFT and PTESHIFT, use these instead of magic constants
in locore.
- Removed the macros PTESIZE and PDESIZE, use sizeof instead in C.

Sponsored by:	DARPA, Network Associates Laboratories
2003-02-23 09:45:50 +00:00
Alan Cox
01a06ce250 The root of the splay tree maintained within the pm_pteobj always refers
to the last accessed pte page.  Thus, the pm_ptphint is redundant and can
be removed.
2003-02-22 23:43:08 +00:00
Jake Burkholder
d44f8f150c unsigned -> pt_entry_t.
Sponsored by:	DARPA, Network Associates Laboratories
2003-02-22 23:41:27 +00:00
Peter Wemm
d8fcb6da11 Fix fumble in rev 1.525. pmap_kenter()'s second argument is a physical
address, not a page index.

Laughed at by:  jake
2003-02-20 05:35:52 +00:00
Warner Losh
a163d034fa Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
Peter Wemm
af3d516f55 Initiate de-orbit burn for USE_PCI_BIOS_FOR_READ_WRITE. This has been
#if'ed out for a while.  Complete the deed and tidy up some other bits.

We need to be able to call this stuff from outer edges of interrupt
handlers for devices that have the ISR bits in pci config space.  Making
the bios code mpsafe was just too hairy.  We had also stubbed it out some
time ago due to there simply being too much brokenness in too many systems.
This adds a leaf lock so that it is safe to use pci_read_config() and
pci_write_config() from interrupt handlers.  We still will use pcibios
to do interrupt routing if there is no acpi.. [yes, I tested this]

Briefly glanced at by:  imp
2003-02-18 03:36:49 +00:00
Julian Elischer
4a338afd7a Move a bunch of flags from the KSE to the thread.
I was in two minds as to where to put them in the first case..
I should have listenned to the other mind.

Submitted by:	 parts by davidxu@
Reviewed by:	jeff@ mini@
2003-02-17 09:55:10 +00:00
Jeff Roberson
5215b1872f - Split the struct kse into struct upcall and struct kse. struct kse will
soon be visible only to schedulers.  This greatly simplifies much the
   KSE code.

Submitted by:	davidxu
2003-02-17 05:14:26 +00:00
Jeff Roberson
e4625663c9 - Move ke_sticks, ke_iticks, ke_uticks, ke_uu, ke_su, and ke_iu back into
the proc.  These counters are only examined through calcru.

Submitted by:	davidxu
Tested on:	x86, alpha, UP/SMP
2003-02-17 02:19:58 +00:00
Poul-Henning Kamp
029f0b69a4 Change "dev_t gdbdev" to "void *gdb_arg", some possible paths for GDB
will not have a dev_t.
2003-02-16 19:22:21 +00:00
Poul-Henning Kamp
f341ca9891 Remove #include <sys/dkstat.h> 2003-02-16 14:13:23 +00:00
Alan Cox
8e42580deb Assert that the kernel map's system mutex is held in pmap_growkernel(). 2003-02-15 19:23:37 +00:00
Alan Cox
e33d37b66f - Add a mutex for synchronizing the use of CMAP/CADDR 1 and 2.
- Eliminate small style differences between pmap_zero_page(),
   pmap_copy_page(), etc.
2003-02-14 07:34:28 +00:00
David E. O'Brien
36dc5b9427 Fix the style of the SCHED_4BSD commit. 2003-02-13 22:24:44 +00:00
Peter Wemm
939a4397b1 Oops. I mis-remembered about the P4 problems. It was 5.0-DP2 that
was shipped with DISABLE_PG_G and DISABLE_PSE, not 5.0-REL.  *blush*
Disable the code - but still leave it there in case its still lurking.
2003-02-13 02:42:06 +00:00
Peter Wemm
521871f1fa Turn of PG_PS and PG_G for Pentium-4 cpus at boot time. This is so
that we can stop turning off PG_G and PG_PS globally for releases.
2003-02-13 01:52:44 +00:00
Alan Cox
393a225ced Remove kptobj. Instead, use VM_ALLOC_NOOBJ. 2003-02-12 04:35:37 +00:00
Poul-Henning Kamp
70d8e2e9aa Switch to using the TSC code in i386/i386/tsc.c. 2003-02-11 11:43:25 +00:00
Mike Barcroft
8cf5ed5125 Implement fpclassify():
o Add a MD header private to libc called _fpmath.h; this header
  contains bitfield layouts of MD floating-point types.
o Add a MI header private to libc called fpmath.h; this header
  contains bitfield layouts of MI floating-point types.
o Add private libc variables to lib/libc/$arch/gen/infinity.c for
  storing NaN values.
o Add __double_t and __float_t to <machine/_types.h>, and provide
  double_t and float_t typedefs in <math.h>.
o Add some C99 manifest constants (FP_ILOGB0, FP_ILOGBNAN, HUGE_VALF,
  HUGE_VALL, INFINITY, NAN, and return values for fpclassify()) to
  <math.h> and others (FLT_EVAL_METHOD, DECIMAL_DIG) to <float.h> via
  <machine/float.h>.
o Add C99 macro fpclassify() which calls __fpclassify{d,f,l}() based
  on the size of its argument.  __fpclassifyl() is never called on
  alpha because (sizeof(long double) == sizeof(double)), which is good
  since __fpclassifyl() can't deal with such a small `long double'.

This was developed by David Schultz and myself with input from bde and
fenner.

PR:		23103
Submitted by:	David Schultz <dschultz@uclink.Berkeley.EDU>
		(significant portions)
Reviewed by:	bde, fenner (earlier versions)
2003-02-08 20:37:55 +00:00
Alan Cox
571cd8a190 MF alpha
- Synchronize access to the allpmaps list with a mutex.
2003-02-08 05:41:41 +00:00
Peter Wemm
e2294003a2 Commit some cosmetic changes I had laying around and almost included
with another commit.  Unwrap a line.  Unexpand a pmap_kenter().
2003-02-07 01:52:06 +00:00
Poul-Henning Kamp
dd43ae4272 This file has no longer any content from the original Berkeley file so
replace the UCB copyright with a FreeBSD 2 clause thing.

Remove some no longer relevant comments.
2003-02-05 11:11:39 +00:00
Poul-Henning Kamp
d1b40f007d i386/i386/tsc.c was repo-copied from i386/isa/clock.c.
Remove all the stuff that does not relate to the TSC.

Change the calibration to use DELAY(1000000) rather than trying to check
it against the CMOS RTC, this drastically increases precision:

Using 25 samples on a Athlon 700MHz UP machine I find:

                stddev          min          max        average
CMOS             22200 Hz    -74980 Hz     34301 Hz   704928721 Hz
DELAY             1805 Hz     -1984 Hz      2678 Hz   704937583 Hz

(The difference between the two averages is not statistically significant.)

expressed in PPM of the frequency:
                stddev          min          max
CMOS             31.49 PPM  -106.37 PPM    48.66 PPM
DELAY             2.56 PPM     2.81 PPM     3.80 PPM

This code will not be used until a followup commit to sys/isa/clock.c
and sys/pc98/pc98/clock.c which will only happen after some field testing.
2003-02-05 09:20:40 +00:00
Poul-Henning Kamp
553ebddc59 Make get_cyclecount() use binuptime() when no tsc is available: it is cheaper. 2003-02-05 08:55:10 +00:00
Hartmut Brandt
e557905435 Fix a problem in bus_dmamap_load_{mbuf,uio} when the first mbuf or the first
uio segment is empty. In this case no dma segment is create by
bus_dmamap_load_buffer, but the calling routine clears the first flag.
Under certain combinations of addresses of the first and second mbuf/uio
buffer this leads to corrupted DMA segment descriptors. This was already
fixed by tmm in sparc64/sparc64/iommu.c.

PR:		kern/47733
Reviewed by:	sam
Approved by:	jake (mentor)
2003-02-04 16:30:27 +00:00
Poul-Henning Kamp
91f1c2b3cc Split the global timezone structure into two integer fields to
prevent the compiler from optimizing assignments into byte-copy
operations which might make access to the individual fields non-atomic.

Use the individual fields throughout, and don't bother locking them with
Giant: it is no longer needed.

Inspired by:    tjr
2003-02-03 19:49:35 +00:00
Jake Burkholder
238dd3209a Split statclock into statclock and profclock, and made the method for driving
statclock based on profhz when profiling is enabled MD, since most platforms
don't use this anyway.  This removes the need for statclock_process, whose
only purpose was to subdivide profhz, and gets the profiling clock running
outside of sched_lock on platforms that implement suswintr.
Also changed the interface for starting and stopping the profiling clock to
do just that, instead of changing the rate of statclock, since they can now
be separate.

Reviewed by:	jhb, tmm
Tested on:	i386, sparc64
2003-02-03 17:53:15 +00:00
Alan Cox
ca380469a2 - Make allpmaps static.
- Use atomic subtract to update the global wired pages count.  (See
   also vm/vm_page.c revision 1.233.)
 - Assert that the page queue lock is held in pmap_remove_entry().
2003-02-03 00:05:11 +00:00
Alfred Perlstein
8deebb0160 Consolidate MIN/MAX macros into one place (param.h).
Submitted by: Hiten Pandya <hiten@unixdaemons.com>
2003-02-02 13:17:30 +00:00
Josef Karthauser
c0c9e71f9a Put replace spaces with tabs in keeping with the rest of the file. 2003-02-01 18:45:18 +00:00
Julian Elischer
6f8132a867 Reversion of commit by Davidxu plus fixes since applied.
I'm not convinced there is anything major wrong with the patch but
them's the rules..

I am using my "David's mentor" hat to revert this as he's
offline for a while.
2003-02-01 12:17:09 +00:00
Poul-Henning Kamp
3c99c0bc50 Make tsc_freq a 64bit quantity.
Inspired by:    http://www.theinquirer.net/?article=7481
2003-01-29 11:36:39 +00:00
Scott Long
5193a34646 Implement bus_dmamem_alloc_size() and bus_dmamem_free_size() as
counterparts to bus_dmamem_alloc() and bus_dmamem_free().  This allows
the caller to specify the size of the allocation instead of it defaulting
to the max_size field of the busdma tag.

This is intended to aid in converting drivers to busdma.  Lots of
hardware cannot understand scatter/gather lists, which forces the
driver to copy the i/o buffers to a single contiguous region
before sending it to the hardware.  Without these new methods, this
would require a new busdma tag for each operation, or a complex
internal allocator/cache for each driver.

Allocations greater than PAGE_SIZE are rounded up to the next
PAGE_SIZE by contigmalloc(), so this is not suitable for multiple
static allocations that would be better served by a single
fixed-length subdivided allocation.

Reviewed by:	jake (sparc64)
2003-01-29 07:25:27 +00:00
Jake Burkholder
aff81a81d6 Remove BDE_DEBUGGER.
Discussed with:	bde
2003-01-28 19:05:44 +00:00
Alan Cox
d6d92c84c1 Merge pmap_testbit() and pmap_is_modified(). The latter is the only caller
of the former.
2003-01-28 03:01:35 +00:00
Julian Elischer
a18b6f65d0 Fix KSE related patch.
Make it compile for the SMP case..
statclock_process() has changed prototypes.
2003-01-26 21:32:08 +00:00
David Xu
0dbb100b9b Move UPCALL related data structure out of kse, introduce a new
data structure called kse_upcall to manage UPCALL. All KSE binding
and loaning code are gone.

A thread owns an upcall can collect all completed syscall contexts in
its ksegrp, turn itself into UPCALL mode, and takes those contexts back
to userland. Any thread without upcall structure has to export their
contexts and exit at user boundary.

Any thread running in user mode owns an upcall structure, when it enters
kernel, if the kse mailbox's current thread pointer is not NULL, then
when the thread is blocked in kernel, a new UPCALL thread is created and
the upcall structure is transfered to the new UPCALL thread. if the kse
mailbox's current thread pointer is NULL, then when a thread is blocked
in kernel, no UPCALL thread will be created.

Each upcall always has an owner thread. Userland can remove an upcall by
calling kse_exit, when all upcalls in ksegrp are removed, the group is
atomatically shutdown. An upcall owner thread also exits when process is
in exiting state. when an owner thread exits, the upcall it owns is also
removed.

KSE is a pure scheduler entity. it represents a virtual cpu. when a thread
is running, it always has a KSE associated with it. scheduler is free to
assign a KSE to thread according thread priority, if thread priority is changed,
KSE can be moved from one thread to another.

When a ksegrp is created, there is always N KSEs created in the group. the
N is the number of physical cpu in the current system. This makes it is
possible that even an userland UTS is single CPU safe, threads in kernel still
can execute on different cpu in parallel. Userland calls kse_create to add more
upcall structures into ksegrp to increase concurrent in userland itself, kernel
is not restricted by number of upcalls userland provides.

The code hasn't been tested under SMP by author due to lack of hardware.

Reviewed by: julian
2003-01-26 11:41:35 +00:00
Jeff Roberson
4183d949e0 - Remove a redundant scheduler option.
Pointy hat to:	jeff
Spotted by:	dillon
2003-01-26 06:37:43 +00:00