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

Re: [Xen-devel] [PATCH v4 12/16] xen/mm: Switch common/memory.c to use typesafe MFN



>>> On 21.02.18 at 15:02, <julien.grall@xxxxxxx> wrote:
> @@ -95,11 +101,18 @@ static unsigned int max_order(const struct domain *d)
>      return min(order, MAX_ORDER + 0U);
>  }
>  
> +/* Helper to copy a typesafe MFN to guest */
> +#define copy_mfn_to_guest(hnd, off, mfn)            \
> +    ({                                              \
> +        xen_pfn_t mfn_ = mfn_x(mfn);                \
> +        __copy_to_guest_offset(hnd, off, &mfn_, 1); \
> +    })

Hmm, not really nice, but what do you do. 

>  static void increase_reservation(struct memop_args *a)
>  {
>      struct page_info *page;
>      unsigned long i;
> -    xen_pfn_t mfn;
> +    mfn_t mfn;

Please move this declaration ...

> @@ -133,7 +146,7 @@ static void increase_reservation(struct memop_args *a)
>               !guest_handle_is_null(a->extent_list) )
>          {
>              mfn = page_to_mfn(page);

... here, making the assignment its initializer. Or even avoid the
local variable altogether, as the macro has already got one. Same
elsewhere (whichever of the two variants fits), albeit maybe in the
other cases the scope can't be shrunk much.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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