All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Hongyan Xia <hx242@xen.org>
Cc: xen-devel@lists.xenproject.org, julien@xen.org
Subject: Re: [PATCH v6 09/15] efi: use new page table APIs in copy_mapping
Date: Thu, 30 Apr 2020 14:42:40 +0200	[thread overview]
Message-ID: <6f2447ba-e12a-9241-6c2c-a7a49059c09b@suse.com> (raw)
In-Reply-To: <6c27c79964eb16eba4743515689b9fd7eb3409d1.1587735799.git.hongyxia@amazon.com>

On 24.04.2020 16:09, Hongyan Xia wrote:
> --- a/xen/common/efi/boot.c
> +++ b/xen/common/efi/boot.c
> @@ -1454,16 +1454,20 @@ static __init void copy_mapping(unsigned long mfn, unsigned long end,
>              continue;
>          if ( !(l4e_get_flags(l4e) & _PAGE_PRESENT) )
>          {
> -            l3dst = alloc_xen_pagetable();
> -            BUG_ON(!l3dst);
> +            mfn_t l3mfn = alloc_xen_pagetable_new();
> +
> +            BUG_ON(mfn_eq(l3mfn, INVALID_MFN));
> +            l3dst = map_domain_page(l3mfn);
>              clear_page(l3dst);
>              efi_l4_pgtable[l4_table_offset(mfn << PAGE_SHIFT)] =
> -                l4e_from_paddr(virt_to_maddr(l3dst), __PAGE_HYPERVISOR);
> +                l4e_from_mfn(l3mfn, __PAGE_HYPERVISOR);
>          }
>          else
> -            l3dst = l4e_to_l3e(l4e);
> -        l3src = l4e_to_l3e(idle_pg_table[l4_table_offset(va)]);
> +            l3dst = map_l3t_from_l4e(l4e);
> +        l3src = map_l3t_from_l4e(idle_pg_table[l4_table_offset(va)]);
>          l3dst[l3_table_offset(mfn << PAGE_SHIFT)] = l3src[l3_table_offset(va)];
> +        unmap_domain_page(l3src);
> +        unmap_domain_page(l3dst);
>      }
>  }

This looks very inefficient - you establish and tear down two mappings
per loop iteration, when really you may end up copying all 512 slots
between the same pair of L3 tables.

Jan


  reply	other threads:[~2020-04-30 12:43 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-24 14:08 [PATCH v6 00/15] switch to domheap for Xen page tables Hongyan Xia
2020-04-24 14:08 ` [PATCH v6 01/15] x86/mm: map_pages_to_xen would better have one exit path Hongyan Xia
2020-04-24 14:08 ` [PATCH v6 02/15] x86/mm: make sure there is one exit path for modify_xen_mappings Hongyan Xia
2020-04-24 14:08 ` [PATCH v6 03/15] x86/mm: rewrite virt_to_xen_l*e Hongyan Xia
2020-05-20  9:27   ` Jan Beulich
2020-04-24 14:08 ` [PATCH v6 04/15] x86/mm: switch to new APIs in map_pages_to_xen Hongyan Xia
2020-04-24 14:08 ` [PATCH v6 05/15] x86/mm: switch to new APIs in modify_xen_mappings Hongyan Xia
2020-04-24 14:08 ` [PATCH v6 06/15] x86_64/mm: introduce pl2e in paging_init Hongyan Xia
2020-05-20  9:35   ` Jan Beulich
2020-04-24 14:08 ` [PATCH v6 07/15] x86_64/mm: switch to new APIs " Hongyan Xia
2020-05-20  9:46   ` Jan Beulich
2020-05-27 15:01     ` Hongyan Xia
2020-04-24 14:08 ` [PATCH v6 08/15] x86_64/mm: switch to new APIs in setup_m2p_table Hongyan Xia
2020-05-20  9:54   ` Jan Beulich
2020-04-24 14:09 ` [PATCH v6 09/15] efi: use new page table APIs in copy_mapping Hongyan Xia
2020-04-30 12:42   ` Jan Beulich [this message]
2020-04-24 14:09 ` [PATCH v6 10/15] efi: switch to new APIs in EFI code Hongyan Xia
2020-04-30 12:55   ` Jan Beulich
2020-04-24 14:09 ` [PATCH v6 11/15] x86/smpboot: clone_mapping should have one exit path Hongyan Xia
2020-04-30 14:59   ` Jan Beulich
2020-04-24 14:09 ` [PATCH v6 12/15] x86/smpboot: switch pl*e to use new APIs in clone_mapping Hongyan Xia
2020-04-30 15:15   ` Jan Beulich
2020-05-11 10:55     ` Hongyan Xia
2020-04-24 14:09 ` [PATCH v6 13/15] x86/mm: drop old page table APIs Hongyan Xia
2020-05-20 10:09   ` Jan Beulich
2020-05-27 15:19     ` Hongyan Xia
2020-04-24 14:09 ` [PATCH v6 14/15] x86: switch to use domheap page for page tables Hongyan Xia
2020-04-24 14:09 ` [PATCH v6 15/15] x86/mm: drop _new suffix for page table APIs Hongyan Xia
2020-05-20  9:56   ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6f2447ba-e12a-9241-6c2c-a7a49059c09b@suse.com \
    --to=jbeulich@suse.com \
    --cc=hx242@xen.org \
    --cc=julien@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.