|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 18/20] PVH xen: Add and remove foreign pages
>>> On 15.05.13 at 02:52, Mukesh Rathor <mukesh.rathor@xxxxxxxxxx> wrote:
> @@ -695,11 +697,37 @@ long do_memory_op(unsigned long cmd,
> XEN_GUEST_HANDLE_PARAM(void) arg)
>
> domain_lock(d);
>
> - page = get_page_from_gfn(d, xrfp.gpfn, NULL, P2M_ALLOC);
> - if ( page )
> + /*
> + * if PVH, the gfn could be mapped to a mfn from foreign domain by
> the
> + * user space tool during domain creation. We need to check for that,
> + * free it up from the p2m, and release refcnt on it. In such a case,
> + * page would be NULL and the following call would not have refcnt'd
> + * the page. See also xenmem_add_foreign_to_pmap().
> + */
> + page = get_page_from_gfn(d, xrfp.gpfn, &p2mt, P2M_ALLOC);
> +
> + if ( page || p2m_is_foreign(p2mt) )
> {
> - guest_physmap_remove_page(d, xrfp.gpfn, page_to_mfn(page), 0);
> - put_page(page);
> + if ( page )
> + mfn = page_to_mfn(page);
> + else
> + {
> + mfn = mfn_x(get_gfn_query(d, xrfp.gpfn, &tp));
> + foreign_dom = page_get_owner(mfn_to_page(mfn));
> + ASSERT(is_pvh_domain(d));
> + ASSERT(d != foreign_dom);
> + ASSERT(p2m_is_foreign(tp));
A guest can perform this operation on itself, so I'm afraid none of
the assertions are really valid (they likely will all need to become
error returns).
> + }
> +
> + guest_physmap_remove_page(d, xrfp.gpfn, mfn, 0);
> + if (page)
Coding style flaws have greatly reduced in the series up to here,
but there are still a few cases left. I'm not going to point them out
individually, I really expect you to go through your patches and
fix them.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |