Commit Graph

361 Commits

Author SHA1 Message Date
Doug Rabson
6720311838 Change critical_t to register_t for intr_disable/restore. 2002-03-21 09:50:11 +00:00
Peter Wemm
c302e53c27 In UP mode, the primary cpu's per-cpu current_pmap was not initialized -
this was only done as a side effect of calling cpu_mp_start().  I haven't
actually tested that this fixes UP kernels, but it feels about right.
2002-03-21 07:41:02 +00:00
Jeff Roberson
eca80f82ea Remove references to vm_zone.h and switch over to the new uma API.
Approved by:	peter
2002-03-21 02:46:56 +00:00
Alfred Perlstein
e41ed5da90 Remove __P.
Reviewd by: peter
2002-03-20 23:30:31 +00:00
John Baldwin
f25fcd64b8 Change the way we ensure td_ucred is NULL if DIAGNOSTIC is defined.
Instead of caching the ucred reference, just go ahead and eat the
decerement and increment of the refcount.  Now that Giant is pushed down
into crfree(), we no longer have to get Giant in the common case.  In the
case when we are actually free'ing the ucred, we would normally free it on
the next kernel entry, so the cost there is not new, just in a different
place.  This also removse td_cache_ucred from struct thread.  This is
still only done #ifdef DIAGNOSTIC.

Tested on:	i386, alpha
2002-03-20 21:09:09 +00:00
Doug Rabson
a2763677ec Change intr_enable to intr_restore for consistency with sparc64. 2002-03-20 17:28:40 +00:00
Doug Rabson
c526161420 Replace calls to cpu_critical_enter/exit with appropriate calls to
either explicitly disable interrupts or use a real critical section,
as appropriate.
2002-03-20 10:04:08 +00:00
Peter Wemm
3acb2ae91f #if 0 some unused variables (only in #if 0 code) 2002-03-19 12:15:29 +00:00
Peter Wemm
5044ed104d My ia64 box for some reason likes to fragment the beginning/end of memory
a bit before handing it over to the OS.  I occasionally have 11
segments with several 8K or so fragments depending on nvram settings and
what I have done under loader(8) before booting.  This needs to be
revisited.
2002-03-19 11:18:47 +00:00
Peter Wemm
3b406873c7 Fix some unused variables. 2002-03-19 11:15:26 +00:00
Peter Wemm
12adcbdf35 Move a couple of prototypes together instead of being incompletely
scattered around.
2002-03-19 11:14:52 +00:00
Peter Wemm
6d4a5aee06 __func__ is a const char *, not a "string" that can be concatenated. 2002-03-19 11:11:37 +00:00
Peter Wemm
90f9252584 Fix a pointer/int warning 2002-03-19 11:10:30 +00:00
Peter Wemm
21eec46f33 #ifdef SMP some variables that are only used elsewhere under #ifdef SMP
also.
2002-03-19 11:10:03 +00:00
Peter Wemm
34adf9e4f1 Work around an apparent compiler bug with gcc-3.1, although it might be
a language feature that I do not know about.  gcc is complaining about
a left shift >= sizeof type, even when shifting a (cast) 64 bit type left
by 43 bits.
2002-03-19 11:09:24 +00:00
Peter Wemm
e42d7cebec #if 0 out some unused code. 2002-03-19 11:06:01 +00:00
Peter Wemm
675ceea82b Add some #includes after things got broken with the last round of
MI include file (<sys/smp.h> I think) tweaks.
2002-03-19 11:05:07 +00:00
Peter Wemm
4ff9e8d5e5 Turn off the ia64 ITC timecounter when SMP is present since it has the
same problem as the TSC on the x86 - ie: it is not synchronized.
#if 0 out some unused functions, ia64 doesn't calibrate clocks yet.
2002-03-19 11:03:48 +00:00
Jeff Roberson
8355f576a9 This is the first part of the new kernel memory allocator. This replaces
malloc(9) and vm_zone with a slab like allocator.

