Skip to contentSkip to conversation

qemu-system-sparc uses all host cpu while target system is idle

Qemu-devel Aurelien Jarno 4 participants 5 messages Sep 20, 2006

lore
Share & tools
lore
#0 lore raw

Hi all,

I have successully installed a Debian Etch for Sparc under qemu (CVS version), and successfully updated it to unstable. Everything seems to work correctly, the performances are ok, but I have remarked than qemu-system-sparc is using all the CPU on the host system, while the sparc target system is idle. Maybe the problem is in the sparc kernel? I am using the one from unstable, ie a 2.6.17 kernel.

Any idea?

Thanks,
Aurelien

Signature · 4 lines
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [email protected]         | [email protected]
   `-    people.debian.org/~aurel32 | www.aurel32.net
#1 lore raw

I've seen this same behaviour with 2.4.x and 2.6.x kernels.

Quoted 26 lines · Aurelien Jarno

Hi all,

I have successully installed a Debian Etch for Sparc under qemu (CVS version), and successfully updated it to unstable. Everything seems to work correctly, the performances are ok, but I have remarked than qemu-system-sparc is using all the CPU on the host system, while the sparc target system is idle. Maybe the problem is in the sparc kernel? I am using the one from unstable, ie a 2.6.17 kernel.

Any idea?

Thanks,
Aurelien

--

   .''`.  Aurelien Jarno                    | GPG: 1024D/F1BCDB73
  : :' :  Debian developer           | Electrical Engineer
  `. `'   [email protected]         | [email protected]
    `-    people.debian.org/~aurel32 | www.aurel32.net

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

Signature · 4 lines
22:38 <@WaxDragon> false ^ true
22:39 < false> :(
22:39 < false> dont you think you can XOR me and get away with it! I
always return!
#2 lore raw
In reply to Aurelien Jarno
Quoted 8 lines · Aurelien Jarno

Hi all,

I have successully installed a Debian Etch for Sparc under qemu (CVS version), and successfully updated it to unstable. Everything seems to work correctly, the performances are ok, but I have remarked than qemu-system-sparc is using all the CPU on the host system, while the sparc target system is idle. Maybe the problem is in the sparc kernel? I am using the one from unstable, ie a 2.6.17 kernel.

CPU suspend is not implemented for sparc guests.
Unlike most other targets, suspending the CPU is controlled by the system chipset, not by an instruction on the CPU. See slavio_misc.c

Paul

#3 lore raw

Re: [Qemu-devel] qemu-system-sparc uses all host cpu while targetsystem is idle

Quoted 3 lines

CPU suspend is not implemented for sparc guests.
Unlike most other targets, suspending the CPU is controlled by the system chipset, not by an instruction on the CPU. See slavio_misc.c

Suspending is disabled, because it crashes qemu. It can be tested by tweaking slavio_misc.c and renaming the device in OpenBIOS from xxxpower-management to power-management. I can't see why it should crash, the implementation is very straightforward. Or maybe halting the CPU should be delayed until the TB is finished executing and halt only from main loop?

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/

#4 lore raw

Re: [Qemu-devel] qemu-system-sparc uses all host cpu while targetsystem is idle

Quoted 10 lines · Blue Swirl
Quoted 3 lines

CPU suspend is not implemented for sparc guests.
Unlike most other targets, suspending the CPU is controlled by the system chipset, not by an instruction on the CPU. See slavio_misc.c

Suspending is disabled, because it crashes qemu. It can be tested by tweaking slavio_misc.c and renaming the device in OpenBIOS from xxxpower-management to power-management. I can't see why it should crash, the implementation is very straightforward. Or maybe halting the CPU should be delayed until the TB is finished executing and halt only from main loop?

Please find below a patch that "works". It is probably wrong as I wrote it by copying code from other architectures and trying until it works. Well I am however convinced of two things:
- "return EXCP_HALTED;" causes the crash. By removing this line qemu doesn't crash anymore, but the patch does not work as expected (freeze of the target).
- The interrupt should be cleared, if not the target freeze.

Now the host CPU is not used at 100% when the Sparc target is idle. I am using it for about one our with a Debian unstable, and I am writing this mail from this emulated system.

Ah yes, you aslo need to the trivial patch to openbios.

Bye,
Aurelien

Index: hw/slavio_misc.c
===================================================================
RCS file: /sources/qemu/qemu/hw/slavio_misc.c,v
retrieving revision 1.3

slavio_misc.c +1 -1
diff -u -r1.3 slavio_misc.c
@@ -123,7 +123,7 @@
 	break;
     case 0xa000000:
 	MISC_DPRINTF("Write power management %2.2x\n", val & 0xff);
-#if 0
+#if 1
         // XXX almost works
         cpu_interrupt(cpu_single_env, CPU_INTERRUPT_HALT);
 #endif

Index: cpu-exec.c
===================================================================
RCS file: /sources/qemu/qemu/cpu-exec.c,v
retrieving revision 1.84

cpu-exec.c +4 -2
diff -u -r1.84 cpu-exec.c
@@ -548,8 +548,10 @@
 			//do_interrupt(0, 0, 0, 0, 0);
 			env->interrupt_request &= ~CPU_INTERRUPT_TIMER;
 		    } else if (interrupt_request & CPU_INTERRUPT_HALT) {
-                        env1->halted = 1;
-                        return EXCP_HALTED;
+			env->interrupt_request &= ~CPU_INTERRUPT_HALT;
+			env->halted = 1;
+			env->exception_index = EXCP_HLT;
+			cpu_loop_exit();
                     }
 #elif defined(TARGET_ARM)
                     if (interrupt_request & CPU_INTERRUPT_FIQ
Signature · 4 lines
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [email protected]         | [email protected]
   `-    people.debian.org/~aurel32 | www.aurel32.net