The NetBSD Project

CVS log for src/sys/arch/xen/x86/cpu.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.93 / (download) - annotate - [select for diffs], Sun Jun 24 13:56:10 2012 UTC (10 months, 3 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.92: +4 -4 lines
Diff to previous 1.92 (colored)

Update comment: we stopped using xcall to sync PTP between CPUs.
pmap_kpm_sync_xcall => xen_kpm_sync

Revision 1.92 / (download) - annotate - [select for diffs], Wed Jun 6 22:22:41 2012 UTC (11 months, 2 weeks ago) by rmind
Branch: MAIN
Changes since 1.91: +7 -6 lines
Diff to previous 1.91 (colored)

Few fixes for Xen:
- cpu_load_pmap: use atomic kcpuset(9) operations; fixes rare crashes.
- Add kcpuset_copybits(9) and replace xen_kcpuset2bits().  Avoids incorrect
  ncpu problem in early boot.  Also, micro-optimises xen_mcast_invlpg() and
  xen_mcast_tlbflush() routines.

Tested by chs@.

Revision 1.91 / (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.90: +10 -20 lines
Diff to previous 1.90 (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.90 / (download) - annotate - [select for diffs], Sun Mar 11 16:16:44 2012 UTC (14 months, 1 week ago) by jym
Branch: MAIN
CVS Tags: yamt-pagecache-base4, jmcneill-usbmp-base8
Changes since 1.89: +3 -3 lines
Diff to previous 1.89 (colored)

Typo fix.

Revision 1.89 / (download) - annotate - [select for diffs], Sat Feb 25 18:57:50 2012 UTC (14 months, 3 weeks ago) by bouyer
Branch: MAIN
CVS Tags: jmcneill-usbmp-base7, jmcneill-usbmp-base6, jmcneill-usbmp-base5, jmcneill-usbmp-base4
Changes since 1.88: +4 -2 lines
Diff to previous 1.88 (colored)

The code assumes that ci_index is also the Xen's cpunum, and that
cpunum is less than XEN_LEGACY_MAX_VCPUS. KASSERT both.

Revision 1.88 / (download) - annotate - [select for diffs], Fri Feb 24 11:43:06 2012 UTC (14 months, 3 weeks ago) by bouyer
Branch: MAIN
Changes since 1.87: +2 -3 lines
Diff to previous 1.87 (colored)

Don't maintain ci_cpumask for physical CPUs, it's not used.

Revision 1.87 / (download) - annotate - [select for diffs], Fri Feb 24 11:31:23 2012 UTC (14 months, 3 weeks ago) by bouyer
Branch: MAIN
Changes since 1.86: +2 -12 lines
Diff to previous 1.86 (colored)

Get rid of phycpus_attached bitmask; it's maintained but not used and
will limit the number of physical CPUs to 32 without good reasons.

Revision 1.86 / (download) - annotate - [select for diffs], Fri Feb 24 08:06:07 2012 UTC (14 months, 3 weeks ago) by cherry
Branch: MAIN
Changes since 1.85: +2 -11 lines
Diff to previous 1.85 (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.85 / (download) - annotate - [select for diffs], Thu Feb 23 07:30:30 2012 UTC (14 months, 4 weeks ago) by cherry
Branch: MAIN
CVS Tags: jmcneill-usbmp-base3
Changes since 1.84: +8 -49 lines
Diff to previous 1.84 (colored)

Cleanup.

 - Remove cruft from native x86 origin.
 - Remove access to privileged MSRs.
 - Cleanup stale comments.

Revision 1.84 / (download) - annotate - [select for diffs], Thu Feb 23 04:10:51 2012 UTC (14 months, 4 weeks ago) by cherry
Branch: MAIN
Changes since 1.83: +6 -10 lines
Diff to previous 1.83 (colored)

cpu_load_pmap() should not be used to load pmap_kernel(), since in the
x86 model, its mappings are shared across pmaps. KASSERT() for this
and remove unused codepaths.

Revision 1.83 / (download) - annotate - [select for diffs], Wed Feb 22 18:29:31 2012 UTC (14 months, 4 weeks ago) by bouyer
Branch: MAIN
Changes since 1.82: +8 -7 lines
Diff to previous 1.82 (colored)

use pmap_protect() instead of pmap_kenter_pa() to remap R/O an exiting
page. This gets rid of the last "mapping already present" warnings.

Revision 1.82 / (download) - annotate - [select for diffs], Tue Feb 21 19:10:13 2012 UTC (14 months, 4 weeks ago) by bouyer
Branch: MAIN
Changes since 1.81: +2 -3 lines
Diff to previous 1.81 (colored)

Avoid early use of xen_kpm_sync(); locks are not available at this time.
Don't call cpu_init() twice.

Makes LOCKDEBUG kernels boot again

Revision 1.81 / (download) - annotate - [select for diffs], Fri Feb 17 18:40:20 2012 UTC (15 months ago) by bouyer
Branch: MAIN
CVS Tags: jmcneill-usbmp-base2
Changes since 1.80: +58 -41 lines
Diff to previous 1.80 (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.80 / (download) - annotate - [select for diffs], Mon Feb 13 23:54:58 2012 UTC (15 months ago) by jym
Branch: MAIN
CVS Tags: netbsd-6-base
Branch point for: netbsd-6
Changes since 1.79: +2 -3 lines
Diff to previous 1.79 (colored)

PAT flags are not under control of Xen domains currently, so there is no
point in enabling them.

Avoids:
- a warning logged by hypervisor when a domain attempts to modify the PAT
MSR.
- an error during domain resuming, where a PAT flag has been set on a page
while the hypervisor does not allow it.

ok releng@.

Revision 1.79 / (download) - annotate - [select for diffs], Sat Jan 28 12:15:19 2012 UTC (15 months, 3 weeks ago) by cherry
Branch: MAIN
Changes since 1.78: +3 -10 lines
Diff to previous 1.78 (colored)

Update comments to remove references to alternate pte space.

Revision 1.78 / (download) - annotate - [select for diffs], Sat Jan 28 07:19:17 2012 UTC (15 months, 3 weeks ago) by cherry
Branch: MAIN
Changes since 1.77: +13 -4 lines
Diff to previous 1.77 (colored)

stop using alternate pde mapping in xen pmap

Revision 1.77 / (download) - annotate - [select for diffs], Mon Jan 9 04:39:14 2012 UTC (16 months, 1 week ago) by cherry
Branch: MAIN
Changes since 1.76: +2 -10 lines
Diff to previous 1.76 (colored)

revert previous commit. DIAGNOSTIC should only do strict checks, not muffle current ones

Revision 1.76 / (download) - annotate - [select for diffs], Fri Jan 6 15:15:28 2012 UTC (16 months, 2 weeks ago) by cherry
Branch: MAIN
Changes since 1.75: +10 -2 lines
Diff to previous 1.75 (colored)

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

Revision 1.75 / (download) - annotate - [select for diffs], Wed Jan 4 10:30:23 2012 UTC (16 months, 2 weeks ago) by cherry
Branch: MAIN
Changes since 1.74: +3 -3 lines
Diff to previous 1.74 (colored)

Use macro PDP_SIZE instead of numeric constant, for unshared PAE L3 entries.
Thanks jym@

Revision 1.74 / (download) - annotate - [select for diffs], Fri Dec 30 19:18:35 2011 UTC (16 months, 3 weeks ago) by cherry
Branch: MAIN
Changes since 1.73: +3 -3 lines
Diff to previous 1.73 (colored)

Never cut-paste code from email!
Use the right count (0 -> 2) of l3 unshared userland entries for per-cpu initialisation.

Revision 1.73 / (download) - annotate - [select for diffs], Fri Dec 30 18:01:20 2011 UTC (16 months, 3 weeks ago) by cherry
Branch: MAIN
Changes since 1.72: +8 -16 lines
Diff to previous 1.72 (colored)

Force pae l3 page allocation for new vcpus to be < 4G, so they fit in 32bits

Revision 1.72 / (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.71: +3 -2 lines
Diff to previous 1.71 (colored)

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

Revision 1.71 / (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.70: +3 -3 lines
Diff to previous 1.70 (colored)

switch from xen3-public to xen-public.

Revision 1.70 / (download) - annotate - [select for diffs], Sun Nov 6 15:18:19 2011 UTC (18 months, 2 weeks ago) by cherry
Branch: MAIN
CVS Tags: yamt-pagecache-base3, yamt-pagecache-base2, jmcneill-usbmp-pre-base2, jmcneill-usbmp-base, jmcneill-audiomp3-base, jmcneill-audiomp3
Branch point for: jmcneill-usbmp
Changes since 1.69: +142 -29 lines
Diff to previous 1.69 (colored)

[merging from cherry-xenmp] make pmap_kernel() shadow PMD per-cpu and MP aware.

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

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

Revision 1.68 / (download) - annotate - [select for diffs], Thu Oct 20 13:21:11 2011 UTC (19 months ago) by jruoho
Branch: MAIN
CVS Tags: yamt-pagecache-base
Branch point for: yamt-pagecache
Changes since 1.67: +2 -73 lines
Diff to previous 1.67 (colored)

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.

Revision 1.67 / (download) - annotate - [select for diffs], Thu Oct 6 06:56:30 2011 UTC (19 months, 2 weeks ago) by mrg
Branch: MAIN
Changes since 1.66: +4 -6 lines
Diff to previous 1.66 (colored)

remove a check against uvmexp.ncolors that is done inside uvm_page_recolor()
already anyway.

Revision 1.66 / (download) - annotate - [select for diffs], Wed Sep 28 15:38:22 2011 UTC (19 months, 3 weeks ago) by jruoho
Branch: MAIN
Changes since 1.65: +24 -11 lines
Diff to previous 1.65 (colored)

Call cpufreq_suspend(9) and cpufreq_resume(9) during suspend/resume.

Revision 1.65 / (download) - annotate - [select for diffs], Tue Sep 20 00:12:24 2011 UTC (20 months ago) by jym
Branch: MAIN
Changes since 1.64: +5 -2 lines
Diff to previous 1.64 (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.64 / (download) - annotate - [select for diffs], Tue Aug 16 02:59:16 2011 UTC (21 months ago) by dholland
Branch: MAIN
CVS Tags: jym-xensuspend-nbase, jym-xensuspend-base
Changes since 1.63: +3 -3 lines
Diff to previous 1.63 (colored)

Fix broken build.

Revision 1.63 / (download) - annotate - [select for diffs], Mon Aug 15 20:14:52 2011 UTC (21 months ago) by cherry
Branch: MAIN
Changes since 1.62: +3 -6 lines
Diff to previous 1.62 (colored)

Do not panic() on xen_send_ipi() sent to a cpu not yet running.
x86 MP boot depends on this strange behaviour.

Revision 1.62 / (download) - annotate - [select for diffs], Sat Aug 13 12:37:30 2011 UTC (21 months, 1 week ago) by cherry
Branch: MAIN
Changes since 1.61: +356 -259 lines
Diff to previous 1.61 (colored)

MP probing and startup code

Revision 1.61 / (download) - annotate - [select for diffs], Thu Aug 11 18:11:17 2011 UTC (21 months, 1 week ago) by cherry
Branch: MAIN
Changes since 1.60: +25 -2 lines
Diff to previous 1.60 (colored)

Hide the MD details of specific IPIs behind semantically pleasing functions. This cleans up a couple of #ifdef XEN/#endif pairs

Revision 1.60 / (download) - annotate - [select for diffs], Sat Jul 16 14:46:18 2011 UTC (22 months ago) by rmind
Branch: MAIN
Changes since 1.59: +3 -3 lines
Diff to previous 1.59 (colored)

Initialise cpus_running to 1 on Xen, as it was done on x86.

Problem analysed by hannken@.  Fixes PR/45062.

Revision 1.59 / (download) - annotate - [select for diffs], Wed Jun 15 20:50:02 2011 UTC (23 months ago) by rmind
Branch: MAIN
Changes since 1.58: +3 -3 lines
Diff to previous 1.58 (colored)

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.

Revision 1.58 / (download) - annotate - [select for diffs], Wed Jun 15 19:54:16 2011 UTC (23 months ago) by rmind
Branch: MAIN
Changes since 1.57: +5 -3 lines
Diff to previous 1.57 (colored)

- 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.

Revision 1.57 / (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.56: +2 -5 lines
Diff to previous 1.56 (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.56 / (download) - annotate - [select for diffs], Sat Feb 26 14:43:18 2011 UTC (2 years, 2 months ago) by jruoho
Branch: MAIN
CVS Tags: rmind-uvmplock-nbase, rmind-uvmplock-base, cherry-xenmp-base, bouyer-quota2-nbase
Branch point for: cherry-xenmp
Changes since 1.55: +25 -18 lines
Diff to previous 1.55 (colored)

Use config_defer(9) for cpu_rescan() in cpu_attach().
Also mark few local functions as static.

Revision 1.55 / (download) - annotate - [select for diffs], Thu Feb 24 19:00:58 2011 UTC (2 years, 2 months ago) by jruoho
Branch: MAIN
Changes since 1.54: +3 -9 lines
Diff to previous 1.54 (colored)

Catch up with x86 on cpufeaturebus.

Revision 1.54 / (download) - annotate - [select for diffs], Thu Feb 24 10:56:03 2011 UTC (2 years, 2 months ago) by jruoho
Branch: MAIN
Changes since 1.53: +8 -2 lines
Diff to previous 1.53 (colored)

Move PowerNow! to the cpufeaturebus.

Revision 1.53 / (download) - annotate - [select for diffs], Thu Feb 24 04:42:55 2011 UTC (2 years, 2 months ago) by jruoho
Branch: MAIN
Changes since 1.52: +44 -9 lines
Diff to previous 1.52 (colored)

Add cpufeaturebus and est(4) for Xen.

Revision 1.52 / (download) - annotate - [select for diffs], Sun Nov 14 13:43:04 2010 UTC (2 years, 6 months ago) by bouyer
Branch: MAIN
CVS Tags: uebayasi-xip-base7, uebayasi-xip-base6, matt-mips64-premerge-20101231, jruoho-x86intr-base, bouyer-quota2-base
Branch point for: jruoho-x86intr, bouyer-quota2
Changes since 1.51: +20 -57 lines
Diff to previous 1.51 (colored)

Boot vs AP processors don't make sense for physical CPUs, these are
handled by the hypervisor and all CPUs are running when the dom0 is started.
In addition, we don't have a reliable way to determine the boot CPU as
- we may not be running on the boot CPU
- we don't have access to the lapic id
So simplify by ignoring the information and assign phycpu_info_primary to the
first attached CPU.

Revision 1.51 / (download) - annotate - [select for diffs], Sat Nov 6 11:46:04 2010 UTC (2 years, 6 months ago) by uebayasi
Branch: MAIN
CVS Tags: uebayasi-xip-base5
Changes since 1.50: +3 -3 lines
Diff to previous 1.50 (colored)

Machine dependent code is considered as part of UVM.  Include
internal API header.

Revision 1.50 / (download) - annotate - [select for diffs], Wed Nov 3 04:34:51 2010 UTC (2 years, 6 months ago) by jruoho
Branch: MAIN
CVS Tags: uebayasi-xip-base4
Changes since 1.49: +3 -2 lines
Diff to previous 1.49 (colored)

Fill cpu_info::ci_acpiid also on Xen.

Revision 1.49 / (download) - annotate - [select for diffs], Fri Aug 20 06:34:33 2010 UTC (2 years, 9 months ago) by jruoho
Branch: MAIN
CVS Tags: yamt-nfs-mp-base11, uebayasi-xip-base3
Changes since 1.48: +2 -5 lines
Diff to previous 1.48 (colored)

Revert all previous changes that were made naively believing that the
existing CPU power management implementations could peacefully coexist with
the acpicpu(4) driver. The following options can not be used with acpicpu(4):
ENHANCED_SPEEDSTEP, INTEL_ONDEMAND_CLOCKMOD, POWERNOW_K7, and POWERNOW_K8.

Revision 1.48 / (download) - annotate - [select for diffs], Mon Aug 9 15:46:18 2010 UTC (2 years, 9 months ago) by jruoho
Branch: MAIN
CVS Tags: yamt-nfs-mp-base10, uebayasi-xip-base2
Changes since 1.47: +5 -2 lines
Diff to previous 1.47 (colored)

Revert the previous changes to EST. The used hack had an obvious flaw:
the acpicpu(4) driver should attach even if the existing frequency management
code fails to attach, mainly because ACPI is the only proper way to deal
with EST on new Intel system.

Use a more drastic hack to deal with this: when acpicpu(4) attachs, it tears
down any existing sysctl(8) controls and installs identical ones in place.
Upon detachment, the initialization function of the existing EST is called.

Revision 1.47 / (download) - annotate - [select for diffs], Sat Jul 24 00:45:56 2010 UTC (2 years, 9 months ago) by jym
Branch: MAIN
Changes since 1.46: +63 -2 lines
Diff to previous 1.46 (colored)

Welcome PAE inside i386 current.

This patch is inspired by work previously done by Jeremy Morse, ported by me
to -current, merged with the work previously done for port-xen, together with
additionals fixes and improvements.

PAE option is disabled by default in GENERIC (but will be enabled in ALL in
the next few days).

In quick, PAE switches the CPU to a mode where physical addresses become
36 bits (64 GiB). Virtual address space remains at 32 bits (4 GiB). To cope
with the increased size of the physical address, they are manipulated as
64 bits variables by kernel and MMU.

When supported by the CPU, it also allows the use of the NX/XD bit that
provides no-execution right enforcement on a per physical page basis.

Notes:

- reworked locore.S

- introduce cpu_load_pmap(), used to switch pmap for the curcpu. Due to the
different handling of pmap mappings with PAE vs !PAE, Xen vs native, details
are hidden within this function. This helps calling it from assembly,
as some features, like BIOS calls, switch to pmap_kernel before mapping
trampoline code in low memory.

- some changes in bioscall and kvm86_call, to reflect the above.

- the L3 is "pinned" per-CPU, and is only manipulated by a
reduced set of functions within pmap. To track the L3, I added two
elements to struct cpu_info, namely ci_l3_pdirpa (PA of the L3), and
ci_l3_pdir (the L3 VA). Rest of the code considers that it runs "just
like" a normal i386, except that the L2 is 4 pages long (PTP_LEVELS is
still 2).

- similar to the ci_pae_l3_pdir{,pa} variables, amd64's xen_current_user_pgd
becomes an element of cpu_info (slowly paving the way for MP world).

- bootinfo_source struct declaration is modified, to cope with paddr_t size
change with PAE (it is not correct to assume that bs_addr is a paddr_t when
compiled with PAE - it should remain 32 bits). bs_addrs is now a
void * array (in bootloader's code under i386/stand/, the bs_addrs
is a physaddr_t, which is an unsigned long).

- fixes in multiboot code (same reason as bootinfo): paddr_t size
change. I used Elf32_* types, use RELOC() where necessary, and move the
memcpy() functions out of the if/else if (I do not expect sym and str tables
to overlap with ELF).

- 64 bits atomic functions for pmap

- all pmap_pdirpa access are now done through the pmap_pdirpa macro. It
hides the L3/L2 stuff from PAE, as well as the pm_pdirpa change in
struct pmap (it now becomes a PDP_SIZE array, with or without PAE).

- manipulation of recursive mappings ( PDIR_SLOT_{,A}PTEs ) is done via
loops on PDP_SIZE.

See also http://mail-index.netbsd.org/port-i386/2010/07/17/msg002062.html

No objection raised on port-i386@ and port-xen@R for about a week.

XXX kvm(3) will be fixed in another patch to properly handle both PAE and !PAE
kernel dumps (VA => PA macros are slightly different, and need proper 64 bits
PA support in kvm_i386).

XXX Mixing PAE and !PAE modules may lead to unwanted/unexpected results. This
cannot be solved easily, and needs lots of thinking before being declared
safe (paddr_t/bus_addr_t size handling, PD/PT macros abstractions).

Revision 1.46 / (download) - annotate - [select for diffs], Tue Jul 6 20:50:35 2010 UTC (2 years, 10 months ago) by cegger
Branch: MAIN
Changes since 1.45: +3 -2 lines
Diff to previous 1.45 (colored)

Turn PMAP_NOCACHE into MI flag.
Add MI flags PMAP_WRITE_COMBINE, PMAP_WRITE_BACK, PMAP_NOCACHE_OVR.
Update pmap(9) manpage.

hppa: Remove MD PMAP_NOCACHE flag as it exists as MI flag
mips: Rename MD PMAP_NOCACHE to PGC_NOCACHE.

x86: Implement new MI flags using Page-Attribute Tables.
x86: Implement BUS_SPACE_MAP_PREFETCHABLE.

Patch presented on tech-kern@:
http://mail-index.netbsd.org/tech-kern/2010/06/30/msg008458.html

No comments on this last version.

Revision 1.45 / (download) - annotate - [select for diffs], Mon Jun 28 00:47:53 2010 UTC (2 years, 10 months ago) by rmind
Branch: MAIN
Changes since 1.44: +6 -2 lines
Diff to previous 1.44 (colored)

mp_cpu_start: although fragment is commented out, add pmap_update(), just
in case somebody would come up with a clever idea to copy-paste that.

Revision 1.44 / (download) - annotate - [select for diffs], Tue May 4 23:27:14 2010 UTC (3 years ago) by jym
Branch: MAIN
Changes since 1.43: +5 -2 lines
Diff to previous 1.43 (colored)

Enable the NX bit feature for Xen i386pae and amd64 kernels.

Tested with Xen 3.1 and Xen 3.3, dom0 and domU, by bouyer@ and jym@.

Ok bouyer@.

Revision 1.43 / (download) - annotate - [select for diffs], Sun Apr 18 23:47:52 2010 UTC (3 years, 1 month ago) by jym
Branch: MAIN
CVS Tags: uebayasi-xip-base1
Changes since 1.42: +19 -17 lines
Diff to previous 1.42 (colored)

This patch fixes the NX regression issue observed on amd64 kernels, where
per-page execution right was disabled (therefore leading to the inability
of the kernel to detect fraudulent use of memory mappings marked as not
being executable).

- replace cpu_feature and ci_feature_flags variables by cpu_feature and
ci_feat_val arrays. This makes it cleaner and brings kernel code closer
to the design of cpuctl(8). A warning will be raised for each CPU that
does not expose the same features as the Boot Processor (BP).

- the blacklist of CPU features is now a macro defined in the
specialreg.h header, instead of hardcoding it inside MD initialization
code; fix comments.

- replace checks against CPUID_TSC with the cpu_hascounter() function.

- clean up the code in init_x86_64(), as cpu_feature variables are set
inside cpu_probe().

- use cpu_init_msrs() for i386. It will be eventually used later for NX
feature under i386 PAE kernels.

- remove code that checks for CPUID_NOX in amd64 mptramp.S, this is already
performed by cpu_hatch() through cpu_init_msrs().

- remove cpu_signature and feature_flags members from struct mpbios_proc
(they were never used).

This patch was tested with i386 MONOLITHIC, XEN3PAE_DOM0 and XEN3_DOM0 under
a native i386 host, and amd64 GENERIC, XEN3_DOM0 via QEMU virtual machines.

XXX Should kernel rev be bumped?

XXX A similar patch should be pulled-up for NetBSD-5, hopefully tomorrow.

Revision 1.42 / (download) - annotate - [select for diffs], Wed Mar 3 00:09:03 2010 UTC (3 years, 2 months ago) by jym
Branch: MAIN
CVS Tags: yamt-nfs-mp-base9
Branch point for: rmind-uvmplock
Changes since 1.41: +4 -6 lines
Diff to previous 1.41 (colored)

Use roundup2() instead of hardcoding the CACHE_LINE_SIZE rounding
operation.

Revision 1.41 / (download) - annotate - [select for diffs], Wed Feb 24 22:37:55 2010 UTC (3 years, 2 months ago) by dyoung
Branch: MAIN
Changes since 1.40: +4 -4 lines
Diff to previous 1.40 (colored)

A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.

Revision 1.40 / (download) - annotate - [select for diffs], Fri Jan 8 19:43:26 2010 UTC (3 years, 4 months ago) by dyoung
Branch: MAIN
CVS Tags: uebayasi-xip-base
Branch point for: uebayasi-xip
Changes since 1.39: +4 -4 lines
Diff to previous 1.39 (colored)

Expand PMF_FN_* macros.

Revision 1.39 / (download) - annotate - [select for diffs], Fri Nov 27 03:23:15 2009 UTC (3 years, 5 months ago) by rmind
Branch: MAIN
CVS Tags: matt-premerge-20091211
Changes since 1.38: +2 -3 lines
Diff to previous 1.38 (colored)

- Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places.  Reduce sys/user.h inclusions.

Revision 1.38 / (download) - annotate - [select for diffs], Tue Nov 24 13:04:04 2009 UTC (3 years, 5 months ago) by cegger
Branch: MAIN
Changes since 1.37: +95 -84 lines
Diff to previous 1.37 (colored)

Remove X86_MAXPROCS. This fixes PR port-xen/41755.
This also reduces diff to x86/x86/cpu.c as a nice side effect.
'looks good' bouyer@

Revision 1.37 / (download) - annotate - [select for diffs], Sat Nov 21 05:54:04 2009 UTC (3 years, 6 months ago) by rmind
Branch: MAIN
Changes since 1.36: +13 -8 lines
Diff to previous 1.36 (colored)

Catch-up Xen and usermode with lwp_getpcb() and unbreak Xen build.

Revision 1.36 / (download) - annotate - [select for diffs], Sat Nov 7 07:27:49 2009 UTC (3 years, 6 months ago) by cegger
Branch: MAIN
Changes since 1.35: +4 -4 lines
Diff to previous 1.35 (colored)

Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.

Revision 1.35 / (download) - annotate - [select for diffs], Tue Sep 22 13:59:42 2009 UTC (3 years, 7 months ago) by cegger
Branch: MAIN
Changes since 1.34: +2 -4 lines
Diff to previous 1.34 (colored)

fix botch with merging in changes from x86/x86/cpu.c:

don't use wbinvd(). Xen flushes the cache for us.
This makes DomU boot again.
Spotted by bouyer@.

Revision 1.34 / (download) - annotate - [select for diffs], Thu Jul 30 13:56:57 2009 UTC (3 years, 9 months ago) by cegger
Branch: MAIN
CVS Tags: yamt-nfs-mp-base8, yamt-nfs-mp-base7
Changes since 1.33: +21 -9 lines
Diff to previous 1.33 (colored)

from x86/x86/cpu.c:
- use atomic operations to set flags
- Align struct cpu_info to 64b.

Revision 1.33 / (download) - annotate - [select for diffs], Wed Jul 29 12:02:08 2009 UTC (3 years, 9 months ago) by cegger
Branch: MAIN
Changes since 1.32: +2 -20 lines
Diff to previous 1.32 (colored)

remove Xen2 support.
ok bouyer@

Revision 1.32 / (download) - annotate - [select for diffs], Mon Jun 8 09:32:33 2009 UTC (3 years, 11 months ago) by cegger
Branch: MAIN
CVS Tags: yamt-nfs-mp-base6, yamt-nfs-mp-base5, jymxensuspend-base
Changes since 1.31: +14 -2 lines
Diff to previous 1.31 (colored)

from sys/arch/x86/x86/cpu.c:

Implement -1 (RB_MD1) for physical CPUs in the Dom0.

Revision 1.31 / (download) - annotate - [select for diffs], Tue Dec 23 20:06:16 2008 UTC (4 years, 4 months ago) by cegger
Branch: MAIN
CVS Tags: yamt-nfs-mp-base4, yamt-nfs-mp-base3, nick-hppapmap-base4, nick-hppapmap-base3, nick-hppapmap-base2, nick-hppapmap-base, mjf-devfs2-base
Branch point for: jym-xensuspend
Changes since 1.30: +7 -8 lines
Diff to previous 1.30 (colored)

catch up with x86/x86/cpu.c: move from malloc to kmem

Revision 1.30 / (download) - annotate - [select for diffs], Thu Nov 6 19:35:11 2008 UTC (4 years, 6 months ago) by cegger
Branch: MAIN
CVS Tags: haad-nbase2, haad-dm-base2, haad-dm-base, ad-audiomp2-base, ad-audiomp2
Changes since 1.29: +9 -4 lines
Diff to previous 1.29 (colored)

Link cpus in the order they are attaching and not in inverse order.

Revision 1.29 / (download) - annotate - [select for diffs], Fri Oct 31 00:36:22 2008 UTC (4 years, 6 months ago) by rmind
Branch: MAIN
Changes since 1.28: +4 -4 lines
Diff to previous 1.28 (colored)

- Avoid the race with CPU online/offline state changes, when setting the
  affinity (cpu_lock protects these operations now).
- Disallow setting of state of CPU to to offline, if there are bound LWPs,
  which have no CPU to migrate.
- Disallow setting of affinity for the LWP(s), if all CPUs in the dynamic
  CPU-set are offline.
- sched_setaffinity: fix invalid check of kcpuset_isset().
- Rename cpu_setonline() to cpu_setstate().

Should fix PR/39349.

Revision 1.28 / (download) - annotate - [select for diffs], Fri Aug 22 10:25:58 2008 UTC (4 years, 8 months ago) by bouyer
Branch: MAIN
CVS Tags: wrstuden-revivesa-base-4, wrstuden-revivesa-base-3, wrstuden-revivesa-base-2, netbsd-5-base, matt-mips64-base2, haad-dm-base1
Branch point for: nick-hppapmap, netbsd-5
Changes since 1.27: +3 -3 lines
Diff to previous 1.27 (colored)

printf()->aprint_debug_dev() to match x86/cpu.c

Revision 1.27 / (download) - annotate - [select for diffs], Wed May 28 12:48:21 2008 UTC (4 years, 11 months ago) by ad
Branch: MAIN
CVS Tags: yamt-pf42-base4, yamt-pf42-base3, wrstuden-revivesa-base-1, wrstuden-revivesa-base, simonb-wapbl-nbase, simonb-wapbl-base, simonb-wapbl
Branch point for: haad-dm
Changes since 1.26: +4 -2 lines
Diff to previous 1.26 (colored)

Give it a private X86_MAXPROCS def. XXX

Revision 1.26 / (download) - annotate - [select for diffs], Fri May 16 17:20:01 2008 UTC (5 years ago) by bouyer
Branch: MAIN
CVS Tags: yamt-pf42-base2, hpcarm-cleanup-nbase
Changes since 1.25: +4 -5 lines
Diff to previous 1.25 (colored)

call x86_cpu_idle_init(), avoid null function pointer call (cpu_idle()) when
scheduling starts.
cleanup printfs of vcpu

Revision 1.25 / (download) - annotate - [select for diffs], Sun May 11 16:25:46 2008 UTC (5 years ago) by ad
Branch: MAIN
CVS Tags: yamt-nfs-mp-base2
Changes since 1.24: +3 -3 lines
Diff to previous 1.24 (colored)

Fix typo.

Revision 1.24 / (download) - annotate - [select for diffs], Sun May 11 16:23:05 2008 UTC (5 years ago) by ad
Branch: MAIN
Changes since 1.23: +4 -2 lines
Diff to previous 1.23 (colored)

Don't reload LDTR unless a new value, which only happens for USER_LDT.

Revision 1.23 / (download) - annotate - [select for diffs], Sun May 11 15:59:51 2008 UTC (5 years ago) by ad
Branch: MAIN
Changes since 1.22: +9 -15 lines
Diff to previous 1.22 (colored)

Stop using APIC IDs to identify CPUs for software purposes. Allows for
APIC IDs beyond 31, which has been possible for some time now.

Revision 1.22 / (download) - annotate - [select for diffs], Sun May 11 15:32:20 2008 UTC (5 years ago) by ad
Branch: MAIN
Changes since 1.21: +2 -5 lines
Diff to previous 1.21 (colored)

Share cpu.h between the x86 ports.

Revision 1.21 / (download) - annotate - [select for diffs], Sun May 11 15:02:34 2008 UTC (5 years ago) by ad
Branch: MAIN
Changes since 1.20: +7 -7 lines
Diff to previous 1.20 (colored)

Update xen for identcpu changes.

Revision 1.20 / (download) - annotate - [select for diffs], Sat May 10 16:27:57 2008 UTC (5 years ago) by ad
Branch: MAIN
Changes since 1.19: +4 -4 lines
Diff to previous 1.19 (colored)

Make xen build after tsc changes.

Revision 1.19 / (download) - annotate - [select for diffs], Fri May 9 18:11:29 2008 UTC (5 years ago) by joerg
Branch: MAIN
Changes since 1.18: +18 -2 lines
Diff to previous 1.18 (colored)

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.

Revision 1.18 / (download) - annotate - [select for diffs], Mon Apr 28 20:23:40 2008 UTC (5 years ago) by martin
Branch: MAIN
Branch point for: wrstuden-revivesa
Changes since 1.17: +2 -9 lines
Diff to previous 1.17 (colored)

Remove clause 3 and 4 from TNF licenses

Revision 1.17 / (download) - annotate - [select for diffs], Thu Apr 24 20:44:02 2008 UTC (5 years ago) by cegger
Branch: MAIN
CVS Tags: yamt-nfs-mp-base
Branch point for: yamt-nfs-mp
Changes since 1.16: +7 -2 lines
Diff to previous 1.16 (colored)

keep up with x86/x86/cpu.c, rev. 1.33:
Gracefully handle a condition where apic id >= X86_MAXPROCS rather than panicing.

Revision 1.16 / (download) - annotate - [select for diffs], Mon Apr 21 15:15:34 2008 UTC (5 years, 1 month ago) by cegger
Branch: MAIN
Changes since 1.15: +10 -7 lines
Diff to previous 1.15 (colored)

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

Revision 1.15 / (download) - annotate - [select for diffs], Fri Apr 18 15:32:46 2008 UTC (5 years, 1 month ago) by cegger
Branch: MAIN
CVS Tags: yamt-pf42-baseX, yamt-pf42-base
Branch point for: yamt-pf42
Changes since 1.14: +2 -12 lines
Diff to previous 1.14 (colored)

g/c unused ioapic_bsp_id.
Per discussion with bouyer.

Revision 1.14 / (download) - annotate - [select for diffs], Thu Apr 17 21:25:00 2008 UTC (5 years, 1 month ago) by bouyer
Branch: MAIN
Changes since 1.13: +3 -3 lines
Diff to previous 1.13 (colored)

Do not set ioapic_bsp_id in cpu_attach_common(). It's already initialized
in cpu_attach(), and doing it here will overwrite the cpu_number of the
physical CPU with the one from the virtual CPU (which is always 0).
XXX is ioapic_bsp_id read somewhere ?

Revision 1.13 / (download) - annotate - [select for diffs], Thu Apr 17 14:01:03 2008 UTC (5 years, 1 month ago) by yamt
Branch: MAIN
Changes since 1.12: +3 -3 lines
Diff to previous 1.12 (colored)

cpu_debug_dump: s/curproc/curlwp/ in a message.

Revision 1.12 / (download) - annotate - [select for diffs], Thu Apr 17 12:24:44 2008 UTC (5 years, 1 month ago) by cegger
Branch: MAIN
Changes since 1.11: +64 -16 lines
Diff to previous 1.11 (colored)

reduce diff to x86/x86/cpu.c

Revision 1.11 / (download) - annotate - [select for diffs], Sun Apr 13 22:29:38 2008 UTC (5 years, 1 month ago) by cegger
Branch: MAIN
Changes since 1.10: +223 -73 lines
Diff to previous 1.10 (colored)

reduce diff to x86/x86/cpu.c

Revision 1.10 / (download) - annotate - [select for diffs], Sun Apr 13 21:59:15 2008 UTC (5 years, 1 month ago) by cegger
Branch: MAIN
Changes since 1.9: +30 -39 lines
Diff to previous 1.9 (colored)

- device_t/softc split
- ansify

Revision 1.9 / (download) - annotate - [select for diffs], Sun Apr 6 07:24:20 2008 UTC (5 years, 1 month ago) by cegger
Branch: MAIN
Changes since 1.8: +15 -15 lines
Diff to previous 1.8 (colored)

use aprint_*_dev and device_xname

Revision 1.8 / (download) - annotate - [select for diffs], Wed Jan 16 02:08:49 2008 UTC (5 years, 4 months ago) by dogcow
Branch: MAIN
CVS Tags: yamt-lazymbuf-base15, yamt-lazymbuf-base14, nick-net80211-sync-base, nick-net80211-sync, mjf-devfs-base, matt-armv6-nbase, keiichi-mipv6-nbase, keiichi-mipv6-base, keiichi-mipv6, hpcarm-cleanup-base, bouyer-xeni386-nbase, bouyer-xeni386-base, ad-socklock-base1
Branch point for: mjf-devfs2
Changes since 1.7: +17 -2 lines
Diff to previous 1.7 (colored)

cargo-cult copy cpu_offline_md; fixes compile on i386/x86_64

Revision 1.7 / (download) - annotate - [select for diffs], Fri Jan 11 20:00:50 2008 UTC (5 years, 4 months ago) by bouyer
Branch: MAIN
Changes since 1.6: +4 -12 lines
Diff to previous 1.6 (colored)

Merge the bouyer-xeni386 branch to head, at tag bouyer-xeni386-merge1 (the
branch is still active and will see i386PAE support developement).
Sumary of changes:
- switch xeni386 to the x86/x86/pmap.c, and the xen/x86/x86_xpmap.c
  pmap bootstrap.
- merge back most of xen/i386/ to i386/i386
- change the build to reduce diffs between i386 and amd64 in file locations
- remove include files that were identical to the i386/amd64 counterparts,
  the build will find them via the xen-ma/machine link.

Revision 1.6 / (download) - annotate - [select for diffs], Fri Jan 4 15:55:35 2008 UTC (5 years, 4 months ago) by yamt
Branch: MAIN
CVS Tags: matt-armv6-base
Branch point for: matt-armv6
Changes since 1.5: +3 -3 lines
Diff to previous 1.5 (colored)

i386:
	- make tss per-cpu.  this considerably speeds up context switch for,
	  at least, pentium4, where ltr instruction seems very slow.
i386, xen:
	- kill cpu_maxproc.
kvm86:
	- adapt to per-cpu tss.
	- cleanup and simplify.
	- move kvm86_mp_lock to more meaningful place.
	- disable preemption during a call.

Revision 1.5 / (download) - annotate - [select for diffs], Tue Dec 18 07:17:18 2007 UTC (5 years, 5 months ago) by joerg
Branch: MAIN
CVS Tags: vmlocking2-base3
Changes since 1.4: +7 -7 lines
Diff to previous 1.4 (colored)

Add new IPI for saving CPU state explicitly, share high-level part of
ACPI wakeup code and teach it how to start the APs again. As a side
effect the CPU_START interface allows choosing between different
bootstrap codes more easily now.

Revision 1.4 / (download) - annotate - [select for diffs], Wed Dec 12 19:25:38 2007 UTC (5 years, 5 months ago) by bouyer
Branch: MAIN
CVS Tags: yamt-kmem-base3
Changes since 1.3: +3 -2 lines
Diff to previous 1.3 (colored)

Initialize ci_idepth in cpu_info_primary, makes LOCKDEBUG kernels boot.

Revision 1.3 / (download) - annotate - [select for diffs], Mon Dec 10 13:39:06 2007 UTC (5 years, 5 months ago) by bouyer
Branch: MAIN
CVS Tags: yamt-kmem-base2, cube-autoconf-base, cube-autoconf
Branch point for: bouyer-xeni386
Changes since 1.2: +8 -6 lines
Diff to previous 1.2 (colored)

Make Xen kernels build again.

Revision 1.2 / (download) - annotate - [select for diffs], Thu Nov 22 16:17:03 2007 UTC (5 years, 5 months ago) by bouyer
Branch: MAIN
CVS Tags: yamt-kmem-base, vmlocking2-base2, vmlocking2-base1, vmlocking-nbase, reinoud-bufcleanup-nbase, reinoud-bufcleanup-base, jmcneill-pm-base
Branch point for: yamt-lazymbuf, yamt-kmem, vmlocking2, vmlocking, jmcneill-pm
Changes since 1.1: +882 -0 lines
Diff to previous 1.1 (colored)

Pull up the bouyer-xenamd64 branch to HEAD. This brings in amd64 support
to NetBSD/Xen, both Dom0 and DomU.

Revision 1.1, Wed Oct 17 21:08:20 2007 UTC (5 years, 7 months ago) by bouyer
Branch: MAIN
CVS Tags: yamt-x86pmap-base4, jmcneill-base, bouyer-xenamd64-base2, bouyer-xenamd64-base
Branch point for: mjf-devfs, bouyer-xenamd64
FILE REMOVED

file cpu.c was initially added on branch bouyer-xenamd64.

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>