Reviewed by:	arch@
2002-03-19 09:11:49 +00:00
Doug Rabson
568a940b99 Fix spelling. 2002-03-18 09:29:16 +00:00
Doug Rabson
0ab3e3b15a * Stop other cpus when one cpu enters DDB and restart them after it
leaves.
* Add a sync.i instruction to the code which writes out breakpoints to
  ensure that the breakpoint is seem by all cpus in the coherence domain.
2002-03-15 11:12:08 +00:00
Doug Rabson
fa45345e6e * Remove a breakpoint() I accidentally left in for debugging :-(.
* Make cpu_mp_probe() work before the VM system is available and
  initialise mp_maxid accordingly.
2002-03-15 09:47:16 +00:00
Doug Rabson
0f638cfaeb Tweak the AP startup code somewhat. With all the other recent changes,
this now works pretty well for two processors at least.

Submitted by: marcel, mostly.
2002-03-14 19:37:36 +00:00
Doug Rabson
34da0be411 * Initialise pcb_pmap for new threads.
* Add support for forking new threads from &thread0 as well as curthread.
2002-03-14 19:34:50 +00:00
Doug Rabson
92e814dcb6 * Save and restore PCPU_GET(current_pmap) in pcb_pmap so that we don't
lose if a process is preempted while pmap is temporarily switched to
  another pmap.
* For SMP, drop the high-fp state when a thread is switched away from
  so that if another cpu resumes that thread, it doesn't have to play
  games with IPI to get ahold of the correct register values.
2002-03-14 19:33:03 +00:00
Doug Rabson
48f7cc3fed Add pcpu.pc_current_pmap and pcb.pcb_pmap. 2002-03-14 19:20:24 +00:00
Doug Rabson
0323b941f0 * Add some KTR messages for IPIs.
* Don't call ast() from interrupt() - if we switch, then we will miss
  writing cr.eoi which will prevent the current cpu from receiving
  interrupts until the current thread is resumed. The call to ast()
  happens magically in exception_restore where it is safe.
* Add DDB 'show irq' command to examine interrupt hardware state.
2002-03-14 10:24:00 +00:00
Doug Rabson
838ba419e9 Add debug code to print SAPIC registers. 2002-03-14 10:17:08 +00:00
Doug Rabson
2750f739f9 * Use a mutex to protect the RID allocator.
* Use ptc.g instead of ptc.l so that TLB shootdowns are broadcast to the
  coherence domain.
* Use smp_rendezvous for pmap_invalidate_all to ensure it happens on all
  cpus.
* Dike out a DIAGNOSTIC printf which didn't compile.
* Protect the internals of pmap_install with cpu_critical_enter/exit.
2002-03-14 09:28:05 +00:00
Doug Rabson
26c01501cd Move the call to pmap_bootstrap to after the initialisation of thread0.
This allows us to use mutexes in pmap safely. Also initialise fpcurthread
for cpu0 so that ia64_fpstate_check doesn't barf during boot.
2002-03-14 09:20:07 +00:00
Doug Rabson
b81b083819 Don't restore r13 when returning to kernel mode. We may have migrated to
a different cpu since the exception_save and r13 needs to point at the
current cpu's pcpu structure.
2002-03-14 00:28:10 +00:00
Peter Wemm
a84c6cd303 Fix a warning (make ucontext_t *ucp a const) 2002-03-12 00:18:20 +00:00
Peter Wemm
db593b65d2 Stop concatenating __func__ with strings 2002-03-12 00:17:45 +00:00
John Baldwin
bb7d54e8c7 Fix a misspelling of mine: s/optomization/optimization/.
Noticed by:	bmilekic
2002-03-11 19:58:53 +00:00
Doug Rabson
a914a17e1d Add an implementation of cpu_throw() and make restorectx() simply branch
to the tail of cpu_switch.
2002-03-10 20:20:31 +00:00
Doug Rabson
f0ec35cae4 Don't try to print the arguments if the value of bsp is outside the
kernel - its asking for trouble.
2002-03-10 20:19:32 +00:00
Doug Rabson
a7f314ea94 Use the right value for the region length in parse_spill_mask. 2002-03-10 17:03:45 +00:00
Jake Burkholder
74acd9bb58 Include machine/smp.h. 2002-03-07 04:48:17 +00:00
Marcel Moolenaar
2242af42cf Call ast() only when we're handling a user trap. 2002-03-05 06:13:22 +00:00
Doug Rabson
1fc142b38f Add emulation support for PAL_VM_SUMMARY. 2002-03-04 12:47:47 +00:00
Doug Rabson
08cece4091 * Include <sys/ucontext.h> so that this compiles again.
* Move the section which manipulates ia64_pal_base to after cninit() so
  that we don't risk printing anything before we have a console.
* Don't call ia64_probe_sapics() for a SKI build. This should really
  be dependant on ACPICA being present or something.
2002-03-03 19:23:15 +00:00
Andrew R. Reiter
66c862bc1b - Move a comment from being on the same line as a #ifdef to the line
following it.  This should have gone in the previous commit, but
  misviewed Bruce's patch.

Requested by: bde
2002-02-28 21:52:08 +00:00
Andrew R. Reiter
216ae18217 - Fix panic() message and a couple style nits that snuck in from the
recent diagnostics commit (rev. 1.84).
2002-02-28 08:28:14 +00:00
John Baldwin
a854ed9893 Simple p_ucred -> td_ucred changes to start using the per-thread ucred
reference.
2002-02-27 18:32:23 +00:00
Mike Silbersack
7f3a40933b Fix a horribly suboptimal algorithm in the vm_daemon.
In order to determine what to page out, the vm_daemon checks
reference bits on all pages belonging to all processes.  Unfortunately,
the algorithm used reacted badly with shared pages; each shared page
would be checked once per process sharing it; this caused an O(N^2)
growth of tlb invalidations.  The algorithm has been changed so that
each page will be checked only 16 times.

Prior to this change, a fork/sleepbomb of 1300 processes could cause
the vm_daemon to take over 60 seconds to complete, effectively
freezing the system for that time period.  With this change
in place, the vm_daemon completes in less than a second.  Any system
with hundreds of processes sharing pages should benefit from this change.

Note that the vm_daemon is only run when the system is under extreme
memory pressure.  It is likely that many people with loaded systems saw
no symptoms of this problem until they reached the point where swapping
began.

Special thanks go to dillon, peter, and Chuck Cranor, who helped me
get up to speed with vm internals.

PR:		33542, 20393
Reviewed by:	dillon
MFC after:	1 week
2002-02-27 18:03:02 +00:00
Julian Elischer
77c4066424 Add some DIAGNOSTIC code.
While in userland, keep the thread's ucred reference in a shadow
field so that the usual place to store it is NULL.
If DIAGNOSTIC is not set, the thread ucred is kept valid until the next
kernel entry, at which time it is checked against the process cred
and possibly corrected. Produces a BIG speedup in
kernels with INVARIANTS set. (A previous commit corrected it
for the non INVARIANTS case already)

Reviewed by:	dillon@freebsd.org
2002-02-22 23:58:22 +00:00
Poul-Henning Kamp
1cbb9c3b03 Convert p->p_runtime and PCPU(switchtime) to bintime format. 2002-02-22 13:32:01 +00:00
Julian Elischer
db170a83d5 Duplicate the changes to i386 to keep creds over the user boundary. 2002-02-19 03:16:50 +00:00
Julian Elischer
079b7badea Pre-KSE/M3 commit.
this is a low-functionality change that changes the kernel to access the main
thread of a process via the linked list of threads rather than
assuming that it is embedded in the process. It IS still embeded there
but remove all teh code that assumes that in preparation for the next commit
which will actually move it out.

Reviewed by: peter@freebsd.org, gallatin@cs.duke.edu, benno rice,
2002-02-07 20:58:47 +00:00
Poul-Henning Kamp
e0ee6f5629 GC the PC_SWITCH* symbols which are not used in assembly anymore. 2002-02-07 10:27:58 +00:00