Learn about Centmin Mod LEMP Stack today
Register Now

Bdver4 when should Zen2

Discussion in 'Bug Reports' started by tininho, Jul 10, 2020.

  1. tininho

    tininho Premium Member Premium Member

    100
    25
    28
    May 22, 2019
    Nordic
    Ratings:
    +68
    Local Time:
    11:56 AM
    When I upgrade PHP to 7.4.8 on Hetzner CPX21 VPS, I get "PHP compiled with CPU_MARCH=bdver4" when it should be CPU_MARCH=znver2?

    Only Kernel is upgraded to elrepo-ml (tried with default 3.10 as well, same result). Other system files are all Centminmod defaults.

    Code (Text):
    WPPLUGINS_ALL='n'
    
    VHOSTCTRL_CLOUDFLAREINC='y'
    
    ENABLEMOTD_CSFMSG='n'         # motd banner csf message alert disaply
    ENABLEMOTD_LINKSMSG='n'       # motd centminmod.com links bookmark alert display
    DISABLE_IPVSIX='y'
    
    AUTOTUNE_CLIENTMAXBODY='y'
    
    ## FOR PHP 7.4+
    FPM_WAKEUP_PATCH='y'
    
    AUTODETECPHP_OVERRIDE='y'
    
    
    ##For Linux Kernel  > 5.1.x
    #NGINX_IOURING_PATCH_BETA='y'
    
    ##Upgrading NGINX. Disable, if custom configs
    NGINX_ALLOWOVERRIDE='y'
    
    #NGINX_FATLTO_OBJECTS='n'        # enable -ffat-lto-objects flag for nginx builds - much slower compile times
    #NGINX_NOFATLTO_OBJECTS='n'      # enable -fno-fat-lto-objects flag for nginx builds - much slower compile times
    
    NGINX_DYNAMICTLS='y'
    NGINX_SSLCACHE_ALLOWOVERRIDE='y'
    NGXDYNAMIC_BROTLI='y'
    NGINX_LIBBROTLI='y'
    AUTOHARDTUNE_NGINXBACKLOG='y'
    
    MARIADB_INSTALLTENFOUR='y'
    SET_DEFAULT_MYSQLCHARSET='utf8mb4'
    
    LETSENCRYPT_DETECT='y'
    DUALCERTS='y'
    NGINX_HPACK='y'
    
    #GCC_FALIGN_FUNCTION='y'
    
    LIBRESSL_SWITCH='n'
    CLANG='n'
    DEVTOOLSETSIX='n'
    DEVTOOLSETSEVEN='n'
    DEVTOOLSETEIGHT='n'
    DEVTOOLSETNINE='y'
    NGINX_DEVTOOLSETGCC='y'
    GENERAL_DEVTOOLSETGCC='y'
    CRYPTO_DEVTOOLSETGCC='y'
    
    CUSTOM_CURLRPM='y'
    CUSTOM_CURLRPMVER='7.69.0'       # custom curl/libcurl version
    
    PHP_PGO='y'
    
    #PHPPGO_INDEXPATH='/home/nginx/domains/XX/public/index.php'
    #PHPPGO_INDEXPATH_TWO='/home/nginx/domains/XX/public/index.php'
    
    PHP_TUNING='y'
    
    PHP_BROTLI='y'
    PHP_LZFOUR='y'
    PHP_LZF='y'
    PHP_ZSTD='y'
    PHPFINFO='y'
    
    PHP_MEMCACHE='n'
    PHP_MEMCACHED='n'
    
    ZSTD_LOGROTATE_NGINX='y'
    ZSTD_LOGROTATE_PHPFPM='y'
    
    PHP_MEMCACHE='n'
    PHP_MEMCACHED='n'
    
    MEMCACHED_INSTALL='n'
    NSD_INSTALL='n'
    MEMCACHED_DISABLED='y'
    NSD_DISABLED='y'
    MARCH_TARGETNATIVE_ALWAYS='y'
    PHPREDIS='n'
    NGINX_HTTPREDIS='n'
    
    PHPFINFO='y'
    WP_FASTCGI_CACHE='y'
    NGINX_ZERODT='y'
    PHP_UPDATEMAINTENANCE='y'
    MARIADB_UPDATEMAINTENANCE='y'
    



    php_upgrade_log
     
    Last edited: Jul 14, 2020
  2. eva2000

    eva2000 Administrator Staff Member

    44,780
    10,212
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,828
    Local Time:
    6:56 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    For KVM VPS or virtualized, the cpu march detected is whatever one, your web host configures the KVM VPS host node for and isn't necessarily the same as the actual cpu. They can for instance configure the lowest common march for a particular family for various reasons i.e. they have a mix of several generations of cpus across all VPS host node servers but have a common KVM OS template, so they need to configure KVM VPS for the lowest/oldest cpu in the family.

    That is probably what is going on here. But the other reason is GCC 9 is too old to detect AMD EPYC 2 cpus and may need to wait for GCC 10+ compiler. But GCC 9 is meant to support znver2 AMD Zen 2 CPU Support Merged To GCC 9 (-march=znver2) - Phoronix

    You can verify by using a newer GCC compiler to see if it's detected i.e. GCC 9+ via command below
    Code (Text):
    /opt/rh/devtoolset-9/root/usr/bin/gcc -c -Q -march=native --help=target 2>&1 | grep '\-march'

    and output for
    Code (Text):
    lscpu

    and output for
    Code (Text):
    cat /proc/cpuinfo

    Currently Centmin Mod 123.09beta01 and newer PHP routlines will set znver2 when GCC compiler march native check returns znver2 and certain cpu vendor id is detected i.e. AuthenticAMD vendor id is detected + 64bit cpu + GCC compiler march returns znver2

    i.e.
    Code (Text):
    lscpu
    Architecture:          x86_64
    CPU op-mode(s):        32-bit, 64-bit
    Byte Order:            Little Endian
    CPU(s):                48
    On-line CPU(s) list:   0-47
    Thread(s) per core:    2
    Core(s) per socket:    24
    Socket(s):             1
    NUMA node(s):          1
    Vendor ID:             AuthenticAMD
    CPU family:            23
    Model:                 49
    Model name:            AMD EPYC 7402 24-Core Processor
    Stepping:              0
    CPU MHz:               1500.000
    CPU max MHz:           2800.0000
    CPU min MHz:           1500.0000
    BogoMIPS:              5599.94
    Virtualization:        AMD-V
    L1d cache:             32K
    L1i cache:             32K
    L2 cache:              512K
    L3 cache:              16384K
    NUMA node0 CPU(s):     0-47
    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 fxsr_opt pdpe1gb rdtscp lm constant_tsc art rep_good nopl xtopology nonstop_tsc extd_apicid aperfmperf eagerfpu 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 misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_l2 cpb cat_l3 cdp_l3 hw_pstate sme retpoline_amd ssbd ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif umip overflow_recov succor smca
    
     
    Last edited: Jul 11, 2020
  3. eva2000

    eva2000 Administrator Staff Member

    44,780
    10,212
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,828
    Local Time:
    6:56 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Another check to do is with command
    Code (Text):
    /opt/rh/devtoolset-9/root/usr/bin/gcc --target-help | grep -A40 'march=CPU'
    

    does seem znver2 is a valid march for GCC 9 via devtoolset-9 but whether it detects your AMD cpu as such depends on above mentioned factors too
    Code (Text):
    /opt/rh/devtoolset-9/root/usr/bin/gcc --target-help | grep -A40 'march=CPU' 
      -march=CPU[,+EXTENSION...]
                              generate code for CPU and EXTENSION, CPU is one of:
                               generic32, generic64, i386, i486, i586, i686,
                               pentium, pentiumpro, pentiumii, pentiumiii, pentium4,
                               prescott, nocona, core, core2, corei7, l1om, k1om,
                               iamcu, k6, k6_2, athlon, opteron, k8, amdfam10,
                               bdver1, bdver2, bdver3, bdver4, znver1, znver2,
                               btver1, btver2
                              EXTENSION is combination of:
                               8087, 287, 387, 687, cmov, fxsr, mmx, sse, sse2,
                               sse3, ssse3, sse4.1, sse4.2, sse4, avx, avx2,
                               avx512f, avx512cd, avx512er, avx512pf, avx512dq,
                               avx512bw, avx512vl, vmx, vmfunc, smx, xsave,
                               xsaveopt, xsavec, xsaves, aes, pclmul, fsgsbase,
                               rdrnd, f16c, bmi2, fma, fma4, xop, lwp, movbe, cx16,
                               ept, lzcnt, hle, rtm, invpcid, clflush, nop, syscall,
                               rdtscp, 3dnow, 3dnowa, padlock, svme, sse4a, abm,
                               bmi, tbm, adx, rdseed, prfchw, smap, mpx, sha,
                               clflushopt, prefetchwt1, se1, clwb, avx512ifma,
                               avx512vbmi, avx512_4fmaps, avx512_4vnniw,
                               avx512_vpopcntdq, avx512_vbmi2, avx512_vnni,
                               avx512_bitalg, clzero, mwaitx, ospke, rdpid, ptwrite,
                               ibt, shstk, gfni, vaes, vpclmulqdq, wbnoinvd,
                               pconfig, waitpkg, cldemote, movdiri, movdir64b, no87,
                               no287, no387, no687, nocmov, nofxsr, nommx, nosse,
                               nosse2, nosse3, nossse3, nosse4.1, nosse4.2, nosse4,
                               noavx, noavx2, noavx512f, noavx512cd, noavx512er,
                               noavx512pf, noavx512dq, noavx512bw, noavx512vl,
                               noavx512ifma, noavx512vbmi, noavx512_4fmaps,
                               noavx512_4vnniw, noavx512_vpopcntdq, noavx512_vbmi2,
                               noavx512_vnni, noavx512_bitalg, noibt, noshstk,
                               nomovdiri, nomovdir64b
      -mtune=CPU              optimize for CPU, CPU is one of:
                               generic32, generic64, i8086, i186, i286, i386, i486,
                               i586, i686, pentium, pentiumpro, pentiumii,
                               pentiumiii, pentium4, prescott, nocona, core, core2,
                               corei7, l1om, k1om, iamcu, k6, k6_2, athlon, opteron,
                               k8, amdfam10, bdver1, bdver2, bdver3, bdver4, znver1,
                               znver2, btver1, btver2
      -msse2avx               encode SSE instructions with VEX prefix
      -msse-check=[none|error|warning] (default: warning)
    
     
  4. eva2000

    eva2000 Administrator Staff Member

    44,780
    10,212
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,828
    Local Time:
    6:56 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    My packet.net AMD EPYC 2 Rome 7402 bare metal server reported bdver4 incorrect march target with GCC 8.3 as 8.x didn't support znver2.

    But my BuyVM KVM VPS with Ryzen 3900X reports znver2 with devtoolset-9 GCC 9
    Code (Text):
    /opt/rh/devtoolset-9/root/usr/bin/gcc -c -Q -march=native --help=target 2>&1 | grep '\-march'
      -march=                               znver2
    

    Code (Text):
    lscpu
    Architecture:          x86_64
    CPU op-mode(s):        32-bit, 64-bit
    Byte Order:            Little Endian
    CPU(s):                1
    On-line CPU(s) list:   0
    Thread(s) per core:    1
    Core(s) per socket:    1
    Socket(s):             1
    NUMA node(s):          1
    Vendor ID:             AuthenticAMD
    CPU family:            23
    Model:                 113
    Model name:            AMD Ryzen 9 3900X 12-Core Processor
    Stepping:              0
    CPU MHz:               3792.872
    BogoMIPS:              7585.74
    Virtualization:        AMD-V
    Hypervisor vendor:     Microsoft
    Virtualization type:   full
    L1d cache:             64K
    L1i cache:             64K
    L2 cache:              512K
    L3 cache:              16384K
    NUMA node0 CPU(s):     0
    Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm art rep_good nopl extd_apicid eagerfpu pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy svm cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw perfctr_core retpoline_amd ssbd ibpb vmmcall fsgsbase tsc_adjust bmi1 avx2 smep bmi2 rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 arat npt nrip_save umip
    

    Code (Text):
    cat /proc/cpuinfo
    processor       : 0
    vendor_id       : AuthenticAMD
    cpu family      : 23
    model           : 113
    model name      : AMD Ryzen 9 3900X 12-Core Processor
    stepping        : 0
    microcode       : 0x1000065
    cpu MHz         : 3792.872
    cache size      : 512 KB
    physical id     : 0
    siblings        : 1
    core id         : 0
    cpu cores       : 1
    apicid          : 0
    initial apicid  : 0
    fpu             : yes
    fpu_exception   : yes
    cpuid level     : 13
    wp              : yes
    flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm art rep_good nopl extd_apicid eagerfpu pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy svm cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw perfctr_core retpoline_amd ssbd ibpb vmmcall fsgsbase tsc_adjust bmi1 avx2 smep bmi2 rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 arat npt nrip_save umip
    bogomips        : 7585.74
    TLB size        : 1024 4K pages
    clflush size    : 64
    cache_alignment : 64
    address sizes   : 40 bits physical, 48 bits virtual
    power management:
    

    Code (Text):
    /opt/rh/devtoolset-9/root/usr/bin/gcc -c -Q -march=native --help=target | egrep '\-mtune|\-mprefer-vector-width|\-march|\-msse|\-msse2|\-msse2avx|\-msse3|\-mavx|\-msse4|\-mssse3|\-mpclmul'
      -march=                               znver2
      -mavx                                 [enabled]
      -mavx2                                [enabled]
      -mavx256-split-unaligned-load         [disabled]
      -mavx256-split-unaligned-store        [disabled]
      -mavx5124fmaps                        [disabled]
      -mavx5124vnniw                        [disabled]
      -mavx512bitalg                        [disabled]
      -mavx512bw                            [disabled]
      -mavx512cd                            [disabled]
      -mavx512dq                            [disabled]
      -mavx512er                            [disabled]
      -mavx512f                             [disabled]
      -mavx512ifma                          [disabled]
      -mavx512pf                            [disabled]
      -mavx512vbmi                          [disabled]
      -mavx512vbmi2                         [disabled]
      -mavx512vl                            [disabled]
      -mavx512vnni                          [disabled]
      -mavx512vpopcntdq                     [disabled]
      -mpclmul                              [enabled]
      -mprefer-vector-width=                none
      -msse                                 [enabled]
      -msse2                                [enabled]
      -msse2avx                             [disabled]
      -msse3                                [enabled]
      -msse4                                [enabled]
      -msse4.1                              [enabled]
      -msse4.2                              [enabled]
      -msse4a                               [enabled]
      -msse5                     
      -msseregparm                          [disabled]
      -mssse3                               [enabled]
      -mtune-ctrl=               
      -mtune=                               znver2
      Known preferred register vector length (to use with the -mprefer-vector-width= option):
      Known valid arguments for -march= option:
      Known valid arguments for -mtune= option:
    

    So most likely Hetzner's AMD EPYC servers aren't configured to expose znver2 march when GCC 9 checks native march support for znver2
     
  5. tininho

    tininho Premium Member Premium Member

    100
    25
    28
    May 22, 2019
    Nordic
    Ratings:
    +68
    Local Time:
    11:56 AM
    Code:
    lscpu
    Architecture:          x86_64
    CPU op-mode(s):        32-bit, 64-bit
    Byte Order:            Little Endian
    CPU(s):                4
    On-line CPU(s) list:   0-3
    Thread(s) per core:    1
    Core(s) per socket:    4
    Socket(s):             1
    NUMA node(s):          1
    Vendor ID:             AuthenticAMD
    CPU family:            23
    Model:                 1
    Model name:            AMD EPYC Processor (with IBPB)
    Stepping:              2
    CPU MHz:               2495.312
    BogoMIPS:              4990.62
    Hypervisor vendor:     KVM
    Virtualization type:   full
    L1d cache:             32K
    L1i cache:             64K
    L2 cache:              512K
    L3 cache:              8192K
    NUMA node0 CPU(s):     0-3
    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 fxsr_opt pdpe1gb rdtscp lm rep_good nopl cpuid extd_apicid tsc_known_freq pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 arat
    Yes, it's just like you said. And this applies to Linode's AMD Epyc instances as well.

    So not a bug.
     
  6. eva2000

    eva2000 Administrator Staff Member

    44,780
    10,212
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,828
    Local Time:
    6:56 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Yeah the more cpu models you have in the VPS host node mix, then the more likelihood that the web host configures the lower common denominated cpu model for their KVM configuration. Might contact Linode to see if it's something they can work on i.e. as separate AMD EPYC Linode plan line with exposed znver2 march to KVM guest VPS servers.
     
  7. tininho

    tininho Premium Member Premium Member

    100
    25
    28
    May 22, 2019
    Nordic
    Ratings:
    +68
    Local Time:
    11:56 AM
    I mailed Hetzner for the same reason. So far no big hosting provider offers real Zen2 for VPS..
    VPS Plans by CPU Model
     
  8. tininho

    tininho Premium Member Premium Member

    100
    25
    28
    May 22, 2019
    Nordic
    Ratings:
    +68
    Local Time:
    11:56 AM
    Last edited: Jul 14, 2020
  9. eva2000

    eva2000 Administrator Staff Member

    44,780
    10,212
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,828
    Local Time:
    6:56 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
  10. tininho

    tininho Premium Member Premium Member

    100
    25
    28
    May 22, 2019
    Nordic
    Ratings:
    +68
    Local Time:
    11:56 AM
    Hetzner:

     
  11. eva2000

    eva2000 Administrator Staff Member

    44,780
    10,212
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,828
    Local Time:
    6:56 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Sweet that is surprisingly fast action on Hetzner's end eventually :) Helps they reserved a particular VPS plan to only AMD EPYC Rome :)
     
  12. tininho

    tininho Premium Member Premium Member

    100
    25
    28
    May 22, 2019
    Nordic
    Ratings:
    +68
    Local Time:
    11:56 AM
    Hetzner reacted swiftly - testing with the forthcoming znver2 activated on a Amd Epyc Rome 2 VPS (CPX-line):
    Code:
    /opt/rh/devtoolset-9/root/usr/bin/gcc -c -Q -march=native --help=target 2>&1 | grep '\-march'
      -march=                               znver2
     
  13. eva2000

    eva2000 Administrator Staff Member

    44,780
    10,212
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,828
    Local Time:
    6:56 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    excellent news there ! Thanks for keeping us informed :D