Date: Sat, 28 Aug 2010 00:18:04 +0400 From: pluknet <pluknet@gmail.com> To: Andriy Gapon <avg@icyb.net.ua> Cc: freebsd-stable@freebsd.org, Jung-uk Kim <jkim@freebsd.org> Subject: Re: 8.1-PRERELEASE: CPU packages not detected correctly Message-ID: <AANLkTinYUz0V%2B2nSWBMYLf2fL8HnUQ-fvXT0q-5WY4bb@mail.gmail.com> In-Reply-To: <AANLkTi=hZC9gL2xF2oD9w5ApgZ11LyRf1WbE=3YZuHef@mail.gmail.com> References: <201007141414.o6EEEUx9014690@lurza.secnetix.de> <201007141755.04690.jkim@FreeBSD.org> <4C3FB73F.7070502@freebsd.org> <201007161147.56242.jkim@FreeBSD.org> <AANLkTikFdbVhMYd1tktfYehuAdqEVCDWaN=YbOG=c6xB@mail.gmail.com> <4C6D5E31.9000701@icyb.net.ua> <AANLkTi=hZC9gL2xF2oD9w5ApgZ11LyRf1WbE=3YZuHef@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 19 August 2010 20:56, pluknet <pluknet@gmail.com> wrote: > On 19 August 2010 20:39, Andriy Gapon <avg@icyb.net.ua> wrote: >> on 10/08/2010 19:55 pluknet said the following: >>> On 16 July 2010 19:47, Jung-uk Kim <jkim@freebsd.org> wrote: >>>> The patch should apply fine on both sys/amd64/amd64/mp_machdep.c and >>>> sys/i386/i386/mp_machdep.c. >>>> >>>> http://people.freebsd.org/~jkim/mp_machdep2.diff >>>> >>> >>> >>> Hi. >>> >>> Just checked on Xen HVM with 3 cores. >>> 1) 8.1 unmodified: >>> FreeBSD/SMP: Multiprocessor System Detected: 3 CPUs >>> FreeBSD/SMP: 1 package(s) x 3 core(s) >>> >>> 2) 8.1 + patch >>> FreeBSD/SMP: Multiprocessor System Detected: 3 CPUs >>> FreeBSD/SMP: 0 package(s) x 1 core(s) x 32 HTT threads >>> WARNING: Non-uniform processors. >>> WARNING: Using suboptimal topology. >> >> Can you debug, e.g. with printfs, what exactly goes wrong? >> I wonder if in this case code follows some unusual/unexpected path. > > Sorry, I'm a bit busy right now. > I hope to debug this somewhere in the next week. First, sorry for late replay, and thanks Andriy for kicking me ;) Something really weird there . topo_probe_0xb() falls early on 1st iteration back to topo_probe_0x4(). topo_probe_0x4() returns incorrect data as well. topo_probe: cpu_high =3D b topo_probe: cpu_vendor_id =3D 8086 topo_probe_0xb: i =3D 0, p[1] =3D 0 topo_probe_0x4: cpu_procinfo =3D 200800 topo_probe_0x4: cpu_logical =3D 32 topo_probe_0x4: i =3D 0, type =3D 1 topo_probe_0x4: i =3D 0, level =3D 1 topo_probe_0x4: i =3D 0, logical =3D 1 topo_probe_0x4: i =3D 0, cores =3D 16 topo_probe_0x4: i =3D 1, type =3D 2 topo_probe_0x4: i =3D 1, level =3D 1 topo_probe_0x4: i =3D 1, logical =3D 1 topo_probe_0x4: i =3D 1, cores =3D 16 topo_probe_0x4: i =3D 2, type =3D 3 topo_probe_0x4: i =3D 2, level =3D 2 topo_probe_0x4: i =3D 2, logical =3D 1 topo_probe_0x4: i =3D 2, cores =3D 16 topo_probe#1: mp_ncpus =3D 3 topo_probe#1: cpu_cores =3D 1 topo_probe#1: cpu_logical =3D 32 topo_probe#1: hyperthreading_cpus =3D 32 topo_probe#2: mp_ncpus =3D 3 topo_probe#2: cpu_cores =3D 1 topo_probe#2: cpu_logical =3D 32 topo_probe#2: hyperthreading_cpus =3D 32 %%% static void topo_probe_0x4(void) { u_int p[4]; int cores; int i; int level; int logical; int type; cpu_logical =3D (cpu_feature & CPUID_HTT) !=3D 0 ? (cpu_procinfo & CPUID_HTT_CORES) >> 16 : 1; printf("topo_probe_0x4: cpu_procinfo =3D %x\n", cpu_procinfo); printf("topo_probe_0x4: cpu_logical =3D %d\n", cpu_logical); if (cpu_logical =3D=3D 1) { cpu_cores =3D 1; return; } /* We only support three levels for now. */ for (i =3D 0; i < 3; i++) { cpuid_count(0x04, i, p); type =3D p[0] & 0x1f; printf("topo_probe_0x4: i =3D %d, type =3D %d\n", i, type); level =3D (p[0] >> 5) & 0x7; printf("topo_probe_0x4: i =3D %d, level =3D %d\n", i, level= ); logical =3D ((p[0] >> 14) & 0xfff) + 1; printf("topo_probe_0x4: i =3D %d, logical =3D %d\n", i, log= ical); cores =3D ((p[0] >> 26) & 0x3f) + 1; printf("topo_probe_0x4: i =3D %d, cores =3D %d\n", i, cores= ); if (type =3D=3D 0) break; if (level =3D=3D 1 && cpu_logical =3D=3D logical * cores) { cpu_cores =3D cores; cpu_logical =3D logical; break; } } if (cpu_cores =3D=3D 0) cpu_cores =3D 1; if (cpu_logical > 1) hyperthreading_cpus =3D logical_cpus =3D cpu_logical; } static void topo_probe_0xb(void) { u_int p[4]; int bits; int cnt; int i; int logical; int type; int x; /* We only support three levels for now. */ for (i =3D 0; i < 3; i++) { cpuid_count(0x0b, i, p); /* * Fall back if it is not really supported. */ if (i =3D=3D 0 && p[1] =3D=3D 0) { printf("topo_probe_0xb: i =3D %d, p[1] =3D %d\n", i= , p[1]); topo_probe_0x4(); return; } [...] } static void topo_probe(void) { static int cpu_topo_probed =3D 0; if (cpu_topo_probed) return; printf("topo_probe: cpu_high =3D %x\n", cpu_high); printf("topo_probe: cpu_vendor_id =3D %x\n", cpu_vendor_id); logical_cpus =3D logical_cpus_mask =3D 0; if (cpu_vendor_id =3D=3D CPU_VENDOR_AMD) topo_probe_amd(); else if (cpu_vendor_id =3D=3D CPU_VENDOR_INTEL) { if (cpu_high >=3D 0xb) topo_probe_0xb(); else if (cpu_high >=3D 0x4) topo_probe_0x4(); } printf("topo_probe#1: mp_ncpus =3D %d\n", mp_ncpus); printf("topo_probe#1: cpu_cores =3D %d\n", cpu_cores); printf("topo_probe#1: cpu_logical =3D %d\n", cpu_logical); printf("topo_probe#1: hyperthreading_cpus =3D %d\n", hyperthreading= _cpus); if (cpu_cores =3D=3D 0) cpu_cores =3D mp_ncpus > 0 ? mp_ncpus : 1; if (cpu_logical =3D=3D 0) cpu_logical =3D 1; cpu_topo_probed =3D 1; printf("topo_probe#2: mp_ncpus =3D %d\n", mp_ncpus); printf("topo_probe#2: cpu_cores =3D %d\n", cpu_cores); printf("topo_probe#2: cpu_logical =3D %d\n", cpu_logical); printf("topo_probe#2: hyperthreading_cpus =3D %d\n", hyperthreading= _cpus); } > >> BTW, could you please also provide CPU name/model/features as detected b= y the kernel? > > Sure. > CPU: Intel(R) Xeon(R) CPU =A0 =A0 =A0 =A0 =A0 E5520 =A0@ 2.27GHz (2763.12= -MHz 686-class CPU) > =A0Origin =3D "GenuineIntel" =A0Id =3D 0x106a5 =A0Family =3D 6 =A0Model = =3D 1a =A0Stepping =3D 5 > =A0Features=3D0x1781fbbf<FPU,VME,DE,PSE,TSC,MSR,MCE,CX8,APIC,SEP,MTRR,PGE= ,MCA,CMOV,PAT,MMX,FXSR,SSE,SSE2,HTT> > =A0Features2=3D0x80982201<SSE3,SSSE3,CX16,SSE4.1,SSE4.2,POPCNT,<b31>> > =A0TSC: P-state invariant > real memory =A0=3D 4194304000 (4000 MB) > avail memory =3D 3932786688 (3750 MB) > ACPI APIC Table: <Xen HVM> > FreeBSD/SMP: Multiprocessor System Detected: 3 CPUs > FreeBSD/SMP: 0 package(s) x 1 core(s) x 32 HTT threads > =A0cpu0 (BSP): APIC ID: =A00 > =A0cpu1 (AP/HT): APIC ID: =A02 > =A0cpu2 (AP/HT): APIC ID: =A04 --=20 wbr, pluknet
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTinYUz0V%2B2nSWBMYLf2fL8HnUQ-fvXT0q-5WY4bb>