Re: [PATCH 09/11] xen: introduce gnttab_map_refs andgnttab_unmap_refs

From: Stefano Stabellini
Date: Mon Jan 10 2011 - 05:30:58 EST


On Wed, 5 Jan 2011, Konrad Rzeszutek Wilk wrote:
> > +
> > + ret = HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, map_ops, count);
> > +
> > + for (i = 0; i < count; i++) {
> > + pfn = mfn_to_pfn(map_ops[i].host_addr >> PAGE_SHIFT);
>
> Shouldn't you be checking the flag to see if this a bus address? You could
> also use the PFN_DOWN macro here..

Yes, actually I should be checking for GNTMAP_contains_pte.

> > + pte = (pte_t *) __va((pfn << PAGE_SHIFT) +
> > + (map_ops[i].host_addr & ~PAGE_MASK));
>
> PFN_PHYS(pfn)? Or better You could use the mfn_to_virt macro here:
>
> pte = (pte_t *) mfn_to_virt(PFN_DOWN(map_ops[i].ost_addr));
> pte += (map_ops[i].host_addr & _PAGE_MASK);
>

Good suggestion, I have applied it (plus a small change to the pointer
arithmetic).

> > + val = *pte;
> > + mfn = (native_pte_val(val) & PTE_PFN_MASK) >> PAGE_SHIFT;
>
> mfn = pte_mfn(pte) ?
>

yep, done that.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/