Messages in this thread | | | Date | Sat, 18 Jan 2014 21:01:37 +0000 | From | Zoltan Kiss <> | Subject | Re: [PATCH v2 1/2] xen/grant-table: Avoid m2p_override during mapping |
| |
On 13/01/14 19:08, Zoltan Kiss wrote: > @@ -284,8 +287,37 @@ static int map_grant_pages(struct grant_map *map) > } > > pr_debug("map %d+%d\n", map->index, map->count); > - err = gnttab_map_refs(map->map_ops, use_ptemod ? map->kmap_ops : NULL, > - map->pages, map->count); > + err = gnttab_map_refs(map->map_ops, NULL, map->pages, map->count); > + if (err) > + return err; > + > + if (!in_interrupt() && paravirt_get_lazy_mode() == PARAVIRT_LAZY_NONE) { > + arch_enter_lazy_mmu_mode(); > + lazy = true; > + } > + > + for (i = 0; i < map->count; i++) { > + /* Do not add to override if the map failed. */ > + if (map->map_ops[i].status) > + continue; > + > + if (map->map_ops[i].flags & GNTMAP_contains_pte) { > + pte = (pte_t *) (mfn_to_virt(PFN_DOWN(map->map_ops[i].host_addr)) + > + (map->map_ops[i].host_addr & ~PAGE_MASK)); > + mfn = pte_mfn(*pte); > + } else { > + mfn = PFN_DOWN(map->map_ops[i].dev_bus_addr); > + } > + err = m2p_add_override(mfn, > + map->pages[i], > + use_ptemod ? &map->kmap_ops[i] : NULL); > + if (err) > + break; > + } > + > + if (lazy) > + arch_leave_lazy_mmu_mode(); > + > if (err) > return err; > > This patch has a fundamental problem here: we change the pfn in gnttab_map_refs, then fetch it in m2p_override again, but then we have a different one than we need. This causes Dom0 crash. I will send a new version to fix that.
Zoli
| |