Commit Graph

203 Commits

Author SHA1 Message Date
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
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
cegger
908dafc263 switch from xen3-public to xen-public. 2011-12-07 15:47: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
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
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
cherry
3520926365 Expose the PG_k #define pt/pd bit to both xen and "baremetal" x86. This is required, since kernel pages are mapped with user permissions in XEN/amd64 since the VM kernel runs in ring3. Since XEN/i386(including PAE) runs in ring1, supervisor mode is appropriate for these ports. We need to share this since the pmap implementation is still shared. Once the xen implementation is sufficiently independant of the x86 one, this can be made private to xen/include/xenpmap.h 2011-11-08 17:16:52 +00:00
cherry
926a93384f Add an ipi callback to force hypervisor callback. this is useful to "re-route" interrupts to a given vcpu 2011-11-07 15:51:31 +00:00
cherry
c9745c1f66 [merging from cherry-xenmp] make pmap_kernel() shadow PMD per-cpu and MP aware. 2011-11-06 15:18:18 +00:00
cherry
396b8b4abf [merging from cherry-xenmp] Make the xen MMU op queue locking api private. Implement per-cpu queues. 2011-11-06 11:40:46 +00:00
jruoho
e23dd3f620 Remove code that is commented out and out-of-sync with x86. If Xen needs to
use cpu_resume(), cpu_suspend(), or cpu_shutdown() in the future, it is
better to expose these from x86 rather than duplicate code.
2011-10-20 13:21:11 +00:00
jym
2c4b0fd95e Move Xen specific functions out of x86 native pmap to xen_pmap.c.
Provide a wrapper to trigger pmap pool_cache(9) invalidations without
exposing the caches to outside world.
2011-10-18 23:43:06 +00:00
mrg
8f93e1bd21 remove a check against uvmexp.ncolors that is done inside uvm_page_recolor()
already anyway.
2011-10-06 06:56:29 +00:00
jruoho
7feffa2641 Call cpufreq_suspend(9) and cpufreq_resume(9) during suspend/resume. 2011-09-28 15:38:21 +00:00
jym
325494fe33 Modify *ASSERTMSG() so they are now used as variadic macros. The main goal
is to provide routines that do as KASSERT(9) says: append a message
to the panic format string when the assertion triggers, with optional
arguments.

Fix call sites to reflect the new definition.

Discussed on tech-kern@. See
http://mail-index.netbsd.org/tech-kern/2011/09/07/msg011427.html
2011-09-27 01:02:33 +00:00
jym
eba16022d3 Merge jym-xensuspend branch in -current. ok bouyer@.
Goal: save/restore support in NetBSD domUs, for i386, i386 PAE and amd64.

Executive summary:
- split all Xen drivers (xenbus(4), grant tables, xbd(4), xennet(4))
in two parts: suspend and resume, and hook them to pmf(9).
- modify pmap so that Xen hypervisor does not cry out loud in case
it finds "unexpected" recursive memory mappings
- provide a sysctl(7), machdep.xen.suspend, to command suspend from
userland via powerd(8). Note: a suspend can only be handled correctly
when dom0 requested it, so provide a mechanism that will prevent
kernel to blindly validate user's commands

The code is still in experimental state, use at your own risk: restore
can corrupt backend communications rings; this can completely thrash
dom0 as it will loop at a high interrupt level trying to honor
all domU requests.

XXX PAE suspend does not work in amd64 currently, due to (yet again!)
page validation issues with hypervisor. Will fix.

XXX secondary CPUs are not suspended, I will write the handlers
in sync with cherry's Xen MP work.

Tested under i386 and amd64, bear in mind ring corruption though.

