Commit Graph

3162 Commits

Author SHA1 Message Date
Bruce Evans
3c9d896571 Quick fix for high resolution kernel profiling on i386's. Use
-finstrument-functions instead of -mprofiler-epilogue.  The former
works essentially the same as the latter but has a higher overhead
(about 22 more bytes per function for passing unused args to the
profiling functions).

Removed all traces of the IDENT Makefile variable, which had been
reduced to just a place for holding profiling's contribution to CFLAGS
(the IDENT that gives the kernel identity was renamed to KERN_IDENT).
2002-07-13 22:28:34 +00:00
Peter Wemm
5c5e3622e6 Two invlpg's slipped through that were not protected from I386_CPU
Pointed out by:	dillon
2002-07-13 21:55:11 +00:00
Peter Wemm
96fd5002b4 invlpg() does not work too well on i386 cpus. Add token i386 support
back in to the pmap_zero_page* stuff.
2002-07-13 21:03:08 +00:00
Peter Wemm
006490441d Do global shootdowns when switching to/from 4MB pages. I believe we can
do a shootdown on a 4MB "page" though, but this should be safer for now.

Noticed by:  tegge
2002-07-13 20:58:56 +00:00
Peter Wemm
a7b1f16c86 Bandaid for SMP. Changing APTDpde without a global shootdown is not
safe yet.  We used to do a global shootdown here anyway so another day
or so shouldn't hurt.
2002-07-13 20:56:18 +00:00
Alan Cox
753492f404 o Lock some page queue accesses, in particular, those by vm_page_unwire(). 2002-07-13 19:48:54 +00:00
Jonathan Mini
08b38412c8 Add additional cred_free_thread() calls that I had missed the first time.
Pointed out by:	jhb
2002-07-13 04:36:50 +00:00
Matthew Dillon
fbcf77c2ea Re-enable the idle page-zeroing code. Remove all IPIs from the idle
page-zeroing code as well as from the general page-zeroing code and use a
lazy tlb page invalidation scheme based on a callback made at the end
of mi_switch.

A number of people came up with this idea at the same time so credit
belongs to Peter, John, and Jake as well.

Two-way SMP buildworld -j 5 tests (second run, after stabilization)
    2282.76 real  2515.17 user  704.22 sys	before peter's IPI commit
    2266.69 real  2467.50 user  633.77 sys	after peter's commit
    2232.80 real  2468.99 user  615.89 sys	after this commit

Reviewed by:	peter, jhb
Approved by:	peter
2002-07-12 20:17:06 +00:00
John Baldwin
33d7ad1abe Set the thread state of the newly chosen to run thread to TDS_RUNNING in
choosethread() in MI C code instead of doing it in in assembly in all the
various cpu_switch() functions.  This fixes problems on ia64 and sparc64.

Reviewed by:	julian, peter, benno
Tested on:	i386, alpha, sparc64
2002-07-12 18:34:22 +00:00
Peter Wemm
f1b665c8fe Revive backed out pmap related changes from Feb 2002. The highlights are:
- It actually works this time, honest!
- Fine grained TLB shootdowns for SMP on i386.  IPI's are very expensive,
  so try and optimize things where possible.
- Introduce ranged shootdowns that can be done as a single IPI.
- PG_G support for i386
- Specific-cpu targeted shootdowns.  For example, there is no sense in
  globally purging the TLB cache for where we are stealing a page from
  the local unshared process on the local cpu.  Use pm_active to track
  this.
- Add some instrumentation for the tlb shootdown code.
- Rip out SMP code from <machine/cpufunc.h>
- Try and fix some very bogus PG_G and PG_PS interactions that were bad
  enough to cause vm86 bios calls to break.  vm86 depended on our existing
  bugs and this was the cause of the VESA panics last time.
- Fix the silly one-line error that caused the 'panic: bad pte' last time.
- Fix a couple of other silly one-line errors that should have caused more
  pain than they did.

Some more work is needed:
- pmap_{zero,copy}_page[_idle].  These can be done without IPI's if we
  have a hook in cpu_switch.
- The IPI handlers need some cleanup.  I have a bogus %ds load that can
  be avoided.
- APTD handling is rather bogus and appears to be a large source of
  global TLB IPI shootdowns for no really good reason.

I see speedups of between 1.5% and ~4% on buildworlds in a while 1 loop.
I expect to see a bigger difference when there is significant pageout
activity or the system otherwise has memory shortages.

I have backed out a few optimizations that I had been using over the last
few days in order to be a little more conservative.  I'll revisit these
again over the next few days as the dust settles.

