[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#960150: gdc-10 / libphobos 2.76 core.cpuid.{cores,threads}PerCPU() returns wrong value



Package: gdc-10
Version: 10.1.0-1
Severity: normal

Dear Maintainer,

====
import std.stdio;
import core.cpuid;
void main() {
  writefln("CPU: threads_per_cpu=%d; cores_per_cpu=%d; ht=%s; processor=%s",
           threadsPerCPU(), coresPerCPU(), hyperThreading(), processor());
}
====


# Using gdc-10 (10.1.0-1) and ligphobos1 (10.1.0-1)
CPU: threads_per_cpu=1; cores_per_cpu=32; ht=false; processor=AMD Ryzen Threadripper 2950X 16-Core Processor 

# Using ldc (1:1.20.1-1) and libphobos2-ldc-shared-dev (= 1:1.20.1-1):
CPU: threads_per_cpu=32; cores_per_cpu=16; ht=true; processor=AMD Ryzen Threadripper 2950X 16-Core Processor 


As can be seen gdc-10 (and gdc-9 too) returns wrong values.

I tried various optimization options, different -mcpu, static phobos
linking, etc. and they don't change it.

I am running on a bare hardware (no kvm, Xen or qemu involved) with
kernel Linux 5.2.17.


For reference:

$ lscpu
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
Address sizes:                   43 bits physical, 48 bits virtual
CPU(s):                          32
On-line CPU(s) list:             0-31
Thread(s) per core:              2
Core(s) per socket:              16
Socket(s):                       1
NUMA node(s):                    2
Vendor ID:                       AuthenticAMD
CPU family:                      23
Model:                           8
Model name:                      AMD Ryzen Threadripper 2950X 16-Core Processor
Stepping:                        2
Frequency boost:                 enabled
CPU MHz:                         2431.075
CPU max MHz:                     3500.0000
CPU min MHz:                     2200.0000
BogoMIPS:                        6999.26
Virtualization:                  AMD-V
L1d cache:                       512 KiB
L1i cache:                       1 MiB
L2 cache:                        8 MiB
L3 cache:                        32 MiB
NUMA node0 CPU(s):               0-7,16-23
NUMA node1 CPU(s):               8-15,24-31
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and s
                                 eccomp
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanit
                                 ization
Vulnerability Spectre v2:        Mitigation; Full AMD retpoline, IBPB conditional, STIBP disab
                                 led, RSB filling
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
                                  pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxs
                                 r_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_ts
                                 c cpuid extd_apicid amd_dcm aperfmperf pni pclmulqdq monitor 
                                 ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c 
                                 rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a mi
                                 salignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_c
                                 ore perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate sme ssb
                                 d sev ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx sm
                                 ap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero ir
                                 perf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vm
                                 cb_clean flushbyasid decodeassists pausefilter pfthreshold av
                                 ic v_vmsave_vmload vgif overflow_recov succor smca
$

$ numactl -s
policy: default
preferred node: current
physcpubind: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 
cpubind: 0 1 
nodebind: 0 1 
membind: 0 1 
$

$ numactl --hardware
available: 2 nodes (0-1)
node 0 cpus: 0 1 2 3 4 5 6 7 16 17 18 19 20 21 22 23
node 0 size: 64371 MB
node 0 free: 15527 MB
node 1 cpus: 8 9 10 11 12 13 14 15 24 25 26 27 28 29 30 31
node 1 size: 64497 MB
node 1 free: 678 MB
node distances:
node   0   1 
  0:  10  16 
  1:  16  10 
$

$ nproc
32
$

$ getconf  -a | grep PROCESSORS
_NPROCESSORS_CONF                  32
_NPROCESSORS_ONLN                  32
$

$ cpuid
CPU 0:
   vendor_id = "AuthenticAMD"
   version information (1/eax):
      processor type  = primary processor (0)
      family          = 0xf (15)
      model           = 0x8 (8)
      stepping id     = 0x2 (2)
      extended family = 0x8 (8)
      extended model  = 0x0 (0)
      (family synth)  = 0x17 (23)
      (model synth)   = 0x8 (8)
      (simple synth)  = AMD Ryzen (Pinnacle Ridge PiR-B2) [Zen+], 12nm
   miscellaneous (1/ebx):
      process local APIC physical ID = 0x0 (0)
      cpu count                      = 0x20 (32)             // <-----
      CLFLUSH line size              = 0x8 (8)
      brand index                    = 0x0 (0)
   brand id = 0x00 (0): unknown
   feature information (1/edx):
      ...
      hyper-threading / multi-core supported = true          // <-----
      ...
   feature information (1/ecx):
...
...
$

$ cpuid  | grep ^CPU | wc -l
32
$

$ /proc/cpuinfo flags:
flags		: ..... sse2 ht .....
$


Regards,
Witold

-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable'), (1, 'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.2.0-3-amd64 (SMP w/32 CPU cores)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages gdc-10 depends on:
ii  g++-10             10.1.0-1
ii  gcc-10-base        10.1.0-1
ii  libc6              2.30-7
ii  libgmp10           2:6.2.0+dfsg-4
ii  libgphobos-10-dev  10.1.0-1
ii  libisl22           0.22.1-1
ii  libmpc3            1.1.0-1
ii  libmpfr6           4.0.2-1
ii  libzstd1           1.4.4+dfsg-3
ii  zlib1g             1:1.2.11.dfsg-2

gdc-10 recommends no packages.

gdc-10 suggests no packages.

-- no debconf information


Reply to: