Commit Graph

1068 Commits

Author SHA1 Message Date
bouyer
a3e0c29742 add a missing splvm()/splx() to protect the xpq queue. 2012-01-19 22:04:05 +00:00
pgoyette
765ec9791f No need for CPU_UCODE here now that it is global 2012-01-14 04:22:56 +00:00
cegger
a3f6c06746 Support CPU microcode loading via cpuctl(8).
Implemented and enabled via CPU_UCODE kernel config option
for x86 and Xen Dom0.
Tested on different AMD machines with different
CPU families.

ok wiz@ for the manpages
ok releng@
ok core@ via releng@
2012-01-13 16:05:14 +00:00
cherry
2504a10c74 relocate pte_lock initialisation to the earliest points after %fs is first usable in the XEN bootpath 2012-01-12 19:49:37 +00:00
cherry
92e3d6b9c9 Remove redundant use of curcpu(). 2012-01-09 13:35:42 +00:00
cherry
c6e7b43873 Remove obsolete comment. 2012-01-09 13:33:38 +00:00
cherry
66e35f7978 Make cross-cpu pte access MP safe.
XXX: review cases of use of pmap_set_pte() vs direct use of xpq_queue_pte_update()
2012-01-09 13:04:13 +00:00
cherry
0e1fd236aa Harden cross-cpu L3 sync - avoid optimisations that may race.
Update ci->ci_kpm_pdir from user pmap, not global pmap_kernel() entry which may get clobbered by other CPUs.
XXX: Look into why we use pmap_kernel() userspace entries at all.
2012-01-09 12:58:49 +00:00
cherry
d515295709 revert previous commit. DIAGNOSTIC should only do strict checks, not muffle current ones 2012-01-09 04:39:14 +00:00
cherry
44fb314fb7 Address those pesky DIAGNOSTIC messages. \n
Take a performance hit at fork() for not DTRT. \n
Note: Only applicable for kernels built with "options DIAGNOSTIC" \n
2012-01-06 15:15:27 +00:00
jym
9fc3eceb8b Comment fix. 2012-01-05 18:11:50 +00:00
cherry
a4131cfa05 Tighten up locking in the network driver.
This probably needs more attention since xennet_rx_mbuf_free() hooks
into the network layer.
The locking can also be made finer grained. Performance testing could
add some insights.
2012-01-04 10:48:24 +00:00
cherry
84d4985e86 Use macro PDP_SIZE instead of numeric constant, for unshared PAE L3 entries.
Thanks jym@
2012-01-04 10:30:23 +00:00
cherry
b83ccb0e45 Never cut-paste code from email!
Use the right count (0 -> 2) of l3 unshared userland entries for per-cpu initialisation.
2011-12-30 19:18:35 +00:00
cherry
d827fd25ea Force pae l3 page allocation for new vcpus to be < 4G, so they fit in 32bits 2011-12-30 18:01:20 +00:00
cherry
d12f2f3b2f per-cpu shadow directory pages should be updated locally via cross-calls. Do this. 2011-12-30 16:55:21 +00:00
cherry
7603d0cfb3 Remove spurious (debug) printf() 2011-12-30 12:16:19 +00:00
cherry
6cc7a9d8d3 Remove temporary variable definition that is unused in non DIAGNOSTIC builds. 2011-12-28 18:59:21 +00:00
cherry
c4baef9634 Optimise branch predict hint for the intended use-case (cross cpu event notification) 2011-12-27 07:47:00 +00:00
cherry
533ee572b1 Do not touch pending flags across vcpus 2011-12-27 07:45:41 +00:00
jym
63a89b8713 Properly protect the min/target variables from balloon_sc, not just target.
Use their reference directly instead of going through their opaque
sysctl_data storage. It makes the locking a bit more obvious.
2011-12-26 20:26:38 +00:00
cherry
4dcdeeab68 Do not fiddle with the event masks of non-local vcpus when unmasking events across vcpus 2011-12-26 18:27:11 +00:00
joerg
417b55d96e Move Clang-warning flags for ah_regdomain.c into sys/conf, they are
platform independent. Use the selective -Wno-* flags instead of
-Wno-error.
2011-12-19 14:06:16 +00:00
cherry
f554225498 Move events/interrupt subsystem initialisation to before when ipis are used 2011-12-09 11:47:49 +00:00
cegger
9e447445b5 re-apply merge loss 2011-12-09 10:14:20 +00:00
cherry
e84002488c Use mutex(9) instead of spl(9). Add further locks around grant table access. 2011-12-09 03:58:12 +00:00
cherry
a58ac9f339 kmem_free() the appropriate size.
Thanks cegger@
2011-12-08 03:34:44 +00:00
cegger
6fe7c102d5 replace malloc() with kmem_zalloc() per request from cherry.
While here fix error path.

