[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v5] xen/arm: Allow balooning working with 1:1 memory mapping



>>> On 16.12.13 at 18:00, Julien Grall <julien.grall@xxxxxxxxxx> wrote:
> With the lack of iommu, dom0 must have a 1:1 memory mapping for all
> these guest physical address. When the ballon decides to give back a
> page to the kernel, this page must have the same address as previously.
> Otherwise, we will loose the 1:1 mapping and will break DMA-capable
> devices.
> 
> Signed-off-by: Julien Grall <julien.grall@xxxxxxxxxx>
> Cc: Keir Fraser <keir@xxxxxxx>

Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
if you do one more change (and a little bit of further cleanup -
sorry I didn't notice this before):

> @@ -122,7 +126,29 @@ static void populate_physmap(struct memop_args *a)
>          }
>          else
>          {
> -            page = alloc_domheap_pages(d, a->extent_order, a->memflags);
> +            if ( is_domain_direct_mapped(d) )
> +            {
> +                mfn = gpfn;
> +                if ( !mfn_valid(mfn) )
> +                {
> +                    gdprintk(XENLOG_INFO, "Invalid mfn 0x%"PRI_xen_pfn"\n",

"... %#"PRI_xen_pfn"\n" please.

> +                             mfn);
> +                    goto out;
> +                }
> +
> +                page = mfn_to_page(mfn);
> +                if ( !get_page(page, d) )
> +                {
> +                    gdprintk(XENLOG_INFO,
> +                             "mfn 0x%"PRI_xen_pfn" doesn't belong to the"
> +                             " domain\n", mfn);

Same here.

> --- a/xen/include/asm-arm/domain.h
> +++ b/xen/include/asm-arm/domain.h
> @@ -86,6 +86,9 @@ enum domain_type {
>  #define is_pv64_domain(d) (0)
>  #endif
>  
> +extern int dom0_11_mapping;
> +#define is_domain_direct_mapped(d) (dom0_11_mapping && (d) == dom0)

This needs to be

#define is_domain_direct_mapped(d) ((d) == dom0 && dom0_11_mapping)

in order to make sure d is evaluated exactly once.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.