Commit graph

90024 commits

Author SHA1 Message Date
Marcel Moolenaar d1d7df1905 Fix an alpha inheritance bug:
On alpha, PAL is involved in context management and after wiring
the CPU (in alpha_init()) a context switch was performed to tell
PAL about the context. This was bogusly brought over to ia64
where it introduced bugs, because we restored the context from
a mostly uninitialized PCB.

The cleanup constitutes:
o  Remove the unused arguments from ia64_init().
o  Don't return from ia64_init(), but instead call mi_startup()
   directly. This reduces the amount of muckery in assembly and
   also allows for the next bullet:
o  Save our currect context prior to calling mi_startup(). The
   reason for this is that many threads are created from thread0
   by cloning the PCB. By saving our context in the PCB, we have
   something sane to clone. It also ensures that a cloned thread
   that does not alter the context in any way will return to
   the saved context, where we're ready for the eventuality with
   a nice, user unfriendly panic().

The cleanup fixes at least the following bugs:
o  Entering mi_startup() with the RSE in enforced lazy mode.
o  Re-execution of ia64_init() in certain "lab" conditions.

While here, add proper unwind directives to __start() so that
the unwind knows it has reached the bottom of the (call) stack.

Approved by: re@ (blanket)
2003-05-24 00:17:34 +00:00
Marcel Moolenaar ca125f9c17 Fix a (new) source of instability:
When interrupting a kernel context, we don't need to switch stacks
(memory nor register). As such, we were also not restoring the
register stack pointer (ar.bspstore). This, however, fails to be
valid in 1 situation: when we interrupt a register stack switch as
is being done in restorectx(). The problem is that restorectx()
needs to have ar.bsp == ar.bspstore before it can assign the new
value to ar.bspstore. This is achieved by doing a loadrs prior to
assigning to ar.bspstore. If we take an interrupt in between the
loadrs and the assignment and we don't make sure we restore the
ar.bspstore prior to returning from the interrupt, we switch
stacks with possibly non-zero dirty registers, which means that
the new frame pointer (ar.bsp) will be invalid.

So, instead of jumping over the restoration of the register frame
pointer and related registers, we conditionalize it based on whether
we return to kernel context or user context. A future performance
tweak is possible by only restoring ar.bspstore when returning to
kernel mode *and* when the RSE is in enforced lazy mode. One cannot
assume ar.bsp == ar.bspstore if the RSE is not in enforced lazy mode
anyway.

While here (well, not quite) don't unconditionally assign to
ar.bspstore in exception_save. Only do that when we actually switch
stacks. It can only harm us to do it unconditionally.

Approved by: re@ (blanket)
2003-05-23 23:55:31 +00:00
Mike Makonnen 59a47b31d0 Add two functions: _spinlock_pthread() and _spinunlock_pthread()
that take the address of a struct pthread as their first argument.
_spin[un]lock() just become wrappers arround these two functions.
These new functions are for use in situations where curthread can't be
used. One example is _thread_retire(), where we invalidate the array index
curthread uses to get its pointer..

Approved by:	re/blanket libthr
2003-05-23 23:39:31 +00:00
Marcel Moolenaar 42b919d4a6 In swapctx(), put the RSE in enforced lazy mode before we flush the
register stack. There's nothing really wrong with flushing before
putting the RSE in enforced lazy mode, provided you don't depend on
ar.bspstore being equal to ar.bsp when the RSE has been put in
enforced lazy more. The small window between the flush and setting
the RSE may be sufficient to have the RSE eagerly increase the dirty
region (and hence cause ar.bspstore != ar.bsp) or have an interrupt
that may even get the laziest RSE to do something.

Anyway: we don't depend on ar.bspstore being equal to ar.bsp, so
nothing was and is broken. But the code was non-intuitive and
easily confuses. This is a source of future bugs.

Note: the advantage of not depending on ar.bspstore is that there's
some recilience against an interrupted flushrs. Clobbering is limited
to stacked register contents only, not to RSE address clobbering.

Approved: re@ (blanket)
2003-05-23 23:16:43 +00:00
Nate Lawson 91113bc86a Fix a typo in rev 1.10 2003-05-23 21:40:07 +00:00
Bruce A. Mah 9aac2345ef Flesh out the libkse note a bit. Source material kindly provided by
deischen, any inaccuracies are mine.

Approved by:	re (implicitly)
2003-05-23 20:10:46 +00:00
Alan Cox 2e05d89828 Make the maximum number of vnodes a function of both the physical memory
size and the kernel's heap size, specifically, vm_kmem_size.  This
function allows a maximum of 40% of the vm_kmem_size to be used for
vnodes and vm objects.  This is a conservative bound based upon recent
problem reports.  (In other words, a slight increase in this percentage
may be safe.)

