Il 10 aprile 2012 00:09, Marius Strobl <mar...@alchemy.franken.de> ha scritto: > On Mon, Apr 09, 2012 at 10:41:19PM +0000, Attilio Rao wrote: >> Author: attilio >> Date: Mon Apr 9 22:41:19 2012 >> New Revision: 234074 >> URL: http://svn.freebsd.org/changeset/base/234074 >> >> Log: >> BSP is not added to the mask of valid target CPUs for interrupts >> in set_apic_interrupt_ids(). Besides, set_apic_interrupts_ids() is not >> called in the !SMP case too. >> Fix this by: >> - Adding the BSP as an interrupt target directly in cpu_startup(). >> - Remove an obsolete optimization where the BSP are skipped in >> set_apic_interrupt_ids(). >> >> Reported by: jh >> Reviewed by: jhb >> MFC after: 3 days >> X-MFC: r233961 >> Pointy hat to: me >> >> Modified: >> head/sys/amd64/amd64/machdep.c >> head/sys/amd64/amd64/mp_machdep.c >> head/sys/i386/i386/machdep.c >> head/sys/i386/i386/mp_machdep.c >> >> Modified: head/sys/amd64/amd64/machdep.c >> ============================================================================== >> --- head/sys/amd64/amd64/machdep.c Mon Apr 9 22:01:43 2012 >> (r234073) >> +++ head/sys/amd64/amd64/machdep.c Mon Apr 9 22:41:19 2012 >> (r234074) >> @@ -295,6 +295,11 @@ cpu_startup(dummy) >> vm_pager_bufferinit(); >> >> cpu_setregs(); >> + >> + /* >> + * Add BSP as an interrupt target. >> + */ >> + intr_add_cpu(0); >> } > > If I'm not mistaken, intr_add_cpu() is under #ifdef SMP, so it should be > here as well.
You are right, sorry, I did forgot to test without SMP. I think we still need intr_add_cpu() on cpu_startup() because of the case smp_disabled = 1. I think the attached patch should make its dirty job, opinion? Thanks, Attilio Index: sys/i386/include/intr_machdep.h =================================================================== --- sys/i386/include/intr_machdep.h (revisione 234073) +++ sys/i386/include/intr_machdep.h (copia locale) @@ -131,9 +131,7 @@ int elcr_probe(void); enum intr_trigger elcr_read_trigger(u_int irq); void elcr_resume(void); void elcr_write_trigger(u_int irq, enum intr_trigger trigger); -#ifdef SMP void intr_add_cpu(u_int cpu); -#endif int intr_add_handler(const char *name, int vector, driver_filter_t filter, driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep); #ifdef SMP Index: sys/amd64/include/intr_machdep.h =================================================================== --- sys/amd64/include/intr_machdep.h (revisione 234073) +++ sys/amd64/include/intr_machdep.h (copia locale) @@ -140,9 +140,7 @@ int elcr_probe(void); enum intr_trigger elcr_read_trigger(u_int irq); void elcr_resume(void); void elcr_write_trigger(u_int irq, enum intr_trigger trigger); -#ifdef SMP void intr_add_cpu(u_int cpu); -#endif int intr_add_handler(const char *name, int vector, driver_filter_t filter, driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep); Index: sys/x86/x86/intr_machdep.c =================================================================== --- sys/x86/x86/intr_machdep.c (revisione 234073) +++ sys/x86/x86/intr_machdep.c (copia locale) @@ -446,16 +446,34 @@ DB_SHOW_COMMAND(irqs, db_show_irqs) } #endif -#ifdef SMP /* * Support for balancing interrupt sources across CPUs. For now we just * allocate CPUs round-robin. */ static cpuset_t intr_cpus; +#ifdef SMP static int current_cpu; +#endif /* + * Add a CPU to our mask of valid CPUs that can be destinations of + * interrupts. + */ +void +intr_add_cpu(u_int cpu) +{ + + if (cpu >= MAXCPU) + panic("%s: Invalid CPU ID", __func__); + if (bootverbose) + printf("INTR: Adding CPU %u as a target\n", cpu); + + CPU_SET(cpu, &intr_cpus); +} + +#ifdef SMP +/* * Return the CPU that the next interrupt source should use. For now * this just returns the next local APIC according to round-robin. */ @@ -492,23 +510,6 @@ intr_bind(u_int vector, u_char cpu) } /* - * Add a CPU to our mask of valid CPUs that can be destinations of - * interrupts. - */ -void -intr_add_cpu(u_int cpu) -{ - - if (cpu >= MAXCPU) - panic("%s: Invalid CPU ID", __func__); - if (bootverbose) - printf("INTR: Adding local APIC %d as a target\n", - cpu_apic_ids[cpu]); - - CPU_SET(cpu, &intr_cpus); -} - -/* * Distribute all the interrupt sources among the available CPUs once the * AP's have been launched. */ _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"