[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Project idea: make QEMU more flexible



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)
+{
+}


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.