New option:  DISABLE_PG_G - In case I missed something.
2002-07-12 07:56:11 +00:00
Alfred Perlstein
074453c230 Introduce syscall.master option 'COMPAT4' which allows one to wrap
syscalls for FreeBSD 4 compatibility.
Add kernel option COMPAT_FREEBSD4 to enable these syscalls.
2002-07-12 06:38:34 +00:00
Peter Wemm
4a0226c633 Unexpand a couple of 8-space indents that I added in rev 1.285. 2002-07-12 04:58:51 +00:00
Peter Wemm
da035a22eb Bah, move the invltlb counter to C code and hook a debug sysctl onto it. 2002-07-11 08:31:10 +00:00
Peter Wemm
dedf64505a s/NCPU/MAXCPU/ to try and get this to compile. 2002-07-11 08:24:33 +00:00
Julian Elischer
83587634ec fix a comment and note a problem with XXXSMP 2002-07-10 21:17:23 +00:00
Matthew Dillon
50b6a55512 Remove the critmode sysctl - the new method for critical_enter/exit (already
the default) is now the only method for i386.

Remove the paraphanalia that supported critmode.  Remove td_critnest, clean
up the assembly, and clean up (mostly remove) the old junk from
cpu_critical_enter() and cpu_critical_exit().
2002-07-10 20:15:58 +00:00
David E. O'Brien
b8e7c5a8e1 Consistently line-up /**/ comments so they don't cause line wrappage. 2002-07-10 19:36:04 +00:00
Julian Elischer
f55348f07c Include all of isa/ipl.s into exception.s as there is now nothing left in
ipl.s except doreti which really belongs in with the exceptions as it's
just the other side of the same coin. Will remove ipl.s in a separate commit.

Agreed by: several including bde@freebsd.org
2002-07-10 02:24:44 +00:00
Mark Murray
8d03e1e931 Comment out apm; ACPI is the modern replacement, and folks who really
need it can uncomment it. This may buy us some kernel space.

Discussed with:	imp & msmith (quite a while ago)
2002-07-08 11:56:44 +00:00
Peter Wemm
9ecb46bf87 The clock is already allocated as 'fast' - no need to try and intercept a
'slow' interrupt registration and convert it into 'fast'.
2002-07-08 09:12:22 +00:00
Peter Wemm
fcdc053233 Cosmetic. Remove #if 0 definition of vtophys() - it predates 4MB pages.
Remove avtophys(), it isn't referenced anywhere.
2002-07-08 08:14:28 +00:00
Peter Wemm
a58b3a6878 Add a special page zero entry point intended to be called via the single
threaded VM pagezero kthread outside of Giant.  For some platforms, this
is really easy since it can just use the direct mapped region.  For others,
IPI sending is involved or there are other issues, so grab Giant when
needed.

We still have preemption issues to deal with, but Alan Cox has an
interesting suggestion on how to minimize the problem on x86.

Use Luigi's hack for preserving the (lack of) priority.

Turn the idle zeroing back on since it can now actually do something useful
outside of Giant in many cases.
2002-07-08 04:24:26 +00:00
Peter Wemm
19981bcd54 s/procrunnable/kserunnable/ in a comment 2002-07-08 01:52:55 +00:00
Peter Wemm
64ca701084 Fix a hideous TLB bug. pmap_unmapdev neglected to remove the device
mappings from the page tables, which were mapped with PG_G!  We could
reuse the page table entry for another mapping (pmap_mapdev) but it
would never have cleared any remaining PG_G TLB entries.
2002-07-08 00:17:43 +00:00
Peter Wemm
a136efe9b6 Collect all the (now equivalent) pmap_new_proc/pmap_dispose_proc/
pmap_swapin_proc/pmap_swapout_proc functions from the MD pmap code
and use a single equivalent MI version.  There are other cleanups
needed still.

