From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:38328) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rb67t-00027o-F3 for qemu-devel@nongnu.org; Thu, 15 Dec 2011 02:53:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rb67r-0000Ep-RT for qemu-devel@nongnu.org; Thu, 15 Dec 2011 02:53:13 -0500 Received: from mail-vx0-f173.google.com ([209.85.220.173]:62878) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rb67r-0000Ej-Nm for qemu-devel@nongnu.org; Thu, 15 Dec 2011 02:53:11 -0500 Received: by vcbfo1 with SMTP id fo1so251945vcb.4 for ; Wed, 14 Dec 2011 23:53:10 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <20111215065722.GA98733@cs.nctu.edu.tw> References: <20111215065722.GA98733@cs.nctu.edu.tw> Date: Thu, 15 Dec 2011 15:53:10 +0800 Message-ID: From: Zhi Yong Wu Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] The reason behind block linking constraint? (Cont.) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?6Zmz6Z+L5Lu7?= Cc: qemu-devel@nongnu.org I have one related question. If you build one new kernel image and initrd from Linus' kernel git tree, and don't modify qemu, can it work fine? On Thu, Dec 15, 2011 at 2:57 PM, =E9=99=B3=E9=9F=8B=E4=BB=BB wrote: > Hi all, > > =C2=A0I want to continue the discussion about the cross page constraint o= n block > linking [1][2]. Max explained to me that if we link TBs belong different = guest > pages, then QEMU might crash when the memory mapping is changed by tlb_se= t_page > (exec.c). Memory mapping changes may be the result of a page swapping or = a task > switch. My final goal is to understand why we need to put such constraint= on > block linking completely. And if we remove the constraint, in what situat= ion > the QEMU crash. The reason that we (our QEMU + LLVM project [3]) want to > investigate this is we have a few optimizations which would like to remov= e cross > page constraint if possible, say trace building, for example. > > =C2=A0I use two linux image: (A) is downloaded from the QEMU website, and= (B) is > built by using buildroot [4]. I modify QEMU 1.0, only remove the if-else > statement in function gen_goto_tb (target-i386/translate.c). So it become= s, > > static inline void gen_goto_tb(DisasContext *s, int tb_num, target_ulong = eip) > { > =C2=A0 =C2=A0TranslationBlock *tb; > =C2=A0 =C2=A0target_ulong pc; > > =C2=A0 =C2=A0pc =3D s->cs_base + eip; > =C2=A0 =C2=A0tb =3D s->tb; > > =C2=A0 =C2=A0/* leave only the if branch */ > =C2=A0 =C2=A0tcg_gen_goto_tb(tb_num); > =C2=A0 =C2=A0gen_jmp_im(eip); > =C2=A0 =C2=A0tcg_gen_exit_tb((tcg_target_long)tb + tb_num); > } > > =C2=A0Below is how I use buildroot to build the kernel image and root fil= e system. > > --- > $ wget http://buildroot.uclibc.org/downloads/snapshots/buildroot-snapshot= .tar.bz2 > $ tar xvf buildroot-snapshot.tar.bz2; cd buildroot > # I leave the default config alone > $ make qemu_x86_defconfig; make menuconfig; make > $ cd output/images/ > $ qemu-system-i386 -kernel bzImage -hda rootfs.ext2 -vnc 0.0.0.0:1 > --- > > =C2=A0I get a kernel panic while booting (A), but (B) *works fine*. I am = pretty sure > they both call tlb_set_page. Is it because (B) calls tlb_set_page but doe= sn't > modify the same tlb entry or other reasons so that it works fine even we = remove > the cross page constraint from block linking? > > =C2=A0Any comment appreciated. > > Regards, > chenwj > > [1] http://lists.nongnu.org/archive/html/qemu-devel/2011-08/msg02249.html > [2] https://lists.gnu.org/archive/html/qemu-devel/2011-09/msg03065.html > [3] http://lists.gnu.org/archive/html/qemu-devel/2011-11/msg03420.html > [4] http://buildroot.uclibc.org/ > > -- > Wei-Ren Chen (=E9=99=B3=E9=9F=8B=E4=BB=BB) > Computer Systems Lab, Institute of Information Science, > Academia Sinica, Taiwan (R.O.C.) > Tel:886-2-2788-3799 #1667 > Homepage: http://people.cs.nctu.edu.tw/~chenwj > --=20 Regards, Zhi Yong Wu