From: xinyue Subject: Re: Performance problem about address translation Date: Mon, 6 Jul 2015 20:21:39 +0800 (CST) Message-ID: <1132173887.109164.1436185299238.JavaMail.tomcat@nfs.iscas.ac.cn> Reply-To: xinyue@nfs.iscas.ac.cn Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4069232861682631065==" Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZC5qp-0000vu-Pt for xen-devel@lists.xenproject.org; Mon, 06 Jul 2015 12:50:24 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: "andrew.cooper3" Cc: xen-devel List-Id: xen-devel@lists.xenproject.org --===============4069232861682631065== Content-Type: multipart/alternative; boundary="----=_Part_109163_1300798221.1436185299237" ------=_Part_109163_1300798221.1436185299237 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable =E5=9C=A8 2015-07-06, Mon, 16:11:02 ,Andrew Cooper =E5=86=99=E5=88=B0=EF=BC= =9A =09On 06/07/2015 08:58, xinyue wrote: =09  =09 =09=09 =09=09 =09=09 =09=09=E5=9C=A8 2015-07-06, Mon, 15:44:53 ,Andrew Cooper =E5=86=99=E5=88=B0= =EF=BC=9A =09=09 =09=09=09On 06/07/2015 08:22, xinyue wrote: =09=09 =09=09=09  =09=09 =09=09=09 =09=09=09=09Hi, =09=09=09=09 =09=09=09=09    For I want to translate the virtual address = in HVM DomU to virtual address in Xen. But when I use the function paging_g= va_to_gfn and get_gfn, I can feel the performance down quickly, the machine= become very hot and then I have to force the machine shutting down. =09=09=09=09 =09=09 =09=09 =09=09Your machine clearly isn't cooled sufficiently, which is the firs= t problem. =09=09 =09=09 =09=09=09 =09=09=09=09 =09=09=09=09The codes I used as below: =09=09=09=09    uint32_t pfec =3D PFEC_page_present; =09=09=09=09    unsigned long gfn; =09=09=09=09    unsigned long mfn; =09=09=09=09    unsigned long virtaddr; =09=09=09=09    struct vcpu *vcpu =3D current; =09=09=09=09    struct domain *d =3D vcpu->domain; =09=09=09=09 =09=09=09=09    gfn =3D paging_gva_to_gfn(current, 0xc029000= 0, &pfec); =09=09=09=09    mfn =3D get_gfn(d, gfn, &t); =09=09=09=09    virtaddr =3D map_domain_page(mfn_x(mfn)); =09=09=09=09 =09=09=09=09I also use the dbg_hvm_va2mfn function in debug.c, performance = problem still present. =09=09=09=09 =09=09 =09=09 =09=09Walking pagetables in software is slow.  There is no getting aro= und this. =09=09 =09=09Your performance problems will be caused by performing the operation = far too often.  You should find a way to reduce this. =09=09 =09=09 =09=09 =09=09 =09=09Thanks very much, I think I only do this for just once. And after the= thanslation is done, the performance is not turn to normal. Does that mean= that if I wait long enough it will recovery? It almost certainly means you are not doing it just once like you suppose. ~andrew         Yes, you are right. I added printk in get_gfn and found = it was call many times. I'll check why that happens. Thanks a lot! xinyue ------=_Part_109163_1300798221.1436185299237 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable



=E5=9C=A8 2015-07-06, Mon, 16:11:02 ,Andrew Cooper =E5=86=99=E5=88=B0=EF=BC= =9A
=09On 06/07/2015 08:58, xinyue wrote:
=09 
=09
=09=09
=09=09
=09=09
=09=09=E5=9C=A8 2015-07-06, Mon, 15:44:53 ,Andrew Cooper =E5=86=99=E5=88=B0= =EF=BC=9A
=09=09
=09=09=09On 06/07/2015 08:22, xinyue wrote:
=09=09
=09=09=09 
=09=09
=09=09=09
=09=09=09=09Hi,
=09=09=09=09
=09=09=09=09    For I want to translate the virtual address = in HVM DomU to virtual address in Xen. But when I use the function paging_g= va_to_gfn and get_gfn, I can feel the performance down quickly, the machine= become very hot and then I have to force the machine shutting down.
=09=09=09=09
=09=09
=09=09
=09=09Your machine clearly isn't cooled sufficiently, which is the firs= t problem.
=09=09
=09=09
=09=09=09
=09=09=09=09
=09=09=09=09The codes I used as belo= w:
=09=09=09=09    uint32_t pfec =3D PFEC_page_present;
=09=09=09=09    unsigned long gfn;
=09=09=09=09    unsigned long mfn;
=09=09=09=09    unsigned long virtaddr;
=09=09=09=09    struct vcpu *vcpu =3D current;
=09=09=09=09    struct domain *d =3D vcpu->domain;
=09=09=09=09
=09=09=09=09    gfn =3D paging_gva_to_gfn(current, 0xc029000= 0, &pfec);
=09=09=09=09    mfn =3D get_gfn(d, gfn, &t);
=09=09=09=09    virtaddr =3D map_domain_page(mfn_x(mfn)); =09=09=09=09
=09=09=09=09I also use the dbg_hvm_va2mfn function in debug.c, performance = problem still present.
=09=09=09=09
=09=09
=09=09
=09=09Walking pagetables in software is slow.  There is no getting aro= und this.
=09=09
=09=09Your performance problems will be caused by performing the operation = far too often.  You should find a way to reduce this.
=09=09
=09=09
=09=09
=09=09
=09=09Thanks very much, I think I only do this for just once. And after the= thanslation is done, the performance is not turn to normal. Does that mean= that if I wait long enough it will recovery?

It almost certainly means you are not doing it just once like you suppose.<= br />
~andrew    

    Yes, you are right. I added printk in get_gfn and found = it was call many times. I'll check why that happens. Thanks a lot!


xinyue
------=_Part_109163_1300798221.1436185299237-- --===============4069232861682631065== 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.xen.org http://lists.xen.org/xen-devel --===============4069232861682631065==--