XXX: The size allocated and freed for interrupt handlers looks
inconsistent to me.
2011-12-07 16:26:23 +00:00
cegger
199b241e44 remove xen3-public 2011-12-07 16:10:59 +00:00
cegger
67a05e425f switch from xen3-public to xen-public. 2011-12-07 16:01:39 +00:00
cegger
908dafc263 switch from xen3-public to xen-public. 2011-12-07 15:47:41 +00:00
cegger
ef058ada1e merge. (forgot in previous) 2011-12-07 15:40:15 +00:00
cegger
4d7ec3b06b merge. 2011-12-07 15:04:18 +00:00
cegger
230bc32186 Welcome to Xen 4.1.2 headers.
New interfaces for PV drivers:
- Xen transcedent memory
- USB IO
- SCSI IO

PCI IO improvements:
- PCI MSI support
- PCI Express AER support

New features:
- xen honors flags to be placed into guest kernel available pte bits
  if enabled (for grant table)
- support for 128 vcpus
  (old interface is still present and supports up to 32 vcpus)
- PCI passthrough: new hypercalls to support SR-IOV
- new hypercall for physical cpu hotplugging
- new hypercall for physical page offlining
- fixes to compile with clang
- machine check recovery mechanism
2011-12-07 14:41:15 +00:00
cegger
bae54e0656 build fix: add back <sys/malloc.h>. malloc(9) is still in use. 2011-12-07 13:49:04 +00:00
cegger
e3626448aa merge. The 'conflicts' happened because xen-public was once used for xen2 headers. 2011-12-07 13:24:04 +00:00
cegger
25dd519694 re-import xen3-public to rename this to xen-public 2011-12-07 13:15:44 +00:00
cherry
6b3b571c64 Move to kmem_zalloc() instead of malloc(). 2011-12-07 12:31:51 +00:00
cherry
848746d6bc [merging from cherry-xenmp]
Make MP aware: use mutex(9) instead of spl(9)
2011-12-04 15:15:41 +00:00
bouyer
ad7affb170 hypervisor_unmask_event(): don't check/update evtchn_pending_sel for the
current CPU, but for any CPU which may accept this event.
xen/xenevt.c: more use of atomic ops and locks where appropriate, and some
  other SMP fixes. Handle all events on the primary CPU (may be revisited
  later). Set/clear ci_evtmask[] for watched events.

This should fix the problems on dom0 kernels reported by jym@
2011-12-03 22:41:40 +00:00
bouyer
4d61ee8d61 xbdback_disconnect() can be called twice, from XenbusStateClosing then from
xbdback_xenbus_destroy(). The second call will wait forever as the first
already caused the xbd thread to exit.
Have xbdback_disconnect() check if we're already disconnected and if so,
do nothing.
2011-12-03 22:36:28 +00:00
joerg
f5c3f346ee Don't use variables as format string. 2011-11-24 18:34:56 +00:00
jym
54f95b1441 Deep rework of the xbdback(4) driver; it now uses a thread per instance
instead of continuations directly from shm callbacks or interrupt
handlers. The whole CPS design remains but is adapted to cope with
a thread model.

This patch allows scheduling away I/O requests of domains that behave
abnormally, or even destroy them if there is a need to (without thrashing
dom0 with lots of error messages at IPL_BIO).

I took this opportunity to make the driver MPSAFE, so multiple instances
can run concurrently. Moved from home-grown pool(9) queues to
pool_cache(9), and rework the callback mechanism so that it delegates
I/O processing to thread instead of handling it itself through the
continuation trampoline.

This one fixes the potential DoS many have seen in a dom0 when trying to
suspend a NetBSD domU with a corrupted I/O ring.

Benchmarks (build.sh release runs and bonnie++) do not show any
performance regression, the "new" driver is on-par with the "old" one.

