Date: Thu, 29 Jul 2010 02:50:08 GMT From: Joe Landers <jlanders@vmware.com> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/148698: [panic] Panic at boot due to integer overflow computing top->cg_mask in smp_topo_none() when mp_ncpus == 32 Message-ID: <201007290250.o6T2o83B000507@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/148698; it has been noted by GNATS. From: Joe Landers <jlanders@vmware.com> To: "bug-followup@FreeBSD.org" <bug-followup@FreeBSD.org>, Joe Landers <jlanders@vmware.com> Cc: Subject: Re: kern/148698: [panic] Panic at boot due to integer overflow computing top->cg_mask in smp_topo_none() when mp_ncpus == 32 Date: Wed, 28 Jul 2010 19:26:19 -0700 We understand that > 32 CPUs isn't possible with the current code structure= . However, it is trivial to make the case of mp_ncpus =3D=3D 32 work. Assuming no error checking, simply change the computation of top->cg_mask f= rom: top->cg_mask =3D (1 << mp_ncpus) - 1; to: top->cg_mask =3D ~0U >> (32 - mp_ncpus); in subr_smp.c:smp_topo_none(). FreeBSD will then boot fine with 32 or fewer CPUs: ... FreeBSD/SMP: Multiprocessor System Detected: 32 CPUs FreeBSD/SMP: 32 package(s) x 1 core(s) cpu0 (BSP): APIC ID: 0 cpu1 (AP): APIC ID: 1 cpu2 (AP): APIC ID: 2 cpu3 (AP): APIC ID: 3 cpu4 (AP): APIC ID: 4 cpu5 (AP): APIC ID: 5 cpu6 (AP): APIC ID: 6 cpu7 (AP): APIC ID: 7 cpu8 (AP): APIC ID: 8 cpu9 (AP): APIC ID: 9 cpu10 (AP): APIC ID: 10 cpu11 (AP): APIC ID: 11 cpu12 (AP): APIC ID: 12 cpu13 (AP): APIC ID: 13 cpu14 (AP): APIC ID: 14 cpu15 (AP): APIC ID: 15 cpu16 (AP): APIC ID: 16 cpu17 (AP): APIC ID: 17 cpu18 (AP): APIC ID: 18 cpu19 (AP): APIC ID: 19 cpu20 (AP): APIC ID: 20 cpu21 (AP): APIC ID: 21 cpu22 (AP): APIC ID: 22 cpu23 (AP): APIC ID: 23 cpu24 (AP): APIC ID: 24 cpu25 (AP): APIC ID: 25 cpu26 (AP): APIC ID: 26 cpu27 (AP): APIC ID: 27 cpu28 (AP): APIC ID: 28 cpu29 (AP): APIC ID: 29 cpu30 (AP): APIC ID: 30 cpu31 (AP): APIC ID: 31 ioapic0: Changing APIC ID to 32 ... SMP: AP CPU #28 Launched! SMP: AP CPU #27 Launched! SMP: AP CPU #1 Launched! SMP: AP CPU #2 Launched! SMP: AP CPU #31 Launched! SMP: AP CPU #3 Launched! SMP: AP CPU #13 Launched! SMP: AP CPU #23 Launched! SMP: AP CPU #4 Launched! SMP: AP CPU #9 Launched! SMP: AP CPU #20 Launched! SMP: AP CPU #21 Launched! SMP: AP CPU #5 Launched! SMP: AP CPU #12 Launched! SMP: AP CPU #15 Launched! SMP: AP CPU #16 Launched! SMP: AP CPU #7 Launched! SMP: AP CPU #26 Launched! SMP: AP CPU #29 Launched! SMP: AP CPU #17 Launched! SMP: AP CPU #25 Launched! SMP: AP CPU #6 Launched! SMP: AP CPU #11 Launched! SMP: AP CPU #19 Launched! SMP: AP CPU #14 Launched! SMP: AP CPU #18 Launched! SMP: AP CPU #22 Launched! SMP: AP CPU #10 Launched! SMP: AP CPU #24 Launched! SMP: AP CPU #8 Launched! SMP: AP CPU #30 Launched! ... We verified this fix on both physical and virtual hardware. Thanks, Joe Landers jlanders@vmware.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007290250.o6T2o83B000507>