The NetBSD Project

CVS log for src/sys/arch/xen/x86/xen_pmap.c

[BACK] Up to [cvs.NetBSD.org] / src / sys / arch / xen / x86

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: MAIN


Revision 1.22 / (download) - annotate - [select for diffs], Sun Jun 24 18:31:53 2012 UTC (10 months, 4 weeks ago) by jym
Branch: MAIN
CVS Tags: yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, tls-maxphys-nbase, tls-maxphys-base, tls-maxphys, khorben-n900, agc-symver-base, agc-symver, HEAD
Changes since 1.21: +2 -8 lines
Diff to previous 1.21 (colored)

Enable the map/unmap recursive mapping functions for all Xen ports for
save/restore.

For an unknown reason (to me) Xen refuses to update VM translations
when the entry is pointing back to itself (which is precisely
what our recursive VM model does). So enable the functions that take
care of this, which will avoid all sort of memory corruption upon restore
leading domU to trample upon itself.

Save/restore works again for amd64. The occasional domU frontend corruption is
still present, but is harmless to dom0. Now we have a working shell and
ddb inside domU, that helps debugging a tiny bit.

XXX pull-up to -6.

Revision 1.21 / (download) - annotate - [select for diffs], Fri Apr 20 22:23:25 2012 UTC (13 months ago) by rmind
Branch: MAIN
CVS Tags: yamt-pagecache-base5, jmcneill-usbmp-base9, jmcneill-usbmp-base10
Changes since 1.20: +6 -6 lines
Diff to previous 1.20 (colored)

- Convert x86 MD code, mainly pmap(9) e.g. TLB shootdown code, to use
  kcpuset(9) and thus replace hardcoded CPU bitmasks.  This removes the
  limitation of maximum CPUs.

- Support up to 256 CPUs on amd64 architecture by default.

Bug fixes, improvements, completion of Xen part and testing on 64-core
AMD Opteron(tm) Processor 6282 SE (also, as Xen HVM domU with 128 CPUs)
by Manuel Bouyer.

Revision 1.20 / (download) - annotate - [select for diffs], Sun Mar 11 17:14:30 2012 UTC (14 months, 1 week ago) by jym
Branch: MAIN
CVS Tags: yamt-pagecache-base4, jmcneill-usbmp-base8
Changes since 1.19: +14 -17 lines
Diff to previous 1.19 (colored)

Split the map/unmap code from the sync/flush code: move xpq_flush_queue()
calls after pmap_{,un}map_recursive_entries() so that pmap's handlers
handle the flush themselves.

Now pmap_{,un}map_recursive_entries() do what their names imply, nothing more.

Fix pmap_xen_suspend()'s comment: APDPs are now gone.

pmap's handlers are called deep during kernel save/restore. We already
are at IPL_VM + kpreemption disabled. No need to wrap the xpq_flush_queue()
with splvm/splx.

Revision 1.19 / (download) - annotate - [select for diffs], Fri Mar 2 16:38:14 2012 UTC (14 months, 3 weeks ago) by bouyer
Branch: MAIN
CVS Tags: jmcneill-usbmp-base7, jmcneill-usbmp-base6, jmcneill-usbmp-base4
Changes since 1.18: +5 -2 lines
Diff to previous 1.18 (colored)

Add some more KASSERT()

Revision 1.18 / (download) - annotate - [select for diffs], Fri Feb 24 08:06:08 2012 UTC (14 months, 4 weeks ago) by cherry
Branch: MAIN
CVS Tags: jmcneill-usbmp-base5
Changes since 1.17: +2 -3 lines
Diff to previous 1.17 (colored)

(xen) - remove the (*xpq_cpu)() shim.We hasten the %fs/%gs setup process during boot.Although this is hacky, it lets us use the non-xen specificpmap_pte_xxx() functions in pmap code (and others).

Revision 1.17 / (download) - annotate - [select for diffs], Fri Feb 17 18:40:20 2012 UTC (15 months ago) by bouyer
Branch: MAIN
CVS Tags: jmcneill-usbmp-base3, jmcneill-usbmp-base2
Changes since 1.16: +19 -84 lines
Diff to previous 1.16 (colored)

