From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: Performance problem about address translation Date: Mon, 06 Jul 2015 09:37:47 +0100 Message-ID: <559A3E5B.7080200@citrix.com> References: <945896100.109123.1436169531322.JavaMail.tomcat@nfs.iscas.ac.cn> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2277179497677627175==" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZC1uR-0006nR-BK for xen-devel@lists.xenproject.org; Mon, 06 Jul 2015 08:37:51 +0000 In-Reply-To: <945896100.109123.1436169531322.JavaMail.tomcat@nfs.iscas.ac.cn> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xinyue@nfs.iscas.ac.cn Cc: xen-devel List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --===============2277179497677627175== Content-Type: multipart/alternative; boundary="------------080800010209040406080402" This is a multi-part message in MIME format. --------------080800010209040406080402 Content-Type: text/plain; charset=utf-8 Content-Length: 1570 Content-Transfer-Encoding: quoted-printable On 06/07/2015 08:58, xinyue wrote: > > > > =E5=9C=A8 2015-07-06, Mon, 15:44:53 ,Andrew Cooper =E5=86=99=E5=88=B0=EF=BC=9A > On 06/07/2015 08:22, xinyue wrote: >> >> Hi, >> >> For I want to translate the virtual address in HVM DomU to >> virtual address in Xen. But when I use the function paging_gva_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. > > Your machine clearly isn't cooled sufficiently, which is the first > problem. > >> >> The codes I used as below: >> uint32_t pfec =3D PFEC_page_present; >> unsigned long gfn; >> unsigned long mfn; >> unsigned long virtaddr; >> struct vcpu *vcpu =3D current; >> struct domain *d =3D vcpu->domain; >> >> gfn =3D paging_gva_to_gfn(current, 0xc0290000, &pfec); >> mfn =3D get_gfn(d, gfn, &t); >> virtaddr =3D map_domain_page(mfn_x(mfn)); >> >> I also use the dbg_hvm_va2mfn function in debug.c, performance >> problem still present. > > Walking pagetables in software is slow. There is no getting around this. > > Your performance problems will be caused by performing the operation > far too often. You should find a way to reduce this. > > > > > Thanks 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=3F It almost certainly means you are not doing it just once like you suppose. ~Andrew --------------080800010209040406080402 Content-Type: text/html; charset=utf-8 Content-Length: 3511 Content-Transfer-Encoding: quoted-printable
On 06/07/2015 08:58, xinyue wrote:



=E5=9C=A8 2015-07-06, Mon, 15:44:53 ,Andrew Cooper =E5=86=99=E5=88=B0=EF=BC=9A
On 06/07/2015 08:22, xinyue wrote:
=C2=A0
Hi,

=C2=A0=C2=A0=C2=A0 For I want to translate the virtual address in HVM DomU to virtual address in Xen. But when I use the function paging_gva_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.

Your machine clearly isn't cooled sufficiently, which is the first problem.


The codes I used as below:
=C2=A0=C2=A0=C2=A0 uint32_t pfec =3D PFEC_page_present;
=C2=A0=C2=A0=C2=A0 unsigned long gfn;
=C2=A0=C2=A0=C2=A0 unsigned long mfn;
=C2=A0=C2=A0=C2=A0 unsigned long virtaddr;
=C2=A0=C2=A0=C2=A0 struct vcpu *vcpu =3D current;
=C2=A0=C2=A0=C2=A0 struct domain *d =3D vcpu->domain;

=C2=A0=C2=A0=C2=A0 gfn =3D paging_gva_to_gfn(current, 0xc0290000, &pfec);
=C2=A0=C2=A0=C2=A0 mfn =3D get_gfn(d, gfn, &t);
=C2=A0=C2=A0=C2=A0 virtaddr =3D map_domain_page(mfn_x(mfn));

I also use the dbg_hvm_va2mfn function in debug.c, performance problem still present.

Walking pagetables in software is slow.=C2=A0 There is no getting around this.

Your performance problems will be caused by performing the operation far too often.=C2=A0 You should find a way to reduce this.




Thanks 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=3F

It almost certainly means you are not doing it just once like you suppose.

~Andrew
--------------080800010209040406080402-- --===============2277179497677627175== 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 --===============2277179497677627175==--