Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-3]: src/sys/arch/xen/i386 Pull up following revision(s) (requeste...
details: https://anonhg.NetBSD.org/src/rev/5d6d15585288
branches: netbsd-3
changeset: 577188:5d6d15585288
user: tron <tron%NetBSD.org@localhost>
date: Wed Sep 14 22:22:52 2005 +0000
description:
Pull up following revision(s) (requested by bouyer in ticket #775):
sys/arch/xen/i386/pmap.c: revision 1.13
Apply patch from Jed Davis, posted to port-xen:
In pmap_remap_pages() new mappings are created (PG_RW|PG_M). When saving
a domain, the hypervisor will refuse to map the foreing pages RW.
As a temporary measure, retry the mapping read-only if PG_RW fails, so that
domain save will work. Also fix the PTP's wire_count if the MMU update
fails (prevent a kernel panic).
diffstat:
sys/arch/xen/i386/pmap.c | 35 ++++++++++++++++++++++++++++++-----
1 files changed, 30 insertions(+), 5 deletions(-)
diffs (69 lines):
diff -r 7d3138b1cb93 -r 5d6d15585288 sys/arch/xen/i386/pmap.c
--- a/sys/arch/xen/i386/pmap.c Wed Sep 14 22:21:48 2005 +0000
+++ b/sys/arch/xen/i386/pmap.c Wed Sep 14 22:22:52 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.8.2.3 2005/06/06 12:16:10 tron Exp $ */
+/* $NetBSD: pmap.c,v 1.8.2.4 2005/09/14 22:22:52 tron Exp $ */
/* NetBSD: pmap.c,v 1.179 2004/10/10 09:55:24 yamt Exp */
/*
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.8.2.3 2005/06/06 12:16:10 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.8.2.4 2005/09/14 22:22:52 tron Exp $");
#include "opt_cputype.h"
#include "opt_user_ldt.h"
@@ -4135,7 +4135,9 @@
struct vm_page_md *mdpg;
struct pv_head *old_pvh;
struct pv_entry *pve = NULL; /* XXX gcc */
- int error;
+ int error, dptpwire;
+
+ dptpwire = 0;
XENPRINTK(("pmap_remap_pages(%p, %p, %p, %d, %08x, %d)\n",
pmap, (void *)va, (void *)pa, npages, flags, dom));
@@ -4301,14 +4303,37 @@
} else {
pmap->pm_stats.resident_count++;
pmap->pm_stats.wired_count++;
- if (ptp)
+ if (ptp) {
+ dptpwire = 1;
ptp->wire_count++;
+ }
}
//printf("pmap initial setup");
maptp = (pt_entry_t *)vtomach((vaddr_t)&ptes[x86_btop(va)]);
+ change_pte:
error = xpq_update_foreign(maptp, npte, dom);
-
+ if (error) {
+ if (npte & PG_RW) {
+ /*
+ * XXXjld%panix.com@localhost: Some things cannot be
+ * mapped read/write, even by a privileged
+ * domain. This wouldn't be necessary if
+ * pmap_remap_pages had a "prot" parameter
+ * like pmap_enter does.
+ */
+ npte &= ~(PG_RW | PG_M);
+ //printf("pmap_remap_pages: losing write bit npte=%lx\n", (unsigned long)npte);
+ goto change_pte;
+ }
+ printf("pmap_remap_pages: xpq_update_foreign failed va=%lx"
+ " npte=%lx error=%d dptpwire=%d\n",
+ va, (unsigned long)npte, error, dptpwire);
+ ptp->wire_count -= dptpwire;
+ /* XXX fix other stats? */
+ goto out;
+ }
+
shootdown_test:
/* Update page attributes if needed */
if ((opte & (PG_V | PG_U)) == (PG_V | PG_U)) {
Home |
Main Index |
Thread Index |
Old Index