From mboxrd@z Thu Jan 1 00:00:00 1970 From: xinyue Subject: Re: Performance problem about address translation Date: Tue, 7 Jul 2015 09:46:47 +0800 (CST) Message-ID: <115366142.109238.1436233607072.JavaMail.tomcat@nfs.iscas.ac.cn> Reply-To: xinyue@nfs.iscas.ac.cn Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5183030757274606592==" Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZCIQR-0008Fl-9Z for xen-devel@lists.xenproject.org; Tue, 07 Jul 2015 02:15:59 +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 --===============5183030757274606592== Content-Type: multipart/alternative; boundary="----=_Part_109237_40766505.1436233607071" ------=_Part_109237_40766505.1436233607071 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable =09 =09 =09 =09=E5=9C=A8 2015-07-06, Mon, 16:11:02 ,Andrew Cooper =E5=86=99=E5=88=B0=EF= =BC=9A =09 =09=09On 06/07/2015 08:58, xinyue wrote: =09 =09=09  =09 =09=09 =09=09=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=09=09=09On 06/07/2015 08:22, xinyue wrote: =09=09=09 =09=09=09=09  =09=09=09 =09=09=09=09 =09=09=09=09=09Hi, =09=09=09=09=09 =09=09=09=09=09    For I want to translate the virtual addre= ss in HVM DomU to virtual address in Xen. But when I use the function pagin= g_gva_to_gfn and get_gfn, I can feel the performance down quickly, the mach= ine become very hot and then I have to force the machine shutting down. =09=09=09=09=09 =09=09=09 =09=09=09 =09=09=09Your machine clearly isn't cooled sufficiently, which is the f= irst problem. =09=09=09 =09=09=09 =09=09=09=09 =09=09=09=09=09 =09=09=09=09=09The codes I used as below: =09=09=09=09=09    uint32_t pfec =3D PFEC_page_present; =09=09=09=09=09    unsigned long gfn; =09=09=09=09=09    unsigned long mfn; =09=09=09=09=09    unsigned long virtaddr; =09=09=09=09=09    struct vcpu *vcpu =3D current; =09=09=09=09=09    struct domain *d =3D vcpu->domain; =09=09=09=09=09    p2m_type_t t; =09=09=09=09=09 =09=09=09=09=09    gfn =3D paging_gva_to_gfn(current, 0xc029= 0000, &pfec); =09=09=09=09=09    mfn =3D get_gfn(d, gfn, &t); =09=09=09=09=09    virtaddr =3D map_domain_page(mfn_x(mfn)); =09=09=09=09=09 =09=09=09=09=09I also use the dbg_hvm_va2mfn function in debug.c, performan= ce problem still present. =09=09=09=09=09 =09=09=09 =09=09=09 =09=09=09Walking pagetables in software is slow.  There is no getting = around this. =09=09=09 =09=09=09Your performance problems will be caused by performing the operati= on far too often.  You should find a way to reduce this. =09=09=09 =09=09=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 m= ean that if I wait long enough it will recovery? =09 =09 =09It almost certainly means you are not doing it just once like you suppos= e. =09 =09~andrew     =09 =09    Yes, you are right. I added printk in get_gfn and fou= nd it was call many times. I'll check why that happens. Thanks a lot! =09 =09Sorry for mistaking it, the calls of these functions in log appear befor= e I invoke them. These functions that I invoked are through hypercall in HV= M DomU, through the log I think I invoked them only once. Maybe the perform= ance problem is caused by the parameters I used? Could you help me the chec= k if I used them unproperly as posted before. =09 =09Another question is when I add printk in paging_gva_to gfn function, the= performance alse down serioursly that it can't even boot hvm domu succ= essfully. I am wondering why. =09 =09Thanks again and best regards! =09 =09 =09xinyue ------=_Part_109237_40766505.1436233607071 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
=09
=09
=09
=09=E5=9C=A8 2015-07-06, Mon, 16:11:02 ,Andrew Cooper =E5=86=99=E5=88=B0=EF= =BC=9A
=09
=09=09On 06/07/2015 08:58, xinyue wrote:
=09
=09=09 
=09
=09=09
=09=09=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=09=09=09On 06/07/2015 08:22, xinyue wrote:
=09=09=09
=09=09=09=09 
=09=09=09
=09=09=09=09
=09=09=09=09=09Hi,
=09=09=09=09=09
=09=09=09=09=09    For I want to translate the virtual addre= ss in HVM DomU to virtual address in Xen. But when I use the function pagin= g_gva_to_gfn and get_gfn, I can feel the performance down quickly, the mach= ine become very hot and then I have to force the machine shutting down.
=09=09=09=09=09
=09=09=09
=09=09=09
=09=09=09Your machine clearly isn't cooled sufficiently, which is the f= irst problem.
=09=09=09
=09=09=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=09    uint32_t pfec =3D PFEC_page_present;
=09=09=09=09=09    unsigned long gfn;
=09=09=09=09=09    unsigned long mfn;
=09=09=09=09=09    unsigned long virtaddr;
=09=09=09=09=09    struct vcpu *vcpu =3D current;
=09=09=09=09=09    struct domain *d =3D vcpu->domain;
=09=09=09=09=09    p2m_type_t t;
=09=09=09=09=09
=09=09=09=09=09    gfn =3D paging_gva_to_gfn(current, 0xc029= 0000, &pfec);
=09=09=09=09=09    mfn =3D get_gfn(d, gfn, &t);
=09=09=09=09=09    virtaddr =3D map_domain_page(mfn_x(mfn));=
=09=09=09=09=09
=09=09=09=09=09I also use the dbg_hvm_va2mfn function in debug.c, performan= ce problem still present.
=09=09=09=09=09
=09=09=09
=09=09=09
=09=09=09Walking pagetables in software is slow.  There is no getting = around this.
=09=09=09
=09=09=09Your performance problems will be caused by performing the operati= on far too often.  You should find a way to reduce this.
=09=09=09
=09=09=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 m= ean that if I wait long enough it will recovery?
=09
=09
=09It almost certainly means you are not doing it just once like you suppos= e.
=09
=09~andrew    
=09
=09    Yes, you are right. I added printk in get_gfn and fou= nd it was call many times. I'll check why that happens. Thanks a lot! =09
=09Sorry for mistaking it, the calls of these functions in log appear befor= e I invoke them. These functions that I invoked are through hypercall in HV= M DomU, through the log I think I invoked them only once. Maybe the perform= ance problem is caused by the parameters I used? Could you help me the chec= k if I used them unproperly as posted before.
=09
=09Another question is when I add printk in paging_gva_to gfn function, the= performance alse down serioursly that it can't even boot hvm domu succ= essfully. I am wondering why.
=09
=09Thanks again and best regards!
=09
=09
=09xinyue
------=_Part_109237_40766505.1436233607071-- --===============5183030757274606592== 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 --===============5183030757274606592==--