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

Re: [Xen-devel] [PATCH 4/6] xen/pvshim: simplify replace_va_mapping code



On 17/01/2018 09:48, Roger Pau Monne wrote:
> No functional change.
>
> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> ---
> Cc: Jan Beulich <jbeulich@xxxxxxxx>
> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> ---
>  xen/arch/x86/pv/shim.c | 21 ++++++---------------
>  1 file changed, 6 insertions(+), 15 deletions(-)
>
> diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c
> index 702249719e..4f94047695 100644
> --- a/xen/arch/x86/pv/shim.c
> +++ b/xen/arch/x86/pv/shim.c
> @@ -117,21 +117,12 @@ uint64_t pv_shim_mem(uint64_t avail)
>  static void __init replace_va_mapping(struct domain *d, l4_pgentry_t 
> *l4start,
>                                        unsigned long va, unsigned long mfn)
>  {
> -    struct page_info *page;
> -    l4_pgentry_t *pl4e;
> -    l3_pgentry_t *pl3e;
> -    l2_pgentry_t *pl2e;
> -    l1_pgentry_t *pl1e;
> -
> -    pl4e = l4start + l4_table_offset(va);
> -    pl3e = l4e_to_l3e(*pl4e);
> -    pl3e += l3_table_offset(va);
> -    pl2e = l3e_to_l2e(*pl3e);
> -    pl2e += l2_table_offset(va);
> -    pl1e = l2e_to_l1e(*pl2e);
> -    pl1e += l1_table_offset(va);
> -
> -    page = mfn_to_page(l1e_get_pfn(*pl1e));
> +    l4_pgentry_t *pl4e = l4start + l4_table_offset(va);
> +    l3_pgentry_t *pl3e = l4e_to_l3e(*pl4e) + l3_table_offset(va);
> +    l2_pgentry_t *pl2e = l3e_to_l2e(*pl3e) + l2_table_offset(va);
> +    l1_pgentry_t *pl1e = l2e_to_l1e(*pl2e) + l1_table_offset(va);
> +    struct page_info *page =  mfn_to_page(l1e_get_pfn(*pl1e));;

Double ;;  (Can be fixed on commit)

How about switching to using the typesafe mfn_to_page() before we gain
more code that we expect to change in the future?  If its only here then
it is probably worth folding into this commit.  If not, it should be a
separate patch.

~Andrew

_______________________________________________
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®.