ok bouyer@.
2011-11-24 01:47:18 +00:00
jym
1eaed4e6e6 Move Xen-specific functions to Xen pmap. Requested by cherry@.
Un'ifdef XEN in xen_pmap.c, it is always defined there.
2011-11-23 00:56:56 +00:00
jym
6bfeabc65a Expose pmap_pdp_cache publicly to x86/xen pmap. Provide suspend/resume
callbacks for Xen pmap.

Turn static internal callbacks of pmap_pdp_cache.

XXX the implementation of pool_cache_invalidate(9) is still wrong, and
IMHO this needs fixing before -6. See
http://mail-index.netbsd.org/tech-kern/2011/11/18/msg011924.html
2011-11-20 19:41:27 +00:00
tls
3afd44cf08 First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>.  This change includes
the following:

	An initial cleanup and minor reorganization of the entropy pool
	code in sys/dev/rnd.c and sys/dev/rndpool.c.  Several bugs are
	fixed.  Some effort is made to accumulate entropy more quickly at
	boot time.

	A generic interface, "rndsink", is added, for stream generators to
	request that they be re-keyed with good quality entropy from the pool
	as soon as it is available.

	The arc4random()/arc4randbytes() implementation in libkern is
	adjusted to use the rndsink interface for rekeying, which helps
	address the problem of low-quality keys at boot time.

	An implementation of the FIPS 140-2 statistical tests for random
	number generator quality is provided (libkern/rngtest.c).  This
	is based on Greg Rose's implementation from Qualcomm.

	A new random stream generator, nist_ctr_drbg, is provided.  It is
	based on an implementation of the NIST SP800-90 CTR_DRBG by
	Henric Jungheim.  This generator users AES in a modified counter
	mode to generate a backtracking-resistant random stream.

	An abstraction layer, "cprng", is provided for in-kernel consumers
	of randomness.  The arc4random/arc4randbytes API is deprecated for
	in-kernel use.  It is replaced by "cprng_strong".  The current
	cprng_fast implementation wraps the existing arc4random
	implementation.  The current cprng_strong implementation wraps the
	new CTR_DRBG implementation.  Both interfaces are rekeyed from
	the entropy pool automatically at intervals justifiable from best
	current cryptographic practice.

	In some quick tests, cprng_fast() is about the same speed as
	the old arc4randbytes(), and cprng_strong() is about 20% faster
	than rnd_extract_data().  Performance is expected to improve.

	The AES code in src/crypto/rijndael is no longer an optional
	kernel component, as it is required by cprng_strong, which is
	not an optional kernel component.

	The entropy pool output is subjected to the rngtest tests at
	startup time; if it fails, the system will reboot.  There is
	approximately a 3/10000 chance of a false positive from these
	tests.  Entropy pool _input_ from hardware random numbers is
	subjected to the rngtest tests at attach time, as well as the
	FIPS continuous-output test, to detect bad or stuck hardware
	RNGs; if any are detected, they are detached, but the system
	continues to run.

	A problem with rndctl(8) is fixed -- datastructures with
	pointers in arrays are no longer passed to userspace (this
	was not a security problem, but rather a major issue for
	compat32).  A new kernel will require a new rndctl.

	The sysctl kern.arandom() and kern.urandom() nodes are hooked
	up to the new generators, but the /dev/*random pseudodevices
	are not, yet.

	Manual pages for the new kernel interfaces are forthcoming.
2011-11-19 22:51:18 +00:00
cherry
de4e5fae37 [merging from cherry-xenmp] bring in bouyer@'s changes via:
http://mail-index.netbsd.org/source-changes/2011/10/22/msg028271.html
From the Log:
Log Message:
Various interrupt fixes, mainly:
keep a per-cpu mask of enabled events, and use it to get pending events.
A cpu-specific event (all of them at this time) should not be ever masked
by another CPU, because it may prevent the target CPU from seeing it
(the clock events all fires at once for example).
2011-11-19 17:13:39 +00:00
jmcneill
37ffe0c4a8 remove Xbox support 2011-11-18 22:18:07 +00:00
cherry
92f0f13b6c [merging from cherry-xenmp]
- Make clock MP aware.
 - Bring in fixes that bouyer@ brought in via:
   cvs rdiff -u -r1.54.6.4 -r1.54.6.5 src/sys/arch/xen/xen/clock.c

Thanks to riz@ for testing on dom0
2011-11-18 06:01:50 +00:00
christos
ac2d876c25 Use getdiskinfo() to print the name of the device; the previous code
constructed the wrong name if it was a wedge.
2011-11-14 21:34:50 +00:00