No build break expected, GENERICs and XEN* kernels should be fine.
./build.sh distribution still running. In any case: sorry if it does
break for you, contact me directly for reports.
2011-09-20 00:12:23 +00:00
dyoung
78b0e18345 Report vmem(9) errors out-of-band so that we can use vmem(9) to manage
ranges that include the least and the greatest vmem_addr_t.  Update
vmem(9) uses throughout the kernel.  Slightly expand on the tests in
subr_vmem.c, which still pass.  I've been running a kernel with this
patch without any trouble.
2011-09-02 22:25:08 +00:00
jym
e298d4d6a8 Merge err printf with the panic(9) message.
Also fix the if () {...} statement with braces, to avoid calling panic()
every time. Hi cherry!
2011-08-21 10:00:13 +00:00
dholland
595e2ecd73 Fix broken build. 2011-08-16 02:59:16 +00:00
cherry
ce14cd73f0 invert buggy ci_flag test 2011-08-15 20:17:12 +00:00
cherry
c04a001592 Do not panic() on xen_send_ipi() sent to a cpu not yet running.
x86 MP boot depends on this strange behaviour.
2011-08-15 20:14:52 +00:00
cherry
a6365cd724 Call the right function
(fix for an egregious error)
2011-08-13 20:24:19 +00:00
cherry
e37867bdb5 Remove spurious header.
Thanks rmind@
2011-08-13 16:22:15 +00:00
cherry
7bd1f7e3fe MP probing and startup code 2011-08-13 12:37:30 +00:00
cherry
92ccc4ea78 Add locking around ops to the hypervisor MMU "queue". 2011-08-13 12:09:38 +00:00
cherry
787e5fb097 remove unnecessary locking overhead for UP 2011-08-13 11:41:57 +00:00
cherry
3c3a6a3a8e Hide the MD details of specific IPIs behind semantically pleasing functions. This cleans up a couple of #ifdef XEN/#endif pairs 2011-08-11 18:11:17 +00:00
cherry
3ccb0add41 Make event/interrupt handling MP aware 2011-08-11 17:58:59 +00:00
cherry
155048478e refactor the bitstring/mask operations to be behind an API. Make pending interrupt marking cpu aware. 2011-08-10 21:46:02 +00:00
cherry
941e03e900 KNF police (rmind@ :-) 2011-08-10 20:38:45 +00:00
cherry
d7b11fa417 xen ipi infrastructure 2011-08-10 11:39:44 +00:00
cherry
1f0a8a809d Introduce locking primitives for Xen pte operations, and xen helper calls for MP related MMU ops 2011-08-10 09:50:37 +00:00
jym
5b7c93647d Fix typo in comment. 2011-07-31 18:00:54 +00:00
rmind
3127d2afb9 Initialise cpus_running to 1 on Xen, as it was done on x86.
Problem analysed by hannken@.  Fixes PR/45062.
2011-07-16 14:46:18 +00:00
dyoung
e265f67bc1 #include <sys/bus.h> instead of <machine/bus.h>. 2011-07-01 18:31:32 +00:00
rmind
06b5aba5f8 Few XEN fixes:
- cpu_load_pmap: perform tlbflush() after xen_set_user_pgd().
- xen_pmap_bootstrap: perform xpq_queue_tlb_flush() in the end.
- pmap_tlb_shootdown: do not check PG_G for Xen.
2011-06-15 20:50:02 +00:00
rmind
57f2d9bddc - cpu_hatch: call tlbflushg(), just to make sure that TLB is clean.
- xen_bootstrap_tables: call xpq_queue_tlb_flush() for safety.
- Initialise cpus_attached and ci_cpumask for primary CPU.
2011-06-15 19:54:16 +00:00
rmind
e225b7bd09 Welcome to 5.99.53! Merge rmind-uvmplock branch:
- Reorganize locking in UVM and provide extra serialisation for pmap(9).
  New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
  the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
  Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
  kernel-lock on some ports).  Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
2011-06-12 03:35:36 +00:00
jym
e1b3bebc56 Print the PGD address in the debug message. 2011-05-08 00:18:25 +00:00
jym
fc848a1000 Fix a year old bug that was only fixed in jym-xensuspend branch, but
not in HEAD:
- use uvm_km_alloc() instead of kmem_alloc() to enforce alignement when
allocating p2m_frame pages (xentools can only deal with page-aligned
addresses)
- do not use paddr_t for p2m_frame_list_list with PAE, xentools expect
32 bits PFNs even with 64 bits PTE.

Required to make ``xm dump-core'' work as expected.
2011-03-30 21:53:58 +00:00
jym
26f424e994 Typo fix. 2011-03-29 23:51:32 +00:00
jruoho
4939599599 Use config_defer(9) for cpu_rescan() in cpu_attach().
Also mark few local functions as static.
2011-02-26 14:43:18 +00:00
jruoho
39c7a68be3 Catch up with x86 on cpufeaturebus. 2011-02-24 19:00:58 +00:00
jruoho
ad932f2c35 Move PowerNow! to the cpufeaturebus. 2011-02-24 10:56:00 +00:00