Port-sparc archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
QEMU SMP idle
Hi,
I noticed when running QEMU with SMP that we only idle the first CPU via
the APC attachment (apc0). For example, with an emulated 2-way system,
qemu constantly uses around 100% of a host CPU and with a 4-way system,
300%. It's simple to have the all the emulated CPU's use the apc device
when idle. On real hardware, the apc device only exists on single CPU
systems, so (I guess that) QEMU is not quite emulating real hardware here,
but I think that's fine.
One thing that I'm not 100% sure about is running an MP kernel on a real
SS5 or SS4, but I think that it should be OK, as I just replace curcpu
with the iterator and there will only be 1 CPU there. Patch attached,
and I'll commit it shortly.
Regards,
Julian
PS. I was running:
qmeu-system-sparc -M SS-20 -m 448 -cpu TI SuperSparc 60 -smp 4
(plus a few other options for network and disks)
--
Index: src/sys/arch/sparc/dev/apc.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc/dev/apc.c,v
retrieving revision 1.2
diff -u -r1.2 apc.c
--- src/sys/arch/sparc/dev/apc.c 30 Dec 2019 22:13:46 -0000 1.2
+++ src/sys/arch/sparc/dev/apc.c 4 May 2025 16:48:35 -0000
@@ -73,6 +73,10 @@
{
struct sbus_attach_args *sa = aux;
struct apc_softc *sc = device_private(self);
+#ifdef MULTIPROCESSOR
+ struct cpu_info *cpi;
+ CPU_INFO_ITERATOR n;
+#endif
sc->sc_bt = sa->sa_bustag;
if (sbus_bus_map(sa->sa_bustag,
@@ -82,7 +86,13 @@
}
aprint_normal("\n");
apc = sc;
+#ifdef MULTIPROCESSOR
+ for (CPU_INFO_FOREACH(n, cpi)) {
+ cpi->idlespin = apc_cpu_sleep;
+ }
+#else
curcpu()->idlespin = apc_cpu_sleep;
+#endif
}
static void
Home |
Main Index |
Thread Index |
Old Index