Commit Graph

886 Commits

Author SHA1 Message Date
ad
feb38f6706 Take skew into account for cpu_counter(). 2008-05-10 16:21:41 +00:00
ad
75ada79f33 Improve x86 tsc handling:
- Ditch the cross-CPU calibration stuff. It didn't work properly, and it's
  near impossible to synchronize the CPUs in a running system, because bus
  traffic will interfere with any calibration attempt, messing up the
  timings.

- Only enable the TSC on CPUs where we are sure it does not drift. If we are
  On a known good CPU, give the TSC high timecounter quality, making it the
  default.

- When booting CPUs, detect TSC skew and account for it. Most Intel MP
  systems have synchronized counters, but that need not be true if the
  system has a complicated bus structure. As far as I know, AMD systems
  do not have synchronized TSCs and so we need to handle skew.

- While an AP is waiting to be set running, try and make the TSC drift by
  entering a reduced power state. If we detect drift, ensure that the TSC
  does not get a high timecounter quality. This should not happen and is
  only for safety.

- Make cpu_counter() stuff LKM safe.
2008-05-10 16:12:32 +00:00
ad
9ab200719c Merge cpu_counter.h. 2008-05-10 14:53:54 +00:00
joerg
a790b941e6 Make cpu_idle a macro calling a function pointer on x86.
Select the Xen idle routine for Xen, mwait if supported by the CPU and
it is not AMD and halt otherwise. As reported by Christoph Egger,
AMD Barcelona keeps the CPU in C0 state with MWAIT, contrary to HLT,
which uses C1 and therefore much less power.
2008-05-09 18:11:28 +00:00
ad
39e9d8a066 doh 2008-05-06 23:03:03 +00:00
ad
cf45b9bae4 rw_tryenter: there is a few instruction race between reading rw_owner and
doing the cmpxchg, where another thread can successfully get a read hold
on the lock. That shouldn't fail anyone trying trying to get a read
hold. So for read locks, never bail just because the CAS fails, only bail
if we the status bits in the lock word say we can't have it.
2008-05-06 22:57:39 +00:00
ad
2f3850d422 Export tsc_freq via sysctl. 2008-05-05 17:47:06 +00:00
ad
5a2236b88e The kernel is too large. Reduce size by commenting out eye candy options:
{ACPI,MII,PCI,USB}VERBOSE

Also remove INCLUDE_CONFIG_FILE, because it doesn't make sense in GENERIC.
2008-05-05 14:44:26 +00:00
yamt
2d43e7b87b rename END to ENDLABEL. i'll use END for other purpose. ok by Andrew Doran. 2008-05-03 05:45:01 +00:00
ad
bfc5732320 - Give x86 BIOS boot the ability to load new style modules and pass them
into the kernel. Based on a patch by jmcneill@, with many fixes and
  improvements by me.

- Put MEMORY_DISK_DYNAMIC and MODULAR into the GENERIC kernels, so that
  you can load miniroot.kmod from the boot blocks and boot into the
  installer!
2008-05-02 15:26:38 +00:00
cegger
d9b775927c hpqlb(4): driver for HP Quick Launch buttons - found on HP Pavilion Notebooks 2008-05-01 20:18:18 +00:00
ad
ac118e2286 Shuffle ioapic/mainbus/cpu into std.amd64 like i386. 2008-04-30 22:08:18 +00:00
ad
5ed45d6c0f lcr0() was changed to take a u_long. pcb_cr0 was a 32-bit signed quantity.
It was being sign extended in cpu_hatch() (CR0_PG is always set), causing
systems to crash and reboot before going multiuser.
2008-04-30 21:04:24 +00:00
ad
e1df701f0d Avoid unneeded AST faults. 2008-04-30 12:44:27 +00:00
cegger
c92d850bb3 AMD's APM Volume 2 says 'All control registers are 64bit in long mode'.
Fix the CR0 prototype to match this (the asm implementation is correct though).
OK ad
2008-04-30 00:16:30 +00:00
ad
5804d4a96d Minor correction to previous. 2008-04-29 19:19:29 +00:00
ad
9a4949249f Recognise two new boot flags:
-1 disable MP
-2 disable ACPI
2008-04-29 19:18:19 +00:00
ad
7851dc4283 Get spl framework and interrupt gates working before breaking into DDB
on boot. PR port-amd64/30828.
2008-04-29 15:26:26 +00:00
ad
19f35718b6 Require MULTIPROCESSOR. PR kern/38537. 2008-04-29 12:43:58 +00:00
ad
104cf0ae89 Add support for kernel preeemption to the i386 and amd64 ports. Notes:
- I have seen one isolated panic in the x86 pmap, but otherwise i386
  seems stable with preemption enabled.

- amd64 is missing the FPU handling changes and it's not yet safe to
  enable it there.

- The usual level for kern.sched.kpreempt_pri will be 128 once enabled
  by default. For testing, setting it to 0 helps to shake out bugs.
2008-04-28 22:47:37 +00:00
martin
ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
ad
0cb8674c03 Make the trap stubs preemption safe. 2008-04-28 19:47:36 +00:00
ad
9c1818760e - Make some entry/exit points preemption safe.
- Try to avoid mispredicted bracnhes in Xsyscall.
- Interrupts were being enabled in Xsyscall _after_ checking for ASTs,
  while could have resulted in ugly behaviour like delayed signals or
  context switches. Fix it.
2008-04-28 19:35:56 +00:00
ad
50ca4969ff Noisy printf. 2008-04-28 18:49:40 +00:00
ad
25a2492fa0 Make kernel pagefault handling preeemption safe. 2008-04-28 18:32:12 +00:00
ad
6adfffcd49 - Make these preemption safe.
- Try to avoid mispredicted branches.
2008-04-28 18:31:15 +00:00
skd
8b7bbc0009 Fix pic locking to mirror simple_lock primitives. 2008-04-27 17:47:11 +00:00
ad
27168d9d58 - Rename crit_enter/crit_exit to kpreempt_disable/kpreempt_enable.
DragonflyBSD uses the crit names for something quite different.
- Add a kpreempt_disabled function for diagnostic assertions.
- Add inline versions of kpreempt_enable/kpreempt_disable for primitives.
- Make some more changes for preemption safety to the x86 pmap.
2008-04-27 11:37:48 +00:00
ad
e33af2987c +lcr2 2008-04-27 11:25:27 +00:00
ad
ba26c51443 Add 64-bit bus_space methods. 2008-04-24 21:01:40 +00:00
ad
284c2b9aef Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
2008-04-24 18:39:20 +00:00
ad
30abe39468 - Retire SYCALL_MPSAFE. With the exceptions of darwin and irix emulations,
all system calls are now MPSAFE.
- Remove unneeded acquire/release of kernel_lock.
2008-04-24 11:51:18 +00:00
ad
fff5f20c25 - Give ci_want_resched a single cache line, and align. This is for monitor/
mwait. At least one errata sheet from Intel notes that a single line
  should be used.
- Align cc_microtime.
2008-04-24 11:26:52 +00:00
he
1505dea7e8 Ensure that offsetof() is in scope by including <sys/systm.h>.
Fixes build problem found while building swapnetbsd.o for XEN3_DOM0.
2008-04-23 15:57:38 +00:00
cegger
68519ac971 amdtemp(4): Driver for AMD CPU Temperature Sensors. Adopted from OpenBSD's kate(4).
Changes beyond OpenBSD's driver:
- Improved support for AMD K8
- Added support for AMD Barcelona, AMD Phenom and AMD Griffin
Tested on various single and multi-socket machines.
Review and OK xtreame
2008-04-22 22:37:12 +00:00
cegger
9427277807 add acpitz at acpi 2008-04-21 20:20:12 +00:00
tls
6a70e45954 Work around PR38480 by making it possible to omit options MTRR from
amd64 INSTALL kernels -- and doing so.  At least you can now get an
INSTALL kernel onto a box with this odd MTRR configuration to debug it.
2008-04-21 19:06:42 +00:00
cegger
20161b7289 Access Xen's vcpu info structure per-CPU.
Tested on i386 and amd64 (both dom0 and domU) by me.
Xen2 tested (both dom0 and domU) by bouyer.
OK bouyer
2008-04-21 15:15:33 +00:00
ad
45e89afb6f Unneeded kernel_lock frobbing. 2008-04-21 12:51:37 +00:00
tls
002d314a9b Don't use mtrr functions if not options MTRR. There are many more instances
of this bug, particularly in the COMPAT_FOO32 code.
2008-04-21 00:18:39 +00:00
cegger
ed5b592b8e idt_* are not implemented for Xen. So don't provide the prototypes for Xen. 2008-04-19 12:10:08 +00:00
simonb
822574d0ac Reduce differences in dmesg output between i386 and amd64 slightly, both
now print "cpuN: features ....".
2008-04-19 06:29:23 +00:00
cegger
a0fc30e931 use POSIX integer types 2008-04-16 21:51:02 +00:00
jmcneill
3bc833ec73 Revert previous. 2008-04-11 11:24:41 +00:00
jmcneill
8715af2617 Remove code erroneously copied from i386 ACPI_ACQUIRE_GLOBAL_LOCK. 2008-04-11 02:30:05 +00:00
cegger
8dd00d48ab use aprint_*_dev
OK joerg
2008-04-04 20:31:50 +00:00
xtraeme
4889c380c2 Add finsio(4) entry (commented out). 2008-04-03 22:51:09 +00:00
christos
012e0e0132 make this compile with MPDEBUG. parts missing 2008-04-03 01:02:23 +00:00
cegger
3faf8c6fd7 convert to CFATTACH_DECL_NEW
OK matt and mrg
2008-04-01 23:44:48 +00:00
jmcneill
8c1cc2fb3f Enable asus(4) 2008-03-31 15:21:01 +00:00