From patchwork Thu Jan 23 16:23:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 313651 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 35CB52C0092 for ; Fri, 24 Jan 2014 03:24:16 +1100 (EST) Received: from localhost ([::1]:42057 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6N4f-0003sx-LT for incoming@patchwork.ozlabs.org; Thu, 23 Jan 2014 11:24:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53471) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6N46-0003K9-Oz for qemu-devel@nongnu.org; Thu, 23 Jan 2014 11:23:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W6N40-0001El-Az for qemu-devel@nongnu.org; Thu, 23 Jan 2014 11:23:38 -0500 Received: from smtp02.citrix.com ([66.165.176.63]:6591) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6N40-0001Ea-6n for qemu-devel@nongnu.org; Thu, 23 Jan 2014 11:23:32 -0500 X-IronPort-AV: E=Sophos;i="4.95,706,1384300800"; d="scan'208";a="93763593" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 23 Jan 2014 16:23:31 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.2.342.4; Thu, 23 Jan 2014 11:23:30 -0500 Received: from zion.uk.xensource.com ([10.80.2.73]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1W6N3x-0004Ds-NC; Thu, 23 Jan 2014 16:23:29 +0000 Date: Thu, 23 Jan 2014 16:23:29 +0000 From: Wei Liu To: Paolo Bonzini Message-ID: <20140123162329.GG24675@zion.uk.xensource.com> References: <52CAEF54.7030901@suse.de> <52CB17D1.2060400@redhat.com> <20140107123417.GG10654@zion.uk.xensource.com> <52CC01F6.6050502@redhat.com> <20140121182745.GA23328@zion.uk.xensource.com> <52DF9B76.8060807@redhat.com> <20140122160940.GC24675@zion.uk.xensource.com> <52E0DCDD.60405@redhat.com> <20140123135440.GF24675@zion.uk.xensource.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20140123135440.GF24675@zion.uk.xensource.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-DLP: MIA2 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.63 Cc: Peter Maydell , Wei Liu , Stefano Stabellini , QEMU Developers , "xen-devel@lists.xen.org" , Frediano Ziglio , Anthony Liguori , Andreas =?iso-8859-1?Q?F=E4rber?= Subject: Re: [Qemu-devel] [Xen-devel] Project idea: make QEMU more flexible X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On Thu, Jan 23, 2014 at 01:54:40PM +0000, Wei Liu wrote: > On Thu, Jan 23, 2014 at 10:11:57AM +0100, Paolo Bonzini wrote: > > Il 22/01/2014 17:09, Wei Liu ha scritto: > > >On Wed, Jan 22, 2014 at 11:20:38AM +0100, Paolo Bonzini wrote: > > >>Il 21/01/2014 19:27, Wei Liu ha scritto: > > >>>>> > > >>>>>Googling "disable tcg" would have provided an answer, but the patches > > >>>>>were old enough to be basically useless. I'll refresh the current > > >>>>>version in the next few days. Currently I am (or try to be) on > > >>>>>vacation, so I cannot really say when, but I'll do my best. :) > > >>>>> > > >>>Hi Paolo, any update? > > >> > > >>Oops, sorry, I thought I had sent that out. It's in the disable-tcg > > >>branch on my github repository. > > >> > > > > > >Unfortunately your branch didn't work when I enabled TCG support. If I > > >use "--disable-tcg" with configure then it works fine. > > > > Branch fixed. > > > > Yes, it's fixed for the case I reported. Thanks. > > But it is now broken with following rune: > ./configure --enable-kvm --disable-tcg --target-list=i386-softmmu > --disable-xen --enable-debug > > LINK i386-softmmu/qemu-system-i386 > cpus.o: In function `cpu_signal': > /local/scratch/qemu/cpus.c:569: undefined reference to `exit_request' > cpus.o: In function `tcg_cpu_exec': > /local/scratch/qemu/cpus.c:1257: undefined reference to `cpu_x86_exec' > cpus.o: In function `tcg_exec_all': > /local/scratch/qemu/cpus.c:1282: undefined reference to `exit_request' > /local/scratch/qemu/cpus.c:1299: undefined reference to `exit_request' > exec.o: In function `tlb_reset_dirty_range_all': > /local/scratch/qemu/exec.c:736: undefined reference to > `cpu_tlb_reset_dirty_all' > collect2: error: ld returned 1 exit status > make[1]: *** [qemu-system-i386] Error 1 > make: *** [subdir-i386-softmmu] Error 2 > > --enable-debug is the one to blame. Without that it links successfully. > > Wei. > Finally I figured out what was wrong. Your patch series was relying on compiler to aggresively optimize away unused code. So when --enable-debug is set, compiler won't optimize away the dead code, hence those undefine references. With any optimization option -O you series compiles successfully. Feel free to integrate my patch below, or fix those errors in the way you see appropriate. Wei. ---8<--- diff --git a/cpus.c b/cpus.c index 508b26c..2cc841b 100644 --- a/cpus.c +++ b/cpus.c @@ -563,6 +563,9 @@ static void cpu_handle_guest_debug(CPUState *cpu) static void cpu_signal(int sig) { + + assert(tcg_enabled()); + if (current_cpu) { cpu_exit(current_cpu); } @@ -1226,6 +1229,8 @@ static int tcg_cpu_exec(CPUArchState *env) int64_t ti; #endif + assert(tcg_enabled()); + #ifdef CONFIG_PROFILER ti = profile_getclock(); #endif @@ -1273,6 +1278,8 @@ static void tcg_exec_all(void) { int r; + assert(tcg_enabled()); + /* Account partial waits to QEMU_CLOCK_VIRTUAL. */ qemu_clock_warp(QEMU_CLOCK_VIRTUAL); diff --git a/tcg-stub.c b/tcg-stub.c index a06070f..b14a21d 100644 --- a/tcg-stub.c +++ b/tcg-stub.c @@ -29,3 +29,7 @@ void tlb_set_page(CPUArchState *env, target_ulong vaddr, void tb_invalidate_phys_addr(hwaddr addr) { } + +void cpu_tlb_reset_dirty_all(ram_addr_t start1, ram_addr_t length) +{ +}