Finally, machines with less than ~3GB of RAM should be unaffected
by this change, i.e., the maximum number of vnodes should remain
the same.  If necessary, machines with 3GB or more of RAM can increase
the maximum number of vnodes by increasing vm_kmem_size.

Desired by:	scottl
Tested by:	jake
Approved by:	re (rwatson,scottl)
2003-05-23 19:54:02 +00:00
Bruce A. Mah f0e53e36ca I'm lost in a maze of twisty little tunables, all different.
The ACPI-disabling hint goes into device.hints, not loader.conf.

Pointed out by:	njl
2003-05-23 17:27:32 +00:00
Bruce A. Mah ebef34e84b Add some hopefully helpful notes about ACPI.
Approved by:	re (implicitly)
Reviewed by:	imp
2003-05-23 16:37:23 +00:00
Hiroki Sato 384e8e93c1 Move ($create-refentry-xref-link$) to the language-neutral place
and add entities &release.manpath.*; for man.cgi's manpath=XXX.

Approved by:	re (bmah)
2003-05-23 10:30:27 +00:00
Mike Makonnen b32a99e5f4 EDOOFUS
Prevent one thread from messing up another thread's saved signal
mask by saving it in struct pthread instead of leaving it as a
global variable. D'oh!

Approved by:	re/blanket libthr
2003-05-23 10:28:13 +00:00
Mike Makonnen 7d9d7ca2ed Make WARNS2 clean. The fixes mostly included:
o removed unused variables
	o explicit inclusion of header files
	o prototypes for externally defined functions

