Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Mar 2017 11:15:44 -0700 (PDT)
From:      Don Lewis <truckman@FreeBSD.org>
To:        avg@FreeBSD.org
Cc:        freebsd-amd64@FreeBSD.org
Subject:   Re: FreeBSD on Ryzen
Message-ID:  <201703231822.v2NIMp1e054314@gw.catspoiler.org>

next in thread | raw e-mail | index | archive | help
resending to the list ...

On 23 Mar, Andriy Gapon wrote:
> On 03/23/2017 06:05, Don Lewis wrote:
>> Package ID shift: 4
>> L3 cache ID shift: 3
>> L2 cache ID shift: 1
>> L1 cache ID shift: 1
>> Core ID shift: 0
>> INTR: Adding local APIC 1 as a target
>> INTR: Adding local APIC 2 as a target
>> INTR: Adding local APIC 3 as a target
>> INTR: Adding local APIC 4 as a target
>> INTR: Adding local APIC 5 as a target
>> INTR: Adding local APIC 6 as a target
>> INTR: Adding local APIC 7 as a target
>> INTR: Adding local APIC 8 as a target
>> INTR: Adding local APIC 9 as a target
>> INTR: Adding local APIC 10 as a target
>> INTR: Adding local APIC 11 as a target
>> INTR: Adding local APIC 12 as a target
>> INTR: Adding local APIC 13 as a target
>> INTR: Adding local APIC 14 as a target
>> INTR: Adding local APIC 15 as a target
>> FreeBSD/SMP: Multiprocessor System Detected: 16 CPUs
>> FreeBSD/SMP: 1 package(s) x 16 core(s)
> 
> Don,
> 
> thank you!
> Could you please test this patch https://paste.debian.net/923675/ and
> see if it allows to detect SMT threads?

It took some doing since we don't have the AMDID2_NODE_ID code, but with
the patch applied, I do see SMT threads.

FreeBSD/SMP: Multiprocessor System Detected: 16 CPUs
FreeBSD/SMP: 1 package(s) x 8 core(s) x 2 hardware threads
Package HW ID = 0
        Core HW ID = 0
                CPU0 (BSP): APIC ID: 0
                CPU1 (AP/HT): APIC ID: 1
        Core HW ID = 1
                CPU2 (AP): APIC ID: 2
                CPU3 (AP/HT): APIC ID: 3
        Core HW ID = 2
                CPU4 (AP): APIC ID: 4
                CPU5 (AP/HT): APIC ID: 5
        Core HW ID = 3
                CPU6 (AP): APIC ID: 6
                CPU7 (AP/HT): APIC ID: 7
        Core HW ID = 4
                CPU8 (AP): APIC ID: 8
                CPU9 (AP/HT): APIC ID: 9
        Core HW ID = 5
                CPU10 (AP): APIC ID: 10
                CPU11 (AP/HT): APIC ID: 11
        Core HW ID = 6
                CPU12 (AP): APIC ID: 12
                CPU13 (AP/HT): APIC ID: 13
        Core HW ID = 7
                CPU14 (AP): APIC ID: 14
                CPU15 (AP/HT): APIC ID: 15

% sysctl kern.sched.topology_spec
kern.sched.topology_spec: <groups>
 <group level="1" cache-level="0">
  <cpu count="16" mask="ffff,0,0,0">0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15</cpu>
  <children>
   <group level="2" cache-level="3">
    <cpu count="8" mask="ff,0,0,0">0, 1, 2, 3, 4, 5, 6, 7</cpu>
    <children>
     <group level="3" cache-level="2">
      <cpu count="2" mask="3,0,0,0">0, 1</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
     <group level="3" cache-level="2">
      <cpu count="2" mask="c,0,0,0">2, 3</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
     <group level="3" cache-level="2">
      <cpu count="2" mask="30,0,0,0">4, 5</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
     <group level="3" cache-level="2">
      <cpu count="2" mask="c0,0,0,0">6, 7</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
    </children>
   </group>
   <group level="2" cache-level="3">
    <cpu count="8" mask="ff00,0,0,0">8, 9, 10, 11, 12, 13, 14, 15</cpu>
    <children>
     <group level="3" cache-level="2">
      <cpu count="2" mask="300,0,0,0">8, 9</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
     <group level="3" cache-level="2">
      <cpu count="2" mask="c00,0,0,0">10, 11</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
     <group level="3" cache-level="2">
      <cpu count="2" mask="3000,0,0,0">12, 13</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
     <group level="3" cache-level="2">
      <cpu count="2" mask="c000,0,0,0">14, 15</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
    </children>
   </group>
  </children>
 </group>
</groups>


BTW, with SMT disabled in the BIOS I see a 5% speed improvement in "make
-j8 buildworld" as compared to SMT enabled with the stock kernel.






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703231822.v2NIMp1e054314>