From mboxrd@z Thu Jan 1 00:00:00 1970 From: "strongerwill" Subject: a question about count_info Date: Thu, 5 Aug 2010 13:39:52 +0800 Message-ID: <201008051339503427988@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1729411032==" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --===============1729411032== Content-Type: multipart/alternative; boundary="=====003_Dragon602053165648_=====" This is a multi-part message in MIME format. --=====003_Dragon602053165648_===== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi guys: I am working on Xen 4.0.0. In my project, I need to know the reference number of a paticular page. But I found the result do not match what I think. I need your help. For example, I allocate a buffer in kernel (dom0) char * buf = kmalloc( 4096, ...); Then I use my designed hypercall to read the count_info like this way: // add is the location of the buffer l1_pgentry_t nl1e = guest_map_l1e(current, add, &tmp); unsigned long pfn = 0, mfn = 0; p2m_type_t p2mt = 0; struct page_info *page = NULL; pfn = l1e_get_pfn(nl1e); mfn = mfn_x( gfn_to_mfn( current->domain, pfn, &p2mt ) ); debug_trace(printk("pfn %lx, mfn %lx, p2mt %x nl1e.l1 %llx\n", pfn, mfn, p2mt, nl1e.l1)); // here I check the validation of mfn, then try to get page page = mfn_to_page(mfn); debug_trace(printk("page count %lx, marked count %lx, page typeinfo %lx\n", page->count_info, page->count_info & PGC_count_mask, page->u.inuse.type_info)); the output likes this: pfn 5a4d0, mfn 5a4d0, p2mt 1 nl1e.l1 800000005a4d0063 page count 80000002, marked count 2, page typeinfo 74000001 When I allocate memory using vmalloc the output likes this: pfn 351ed, mfn 351ed, p2mt 1 nl1e.l1 80000000351ed063 page count 80000003, marked count 3, page typeinfo 74000002 previously I think the referece number (count_info) of these new allocated buffers should be "1". Now the output confuses me. Any one can explain this? Thanks very much Yueqiang 2010-08-05 strongerwill --=====003_Dragon602053165648_===== Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: 7bit
Hi guys:
   I am working on Xen 4.0.0. In my project, I need to know the reference number of a paticular page. But I found the result do not match what I think. I need your help.
 
For example, I allocate a buffer in kernel (dom0)
char * buf = kmalloc( 4096, ...);
Then I use my designed hypercall to read the count_info like this way:
// add is the location of the buffer
l1_pgentry_t nl1e = guest_map_l1e(current, add, &tmp);
                unsigned long pfn = 0, mfn = 0;
                p2m_type_t p2mt = 0;
                struct page_info *page = NULL;
                pfn = l1e_get_pfn(nl1e);
                mfn = mfn_x( gfn_to_mfn( current->domain, pfn, &p2mt ) );
                debug_trace(printk("pfn %lx, mfn %lx, p2mt %x nl1e.l1 %llx\n", pfn, mfn, p2mt, nl1e.l1));
// here I check the validation of mfn, then try to get page
                page = mfn_to_page(mfn);
                debug_trace(printk("page count %lx, marked count %lx, page typeinfo %lx\n",
                        page->count_info, page->count_info & PGC_count_mask, page->u.inuse.type_info));
 
the output likes this:
 
pfn 5a4d0, mfn 5a4d0, p2mt 1  nl1e.l1 800000005a4d0063 
page count 80000002, marked count 2, page typeinfo 74000001
 
When I allocate memory using vmalloc
the output likes this:
 
pfn 351ed, mfn 351ed, p2mt 1 nl1e.l1 80000000351ed063
page count 80000003, marked count 3, page typeinfo 74000002
 
previously I think the referece number (count_info) of  these new allocated buffers should be "1". Now the output confuses me. Any one can explain this?
Thanks very much
 
 
Yueqiang
 
2010-08-05

strongerwill
--=====003_Dragon602053165648_=====-- --===============1729411032== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============1729411032==--