Port-xen archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Not quite a fix for: port-xen/30635
The attached patch changes IOCTL_PRIVCMD_MMAP such that it will
decline to replace a nonexistent mapping, and uses (abuses?) uvm_fault
to attempt to create a mapping if needed so that xend will still work.
The result is that the dom0 kernel no longer panics, but xend is still
as confused as before: on the first restart, it tries to destroy
domain 1 and then dies, and futher attempts to start it do nothing at
all.
In other words, the MI UVM structures are slightly less inconsistent
with the pmap than they used to be: assuming I understand what's going
on, there's now actually a vm_page corresponding to each foreign
machine page (notwithstanding that that vm_page's PA is a complete
fiction), so the mapping gets removed when the process exits.
--- xen/privcmd.c 18 Jun 2005 10:43:37 -0000 1.2.2.2
+++ xen/privcmd.c 23 Jul 2005 03:46:40 -0000
@@ -105,9 +105,12 @@
vaddr_t va;
u_long ma;
- //printf("IOCTL_PRIVCMD_MMAP: %d entries\n", mcmd->num);
+ struct vm_map *vmm;
+ pmap_t pmap;
- pmap_t pmap = vm_map_pmap(&ap->a_p->p_vmspace->vm_map);
+ vmm = &ap->a_p->p_vmspace->vm_map;
+ pmap = vm_map_pmap(vmm);
for (i = 0; i < mcmd->num; i++) {
- error = copyin(mcmd->entry, &mentry, sizeof(mentry));
+ error = copyin(&mcmd->entry[i], &mentry,
+ sizeof(mentry));
if (error)
return error;
@@ -124,7 +127,15 @@
for (j = 0; j < mentry.npages; j++) {
//printf("remap va 0x%lx to 0x%lx\n", va, ma);
-#if 0
- if (!pmap_extract(pmap, va, NULL))
- return EINVAL; /* XXX */
+#if 1
+ /* XXXjld%panix.com@localhost */
+ if (!pmap_extract(pmap, va, NULL)) {
+ (void)uvm_fault(vmm, va,
+ VM_FAULT_INVALID, UVM_PROT_NONE);
+ if (!pmap_extract(pmap, va, NULL)) {
+ printf("IOCTL_PRIVCMD_MMAP: "
+ "no existing mapping\n");
+ return EINVAL;
+ }
+ }
#endif
if ((error = pmap_remap_pages(pmap, va, ma, 1,
Home |
Main Index |
Thread Index |
Old Index