While here, use the UMA zone hooks to keep a cache of preinitialized
proc structures handy, just like the thread system does.  This eliminates
one dependency on 'struct proc' being persistent even after being freed.
There are some comments about things that can be factored out into
ctor/dtor functions if it is worth it.  For now they are mostly just
doing statistics to get a feel of how it is working.
2002-07-07 23:05:27 +00:00
Warner Losh
22c0046f53 Make NEWCARD the default pccard/cardbus system. 2002-07-07 19:00:00 +00:00
Maxime Henrion
44c9e34eda One #include <sys/lock.h> is enough.
Submitted by:	Olivier Houchard <cognet@ci0.org>
2002-07-07 18:05:42 +00:00
David E. O'Brien
ce03184300 Make space for compilations. 2002-07-06 02:49:07 +00:00
Peter Wemm
3a7ef7918c Diff reduction (microoptimization) with another WIP. Move the frame
calculation in get_ptbase() to a little later on.
2002-07-04 19:53:24 +00:00
Julian Elischer
8692e184dc Don't free pages we never allocated..
My eyes openned by: Matt
2002-07-04 00:35:48 +00:00
Julian Elischer
0d6735c628 Slight restatement of the code and remove some unused variables. 2002-07-04 00:04:06 +00:00
Julian Elischer
e04d8bf890 Add comments and slightly rearrange the thread stack assignment code
to try make it less obscure.
2002-07-03 20:47:50 +00:00
Julian Elischer
b2adb4b2c3 Remove vestiges of old code...
These functions are always called on new memory so they can
not already be set up, so don't bother testing for that.
(This was left over from before we used UMA (which is cool))
2002-07-03 20:06:38 +00:00
Mitsuru IWASAKI
74fc979a09 Resolve conflicts arising from the ACPI CA 20020404 import. 2002-06-30 17:53:12 +00:00
David E. O'Brien
ea9ea04c0d This is the start of the FreeBSD/x86_64 kernel. 2002-06-30 08:57:17 +00:00
David E. O'Brien
176d0ec15d This is the start of the FreeBSD/x86_64 kernel. 2002-06-30 07:42:36 +00:00
David E. O'Brien
eca69d62e7 Gcc 3.1 varargs support. 2002-06-30 07:22:30 +00:00
Mike Barcroft
a19d429398 Since printf(3) now supports the `j' conversion specifier, use that
when printing intmax_t and uintmax_t.

Forgotten by:	mike
Noticed by:	bde
2002-06-30 05:48:03 +00:00
Robert Watson
006f19e4f2 Remove ALT_BREAK_TO_DEBUGGER. This was inconsistent (both in form
and function) with existing configuration choices.  Arguably if
ALT_BREAK_TO_DEBUGGER was present, so should have been
BREAK_TO_DEBUGGER.  Regardless, it broke the option sort order in
these kernel configuration files.

Requested by:	bde
2002-06-30 04:12:21 +00:00
Julian Elischer
8540497c50 Fix reverse ordering of locks. add a comment about locks on some platforms.
Submitted by:	jhb@freebsd.org
2002-06-29 23:58:50 +00:00
Julian Elischer
e602ba25fd Part 1 of KSE-III
The ability to schedule multiple threads per process
(one one cpu) by making ALL system calls optionally asynchronous.
to come: ia64 and power-pc patches, patches for gdb, test program (in tools)

Reviewed by:	Almost everyone who counts
	(at various times, peter, jhb, matt, alfred, mini, bernd,
	and a cast of thousands)

	NOTE: this is still Beta code, and contains lots of debugging stuff.
	expect slight instability in signals..
2002-06-29 17:26:22 +00:00
Julian Elischer
44990b8cb8 Add files that are new for KSE. 2002-06-29 07:04:59 +00:00
Peter Wemm
160554fbf4 Remove a couple of __P() stragglers. 2002-06-29 02:32:34 +00:00
Andrew R. Reiter
c6d84b4d4b Fix for the problem stated below by Tor Egge:
(from: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=832566+0+ \
       current/freebsd-current)

  "Too many pages were prefaulted in pmap_object_init_pt, thus
   the wrong physical page was entered in the pmap for the virtual
   address where the .dynamic section was supposed to be."

Submitted by:	tegge
Approved by:	tegge's patches never fail
2002-06-27 06:34:03 +00:00
Ian Dowse
23f09d50bb Avoid using the 64-bit vm_pindex_t in a few places where 64-bit
types are not required, as the overhead is unnecessary:

 o In the i386 pmap_protect(), `sindex' and `eindex' represent page
   indices within the 32-bit virtual address space.
 o In swp_pager_meta_build() and swp_pager_meta_ctl(), use a temporary
   variable to store the low few bits of a vm_pindex_t that gets used
   as an array index.
 o vm_uiomove() uses `osize' and `idx' for page offsets within a
   map entry.
 o In vm_object_split(), `idx' is a page offset within a map entry.
2002-06-26 20:32:51 +00:00
Ian Dowse
6395da5437 Complete the initial set of VM changes required to support full
64-bit file sizes. This step simply addresses the remaining overflows,
and does attempt to optimise performance. The details are:

 o Use a 64-bit type for the vm_object `size' and the size argument
   to vm_object_allocate().
 o Use the correct type for index variables in dev_pager_getpages(),
   vm_object_page_clean() and vm_object_page_remove().
 o Avoid an overflow in the i386 pmap_object_init_pt().
2002-06-25 22:14:06 +00:00
Peter Wemm
417a86bac7 Compile in the cpu halt code even on SMP, instead just default the
sysctl (machdep.cpu_idle_hlt) to off in the SMP case.  This allows you to
turn it on if you wish and do not particularly care about the small window
where a cpu will remain halted even when a job is placed on the run queue
(until the next clock tick).
2002-06-24 21:31:57 +00:00
Jake Burkholder
8ba3d077ff Add an MD callout like cpu_exit, but which is called after sched_lock is
obtained, when all other scheduling activity is suspended.  This is needed
on sparc64 to deactivate the vmspace of the exiting process on all cpus.
Otherwise if another unrelated process gets the exact same vmspace structure
allocated to it (same address), its address space will not be activated
properly.  This seems to fix some spontaneous signal 11 problems with smp
on sparc64.
2002-06-24 15:48:02 +00:00
Jonathan Mini
00676596e3 userout -> out. These two labels are now identical.
Approved by:	alfred
2002-06-24 06:23:41 +00:00
Jonathan Mini
01ad8a53db Remove unused diagnostic function cread_free_thread().
Approved by:	alfred
2002-06-24 06:22:00 +00:00