Apply patch proposed in PR port-xen/45975 (this does not solve the exact
problem reported here but is part of the solution):
xen_kpm_sync() is not working as expected,
leading to races between CPUs.
1 the check (xpq_cpu != &x86_curcpu) is always false because we
  have different x86_curcpu symbols with different addresses in the kernel.
  Fortunably, all addresses dissaemble to the same code.
  Because of this we always use the code intended for bootstrap, which doesn't
  use cross-calls or lock.

2 once 1 above is fixed, xen_kpm_sync() will use xcalls to sync other CPUs,
  which cause it to sleep and pmap.c doesn't like that. It triggers this
  KASSERT() in pmap_unmap_ptes():
  KASSERT(pmap->pm_ncsw == curlwp->l_ncsw);
3 pmap->pm_cpus is not safe for the purpose of xen_kpm_sync(), which
  needs to know on which CPU a pmap is loaded *now*:
  pmap->pm_cpus is cleared before cpu_load_pmap() is called to switch
  to a new pmap, leaving a window where a pmap is still in a CPU's
  ci_kpm_pdir but not in pm_cpus. As a virtual CPU may be preempted
  by the hypervisor at any time, it can be large enough to let another
  CPU free the PTP and reuse it as a normal page.

To fix 2), avoid cross-calls and IPIs completely, and instead
use a mutex to update all CPU's ci_kpm_pdir from the local CPU.
It's safe because we just need to update the table page, a tlbflush IPI will
happen later. As a side effect, we don't need a different code for bootstrap,
fixing 1). The mutex added to struct cpu needs a small headers reorganisation.

to fix 3), introduce a pm_xen_ptp_cpus which is updated from
cpu_pmap_load(), whith the ci_kpm_mtx mutex held. Checking it with
ci_kpm_mtx held will avoid overwriting the wrong pmap's ci_kpm_pdir.

While there I removed the unused pmap_is_active() function;
and added some more details to DIAGNOSTIC panics.

Revision 1.16 / (download) - annotate - [select for diffs], Sat Jan 28 07:19:17 2012 UTC (15 months, 3 weeks ago) by cherry
Branch: MAIN
CVS Tags: netbsd-6-base
Branch point for: netbsd-6
Changes since 1.15: +2 -221 lines
Diff to previous 1.15 (colored)

stop using alternate pde mapping in xen pmap

Revision 1.15 / (download) - annotate - [select for diffs], Sun Jan 22 18:16:34 2012 UTC (16 months ago) by cherry
Branch: MAIN
Changes since 1.14: +23 -27 lines
Diff to previous 1.14 (colored)

Do not clobber pmap_kernel()'s pdir unnecessarily while syncing per-cpu pdirs

Revision 1.14 / (download) - annotate - [select for diffs], Thu Jan 19 22:04:05 2012 UTC (16 months ago) by bouyer
Branch: MAIN
Changes since 1.13: +4 -2 lines
Diff to previous 1.13 (colored)

add a missing splvm()/splx() to protect the xpq queue.

Revision 1.13 / (download) - annotate - [select for diffs], Mon Jan 9 12:58:49 2012 UTC (16 months, 2 weeks ago) by cherry
Branch: MAIN
Changes since 1.12: +7 -4 lines
Diff to previous 1.12 (colored)

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.

Revision 1.12 / (download) - annotate - [select for diffs], Fri Dec 30 16:55:21 2011 UTC (16 months, 3 weeks ago) by cherry
Branch: MAIN
Changes since 1.11: +122 -2 lines
Diff to previous 1.11 (colored)

per-cpu shadow directory pages should be updated locally via cross-calls. Do this.

Revision 1.11 / (download) - annotate - [select for diffs], Wed Dec 7 15:47:43 2011 UTC (17 months, 2 weeks ago) by cegger
Branch: MAIN
Changes since 1.10: +3 -3 lines
Diff to previous 1.10 (colored)

switch from xen3-public to xen-public.

Revision 1.10 / (download) - annotate - [select for diffs], Wed Nov 23 00:56:56 2011 UTC (18 months ago) by jym
Branch: MAIN
CVS Tags: jmcneill-usbmp-pre-base2, jmcneill-usbmp-base
Branch point for: jmcneill-usbmp
Changes since 1.9: +3 -4 lines
Diff to previous 1.9 (colored)