Approved by:    re/blanket libthr
2003-05-23 09:48:20 +00:00
Mike Makonnen 4e3f7b6ede note to self: do not confuse void* with int.
Approved by:	re/blanket libthr
2003-05-23 08:13:24 +00:00
Peter Wemm d9cd1af4aa Typo fix. oops.
Submitted by:  jmallett
Approved by:   re (blanket amd64/*)
2003-05-23 06:36:46 +00:00
Peter Wemm cbd667fa2f Update comments. Note that the kernel is at -1GB, not -2GB as erroniously
implied by the previous commit.  KVM is still only 1GB until
pmap_growkernel() learns about the extra page table level.

Approved by:  re (blanket)
2003-05-23 06:35:45 +00:00
Peter Wemm f229f5cf85 As suggested by the gdb folks, pad the 'struct fpreg' to a full 512 bytes
to match the native fxsave/fxrstor object size since thats apparently what
the Linux/NetBSD folks do.
2003-05-23 06:31:56 +00:00
Peter Wemm 59fb3d1055 Add amd64 to the MACHINE_ARCH list of systems that link bsdlabel to
disklabel.  I just got burnt again by having an old disklabel binary
kicking around.

Discussed with: phk
Approved by:    re (safe amd64 stuff)
2003-05-23 06:08:28 +00:00
Peter Wemm 637068b1d3 Low risk amd64 fix. Use a vm_offset_t for the virtual location of the
buffer space instead of a u_int32_t.  Otherwise the upper 32 bits of
the address space get truncated and syscons blows up.

Approved by:	re (safe, low risk amd64 fixes)
2003-05-23 05:10:49 +00:00
Peter Wemm 9f0c4ab393 Deal with the user VM space expanding. 32 bit applications do not like
having their stack at the 512GB mark.  Give 4GB of user VM space for 32
bit apps.  Note that this is significantly more than on i386 which gives
only about 2.9GB of user VM to a process (1GB for kernel, plus page
table pages which eat user VM space).

Approved by: re (blanket)
2003-05-23 05:07:33 +00:00
Peter Wemm 3c9a3c9ca3 Major pmap rework to take advantage of the larger address space on amd64
systems.  Of note:
- Implement a direct mapped region using 2MB pages.  This eliminates the
  need for temporary mappings when getting ptes.  This supports up to
  512GB of physical memory for now.  This should be enough for a while.
- Implement a 4-tier page table system.  Most of the infrastructure is
  there for 128TB of userland virtual address space, but only 512GB is
  presently enabled due to a mystery bug somewhere.  The design of this
  was heavily inspired by the alpha pmap.c.
- The kernel is moved into the negative address space(!).
- The kernel has 2GB of KVM available.
- Provide a uma memory allocator to use the direct map region to take
  advantage of the 2MB TLBs.
- Fixed some assumptions in the bus_space macros about the ability
  to fit virtual addresses in an 'int'.

Notable missing things:
- pmap_growkernel() should be able to grow to 512GB of KVM by expanding
  downwards below kernbase.  The kernel must be at the top 2GB of the
  negative address space because of gcc code generation strategies.
- need to fix the >512GB user vm code.

Approved by:	re (blanket)
2003-05-23 05:04:54 +00:00
Greg Lehey 74f2cc2c9c Change the way the plex lock mutexes work. Previously they were part
of the struct plex, which tore apart the mutex linked lists when the
plex table was expanded.  Now we maintain a pool of mutexes (currently
32) to be shared by all plexes.  This is still a lot better than the
splhigh() method used in other architectures.

expand_table: Add parameters file and line if we're debugging.

Approved by: re (jhb)
2003-05-23 01:15:55 +00:00
Greg Lehey 93573e2e76 Change the way the plex lock mutexes work. Previously they were part
of the struct plex, which tore apart the mutex linked lists when the
plex table was expanded.  Now we maintain a pool of mutexes (currently
32) to be shared by all plexes.  This is still a lot better than the
splhigh() method used in other architectures.

Add and clarify comments.

Approved by: re (jhb)
2003-05-23 01:15:30 +00:00
Greg Lehey 7db14b2ff2 expand_table: Add parameters file and line if we're debugging.
MMalloc, vinum_meminfo: Use strlcpy to copy file name.

Approved by: re (jhb)
2003-05-23 01:15:01 +00:00
Greg Lehey d026346c86 Change the way the plex lock mutexes work. Previously they were part
of the struct plex, which tore apart the mutex linked lists when the
plex table was expanded.  Now we maintain a pool of mutexes (currently
32) to be shared by all plexes.  This is still a lot better than the
splhigh() method used in other architectures.

Approved by: re (jhb)
2003-05-23 01:14:35 +00:00
Greg Lehey 8a697ff435 detachobject: Update volume config after detaching a plex.
update_volume_config: Remove redundant diskconfig parameter.

Approved by: re (jhb)
2003-05-23 01:14:13 +00:00
Greg Lehey cb5eba5e09 Change the way the plex lock mutexes work. Previously they were part
of the struct plex, which tore apart the mutex linked lists when the
plex table was expanded.  Now we maintain a pool of mutexes (currently
32) to be shared by all plexes.  This is still a lot better than the
splhigh() method used in other architectures.

update_volume_config: Remove redundant diskconfig parameter.

expand_table: Add parameters file and line if we're debugging.

Approved by: re (jhb)
2003-05-23 01:13:43 +00:00
Greg Lehey f7b76dc815 Change many strcpys to strlcpys, etc.
Submitted by:	   Ted Unangst <tedu@stanford.edu>

Correct some inaccurate and badly formatted comments.

config_subdisk: If our drive is down, ensure that the subdisk is
		crashed.  Previously it was possible for the subdisk
		to be up when the drive was down.

Change the way the plex lock mutexes work.  Previously they were part
of the struct plex, which tore apart the mutex linked lists when the
plex table was expanded.  Now we maintain a pool of mutexes (currently
32) to be shared by all plexes.  This is still a lot better than the
splhigh() method used in other architectures.

update_volume_config: Remove redundant diskconfig parameter.

Approved by: re (jhb)
2003-05-23 01:13:10 +00:00
Bruce A. Mah 47e5e405b1 Modified release note: Note code generation problems with the base
system GCC using -march=pentium4, and the local workaround in our
Makefile infrastructure.

Approved by:	re (implicitly)
2003-05-23 00:02:10 +00:00
Warner Losh 7c8cd16cb9 o Document the tunables that acpi allows. (mdoc gurus please comment
on and fix if neceeary).
o Note that acpi is available on i386-ia32, ia64 and amd64, not just 'intel'
  platforms.  Intel has had nothing to do with amd64.

Approved by: re (scottl@)
2003-05-22 23:58:50 +00:00
Bruce A. Mah fabf3816c2 Correctly tag some on-board Ethernet devices with the right
architecture.

Approved by:	re (implicitly)
2003-05-22 23:22:59 +00:00
Bruce A. Mah 7c7f55e495 Note a puc(4) device that works on ia64.
Submitted by:	Jim Brown <jpb@sixshooter.v6.thrupoint.net>
Approved by:	re (implicitly)
2003-05-22 23:19:01 +00:00
Bruce A. Mah fcfbfec0d4 Add more ia64 device information, in a section similar to that for
FreeBSD/alpha.  Heavily hacked version of a diff that was...

Submitted by:	Jim Brown <jpb@sixshooter.v6.thrupoint.net>
Approved by:	re (implicitly)
2003-05-22 23:14:52 +00:00
Bruce A. Mah ea0257d172 Enable some devices on ia64. Based on patch that was...
Submitted by:	Jim Brown <jpb@sixshooter.v6.thrupoint.net>
Approved by:	re (implicitly)
2003-05-22 22:40:22 +00:00
Peter Wemm 997f3bfc2a Merge from i386/trap.c rev 1.252. Use td_critnest instead of the
spinlocks count for explicitly enabling interrupts.

Approved by:	re (blanket)
2003-05-22 20:09:50 +00:00
Ruslan Ermilov ca7367cce4 The "krb5" distribution was merged with "crypto", record the death.
Reviewed by:	jhb
Approved by:	re (jhb)
2003-05-22 18:41:16 +00:00
Doug Barton a32bb1b53a When newfs'ing a partition with UFS2 that had previously been newfs'ed
with UFS1, the UFS1 superblocks were not deleted. This allowed any
RELENG_4 (or other non-UFS2-aware) fsck to think it knew how to "fix"
the file system, resulting in severe data scrambling.

This patch is a more advanced version than the one originally submitted.
Lukas improved it based on feedback from Kirk, and testing by me. It
blanks all UFS1 superblocks (if any) during a UFS2 newfs, thereby causing
fsck's that are not UFS2 aware to generate the "SEARCH FOR ALTERNATE
SUPER-BLOCK FAILED" message, and exit without damaging the fs.

PR:		bin/51619
Submitted by:	Lukas Ertl <l.ertl@univie.ac.at>
Reviewed by:	kirk
Approved by:	re (scottl)
2003-05-22 18:38:54 +00:00
Bernd Walter cdc95e1bb8 Calculate routed interrupts using the slot number from the device and
not that of the bridge.

Approved by:	re (jhb)
2003-05-22 17:45:26 +00:00
Bruce A. Mah 386024a294 Mark a couple of instances of onboard NICs as i386-only.
Approved by:	re (implicitly)
2003-05-22 17:25:24 +00:00
Mike Barcroft 6f9622a926 Fix two misuses of __BSD_VISIBLE.
Submitted by:	bde
Approved by:	re
2003-05-22 17:07:57 +00:00
Eric Anholt b1aff8bff1 Change -march=pentium4 to -march=pentium3 when CPUTYPE==p4, because gcc 3.2 is
known to produce broken code with -march=pentium4.  Add a note explaining this.
This should be removed when we update to gcc 3.3 or the bug is otherwise fixed.

Approved by:	re
2003-05-22 16:56:46 +00:00
Bruce A. Mah 91665c5c32 Add a link to the FreeBSD/ia64 project. Maybe should do this for
other platforms that have their own project pages too?

Based on a patch that was:

Submitted by:	Jim Brown <jpb@sixshooter.v6.thrupoint.net>
Approved by:	re (implicitly)
2003-05-22 15:51:45 +00:00
Bruce A. Mah 987e1d368f Update the abstract to be somewhat more helpful. Based on a patch
that was...

Submitted by:	Jim Brown <jpb@sixshooter.v6.thrupoint.net>
Approved by:	re (implicitly)
2003-05-22 15:42:50 +00:00
Ruslan Ermilov c75a6a726b Erase whitspace at EOL.
Approved by:	re (blanket)
2003-05-22 13:10:32 +00:00
Ruslan Ermilov 3a5146d9e2 Assorted mdoc(7) fixes.
Approved by:	re (blanket)
2003-05-22 13:02:28 +00:00
Ruslan Ermilov db1e3a4f98 Erase whitespace at EOL.
Approved by:	re (blanket)
2003-05-22 11:56:41 +00:00
Ruslan Ermilov b4ad5e27f4 Moved $FreeBSD$ tag to where it belongs.
Approved by:	re (blanket)
2003-05-22 11:55:26 +00:00
Ruslan Ermilov 07958659ba Nitpicking.
Approved by:	re (blanket)
2003-05-22 11:54:53 +00:00
Ruslan Ermilov f062eac425 Assorted mdoc(7) fixes.
Approved by:	re (blanket)
2003-05-22 11:52:23 +00:00
Ruslan Ermilov a0218a2a4d Unbreak world build if NO_OPENSSL is defined but NO_KERBEROS is not.
Submitted by:	Marius Strobl <marius@alchemy.franken.de>
Approved by:	re (jhb)
2003-05-21 21:47:20 +00:00
David E. O'Brien 5da30ee2ba Remove alpha-specific floppy build target for now.
Approved by:	re(jhb)
2003-05-21 21:19:54 +00:00