Messages in this thread Patch in this message | | | Date | Mon, 2 Jun 1997 13:24:20 +0200 (MEST) | From | Bernhard Kaindl <> | Subject | [fix] for some (sched!) probs when simulating SMP on single CPU |
| |
Systems : SMP kernels since 2.1.34(bleeding edge) running in UP mode, Fix for file: arch/i386/kernel/smp.c
During the very long weekend I researched a bug on my uniprocessor machine, running SMP kernels 2.1.34 to 2.1.41 in APIC emulation mode. (should also be in 2.1.42, but my machine is still compiling the kernel)
I noticed that the proccess times(e.g. top) where not updated in this case, because the timer interrupt missed it. -> scheduling wasn't nice.
When emulating APIC's, the SMP kernel call the local timer interrupt within the normal timer interrupt, but for updating process times it needs the prof_multiplier of the CPU to be set, but it was not, because the APIC setup is not run in this mode.
Here is the fix I've come up with. Please mail me for details,
bye,
Bernhard
The patch is against 2.1.41-arch/i386/kernel/smp.c, but you should get it right on 2.1.42 also.
--- smp.c.bk Sun Jun 1 21:13:14 1997 +++ smp.c Mon Jun 2 00:10:19 1997 @@ -870,6 +870,8 @@ *((volatile unsigned long *)phys_to_virt(8192)) = 0; } +unsigned int prof_multiplier[NR_CPUS]; +unsigned int prof_counter[NR_CPUS]; /* * Cycle through the processors sending APIC IPI's to boot each. @@ -915,8 +917,15 @@ * of here now! */ - if (!smp_found_config) + if (!smp_found_config) { + /* + * For SMP-simulation on one CPU to work, we must initialize these + * values for the single CPU here: + */ + prof_counter[0] = prof_multiplier[0] = 1; + return; + } /* * Map the local APIC into kernel space @@ -1310,9 +1319,6 @@ * multiplier is 1 and it can be changed by writing the new multiplier * value into /proc/profile. */ - -unsigned int prof_multiplier[NR_CPUS]; -unsigned int prof_counter[NR_CPUS]; void smp_local_timer_interrupt(struct pt_regs * regs) { Made me a nice day,
Bernhard
-- Bernhard Kaindl | email: edv@bartelt.via.at Bartelt Labor- & Datentechnik | bkaindl@netway..at Neufeldweg 42 | phone: +43.316.475328 A-8010 Graz, Austria | fax: +43.316.475328-43
| |