Move Xen-specific functions to Xen pmap. Requested by cherry@.

Un'ifdef XEN in xen_pmap.c, it is always defined there.

Revision 1.9 / (download) - annotate - [select for diffs], Sun Nov 20 19:41:27 2011 UTC (18 months ago) by jym
Branch: MAIN
Changes since 1.8: +22 -12 lines
Diff to previous 1.8 (colored)

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

Revision 1.8 / (download) - annotate - [select for diffs], Tue Nov 8 17:16:52 2011 UTC (18 months, 2 weeks ago) by cherry
Branch: MAIN
CVS Tags: yamt-pagecache-base3, jmcneill-audiomp3-base, jmcneill-audiomp3
Changes since 1.7: +2 -9 lines
Diff to previous 1.7 (colored)

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

Revision 1.7 / (download) - annotate - [select for diffs], Sun Nov 6 11:40:47 2011 UTC (18 months, 2 weeks ago) by cherry
Branch: MAIN
CVS Tags: yamt-pagecache-base2
Changes since 1.6: +2 -4 lines
Diff to previous 1.6 (colored)

[merging from cherry-xenmp] Make the xen MMU op queue locking api private. Implement per-cpu queues.

Revision 1.6 / (download) - annotate - [select for diffs], Tue Oct 18 23:43:06 2011 UTC (19 months ago) by jym
Branch: MAIN
CVS Tags: yamt-pagecache-base
Branch point for: yamt-pagecache
Changes since 1.5: +112 -2 lines
Diff to previous 1.5 (colored)

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.

Revision 1.5 / (download) - annotate - [select for diffs], Tue Sep 20 00:12:24 2011 UTC (20 months ago) by jym
Branch: MAIN
Changes since 1.4: +15 -7 lines
Diff to previous 1.4 (colored)

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.

Revision 1.4 / (download) - annotate - [select for diffs], Sat Aug 13 12:09:38 2011 UTC (21 months, 1 week ago) by cherry
Branch: MAIN
CVS Tags: jym-xensuspend-nbase, jym-xensuspend-base
Changes since 1.3: +4 -2 lines
Diff to previous 1.3 (colored)

Add locking around ops to the hypervisor MMU "queue".

Revision 1.3 / (download) - annotate - [select for diffs], Sun Jun 12 03:35:50 2011 UTC (23 months, 1 week ago) by rmind
Branch: MAIN
Changes since 1.2: +195 -3 lines
Diff to previous 1.2 (colored)

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.

Revision 1.2 / (download) - annotate - [select for diffs], Tue Feb 1 21:18:56 2011 UTC (2 years, 3 months ago) by chuck
Branch: MAIN
CVS Tags: uebayasi-xip-base7, rmind-uvmplock-nbase, rmind-uvmplock-base, cherry-xenmp-base, bouyer-quota2-nbase, bouyer-quota2-base
Branch point for: cherry-xenmp
Changes since 1.1: +3 -8 lines
Diff to previous 1.1 (colored)

udpate license clauses on my code to match the new-style BSD licenses.
based on diff that rmind@ sent me.

no functional change with this commit.

Revision 1.1 / (download) - annotate - [select for diffs], Mon May 10 18:46:59 2010 UTC (3 years ago) by dyoung
Branch: MAIN
CVS Tags: yamt-nfs-mp-base11, yamt-nfs-mp-base10, uebayasi-xip-base6, uebayasi-xip-base5, uebayasi-xip-base4, uebayasi-xip-base3, uebayasi-xip-base2, matt-mips64-premerge-20101231, jruoho-x86intr-base
Branch point for: yamt-nfs-mp, uebayasi-xip, rmind-uvmplock, jym-xensuspend, jruoho-x86intr, bouyer-quota2

Provide pmap_enter_ma(), pmap_extract_ma(), pmap_kenter_ma() in all x86
kernels, and use them in the bus_space(9) implementation instead of ugly
Xen #ifdef-age.  In a non-Xen kernel, the _ma() functions either call or
alias the equivalent _pa() functions.

Reviewed on port-xen@netbsd.org and port-i386@netbsd.org.  Passes
rmind@'s and bouyer@'s inspection.  Tested on i386 and on Xen DOMU /
DOM0.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>