xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* Where and How the P2M table and M2P table create?
@ 2016-04-14  6:37 Yunqiang Gao
  2016-04-15  8:26 ` George Dunlap
  2016-04-18  3:34 ` Zhang, Chunyu
  0 siblings, 2 replies; 3+ messages in thread
From: Yunqiang Gao @ 2016-04-14  6:37 UTC (permalink / raw)
  To: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 338 bytes --]

Hi,alls,

As we know,in xen ,when create shadow page table and EPT page table,we need
the p2m and m2p.I want to know when are the p2m been created.Was it created
at the time of the creation of the domainU?Or at the beginning is a empty
table and in the subsequent gradually established?

And how was it been created?

Thanks!

[-- Attachment #1.2: Type: text/html, Size: 452 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Where and How the P2M table and M2P table create?
  2016-04-14  6:37 Where and How the P2M table and M2P table create? Yunqiang Gao
@ 2016-04-15  8:26 ` George Dunlap
  2016-04-18  3:34 ` Zhang, Chunyu
  1 sibling, 0 replies; 3+ messages in thread
From: George Dunlap @ 2016-04-15  8:26 UTC (permalink / raw)
  To: Yunqiang Gao; +Cc: xen-devel

On Thu, Apr 14, 2016 at 7:37 AM, Yunqiang Gao <mrgao.buffoon@gmail.com> wrote:
> Hi,alls,
>
> As we know,in xen ,when create shadow page table and EPT page table,we need
> the p2m and m2p.I want to know when are the p2m been created.Was it created
> at the time of the creation of the domainU?Or at the beginning is a empty
> table and in the subsequent gradually established?

The mechanism of assigning memory to an HVM guest and populating the
p2m table is the same.  That is, the domain builder calls
"guest_populate_physmap()" hypercalls, which tell Xen, "put some
memory in this p2m region"; Xen will then allocate memory from the
free list and put it in the p2m.

> And how was it been created?

I'm not sure what you're asking here.  This might help you get better
feedback: http://wiki.xenproject.org/wiki/Asking_Developer_Questions

In any case, the questions you're asking sound like you want to make
some changes to the code; in which case, nothing will be useful unless
you can find 80% of what you need from the code itself.  I'd suggest
you start with searching under the source tree for "domain build" and
"domain create", and come back with specific clarifying questions.

 -George

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Where and How the P2M table and M2P table create?
  2016-04-14  6:37 Where and How the P2M table and M2P table create? Yunqiang Gao
  2016-04-15  8:26 ` George Dunlap
@ 2016-04-18  3:34 ` Zhang, Chunyu
  1 sibling, 0 replies; 3+ messages in thread
From: Zhang, Chunyu @ 2016-04-18  3:34 UTC (permalink / raw)
  To: Xen-devel, xen-devel

hi

this may help you。。。


hvm_vcpu_initialise 
  - .vcpu_initialise  = vmx_vcpu_initialise,
  - vmx_create_vmcs
    - construct_vmcs
      -     if ( paging_mode_hap(d) )
            {
               struct p2m_domain *p2m = p2m_get_hostp2m(d);
               struct ept_data *ept = &p2m->ept;
  
               ept->asr  = pagetable_get_pfn(p2m_get_pagetable(p2m));
               __vmwrite(EPT_POINTER, ept_get_eptp(ept));
             }

main --> main_create --> create_domain --> libxl_domain_create_new 
--> do_domain_create --> initiate_domain_create -->  libxl__bootloader_run
 --> libxl__device_disk_local_initiate_detach --> local_device_detach_cb 
--> bootloader_local_detached_cb --> domcreate_bootloader_done --> libxl__domain_build
 --> libxl__build_hvm --> libxl__build_dom --> xc_dom_boot_mem_init -->
 meminit_hvm
  --> xc_domain_populate_physmap 
     -->  err = do_memory_op(xch, XENMEM_populate_physmap, &reservation);


- do_memory_op(xch, XENMEM_populate_physmap, &reservation)  (memory.c)
  - populate_physmap
  - is_domain_direct_mapped
     - mfn = gpfn
     - put_page
  - else
   - page = alloc_domheap_pages(d, a->extent_order, a->memflags);
   - mfn = page_to_mfn(page);
   - guest_physmap_add_page(d, gpfn, mfn, a->extent_order);
   - guest_physmap_add_entry(d, gfn, mfn, page_order, p2m_ram_rw)
     /* First, remove m->p mappings for existing p->m mappings */
     -  for ( i = 0; i < (1UL << page_order); i++ )
        -  omfn = p2m->get_entry(p2m, gfn + i, &ot, &a, 0, NULL, NULL);
           - mfn = _mfn(ept_entry->mfn)  
        -  set_gpfn_from_mfn
           - _set_gpfn_from_mfn(mfn, pfn)
             - machine_to_phys_mapping[(mfn)] = (entry) 
     /* Then, look for m->p mappings for this range and deal with them */
     /* Now, actually do the two-way mapping */
     -   rc = p2m_set_entry(p2m, gfn, _mfn(mfn), page_order, t,
                             p2m->default_access);
     -    set_gpfn_from_mfn(mfn+i, gfn+i);   
>Hi,alls,
>
>As we know,in xen ,when create shadow page table and EPT page table,we need the p2m and m2p.I want to know when are the p2m been created.Was it created at the time of the creation of the domainU?Or at the beginning is a empty table and in the subsequent gradually established?
>
>And how was it been created?
>
>Thanks!
>
>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-18  3:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-14  6:37 Where and How the P2M table and M2P table create? Yunqiang Gao
2016-04-15  8:26 ` George Dunlap
2016-04-18  3:34 ` Zhang, Chunyu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).