From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH 1/2] kvm-unit-tests: Add a func to run instruction in emulator Date: Thu, 20 Jun 2013 08:42:19 +0300 Message-ID: <20130620054219.GS5832@redhat.com> References: <1371654057-17169-1-git-send-email-yzt356@gmail.com> <20130619160309.GR5832@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm , Paolo Bonzini , Jan Kiszka To: Gmail Return-path: Received: from mx1.redhat.com ([209.132.183.28]:59178 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751833Ab3FTFmW convert rfc822-to-8bit (ORCPT ); Thu, 20 Jun 2013 01:42:22 -0400 Content-Disposition: inline In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Jun 20, 2013 at 01:48:39AM +0800, Gmail wrote: >=20 > =E5=9C=A8 2013-6-20=EF=BC=8C0:03=EF=BC=8CGleb Natapov =E5=86=99=E9=81=93=EF=BC=9A >=20 > > On Wed, Jun 19, 2013 at 11:07:18PM +0800, =E6=9D=8E=E6=98=A5=E5=A5=87= wrote: > >> Hi Gleb, > >> This version can set %rsp before trapping into emulator, because > >> insn_page and alt_insn_page is statically defined and their relati= ve > >> position to (save) is fixed during execution. > > The position of the code is not fixed during execution since you ex= ecute > > it from a virtual address obtained dynamically by vmap() and the ad= dress > > is definitely different from the one the code was compiled for, but= if > > you look at the code that compile actually produce you will see tha= t it > > uses absolute address to access "save" and this is why it works. I > > wounder why compiler decided to use absolute address this time, Pao= lo? > >=20 > >> In this way, test case of test_mmx_movq_mf needs to pre-define its= own > >> stack, this change is in the next patch. > >>=20 > >> In this version, insn_ram is initially mapped to insn_page and the= m > >> each call to insn_page/alt_insn_page are all via insn_ram. This tr= ick > >> runs well but I don't know why my previous version causes error. > > Because previous version tried to use install_page() on a large pag= e > > mapped region and the function does not know how to handle that. > I don't quite understand what you mean here. What is the differences = between large page and 4k page in this test case? Test assumes 4k page size. > Maybe I don't understand the differences of install_pte() with 4k pag= e and 2m pages. May be. You cannot install 4k page in place of 2m page before breaking the later to 512 4k pages. -- Gleb.