# FreeBSD doesn't support cpu turboboost



## Ofloo (May 13, 2018)

CPU:

```
CPU: Intel(R) Xeon(R) CPU E3-1265L v3 @ 2.50GHz (2500.05-MHz K8-class CPU)
```

It is the latest bios, .. and in the bios it is reported as 3100 rather then 3700 however FreeBSD only supports upto 2501?


----------



## abishai (May 13, 2018)

Turboboost is supported by CPU itself, +1 Mhz is a hint to CPU to use it.


----------



## Ofloo (May 13, 2018)

What exactly do you mean?

rc.conf:

```
powerd_enable="yes"
powerd_flags="-a hiadaptive -b minimum -n hiadaptive -m 2500 -M 3700 -i 30 -r 50 -p 100"
```


```
# sysctl dev.cpu.0.freq_levels
dev.cpu.0.freq_levels: 2501/45000 2500/45000 2400/42708 2300/40461 2100/36095 2000/33977 1900/31907 1800/29872 1600/25926 1500/24014 1400/22148 1300/20317 1200/18525 1000/15060 900/13385 800/11752
```

seems to me that it isn't supported.


----------



## abishai (May 13, 2018)

Ofloo said:


> What exactly do you mean?


I mean that turbo boost requires little support from OS. Attempt to request frequency higher than CPU supports interpreters as turbo boost request, that's why that 2501 exists.


----------



## abishai (May 13, 2018)

Actually, you don't have to believe me, you can count CPU cycles with
`kldload pmc`
`pmcstat -s unhalted-core-cycles -w 1`
Then load all cores with number of `yes > /dev/null` commands and see what happens with 2500 and with 2501


----------



## beckerg (Jun 24, 2020)

Thanks for the `pmcstat` tip!  Here's a refinement to make things more obvious.  Presuming you have at least six cores, use `cpuset` to affine the different commands to different cores:

`sudo cpuset -l5 pmcstat -s unhalted-core-cycles -w 1 2>&1 | sed -E 's/ {15}/ /g'`
`cpuset -l0 yes > /dev/null`

Curiously, I consistently see a higher boost on core 0 (3.49G) than on any other core (3.29G) on my X10DRi + E5-2690v3 rig.  More importantly, before I added the following to /boot/loader.conf I would never see a boost above 3.1G:

```
hint.apic.0.clock=0
hint.atrtc.0.clock=0
```

And apparently I also need the following in /etc/rc.conf in order to boost over 3.1G:

```
performance_cpu_freq="NONE"
performance_cx_lowest="LOW"
economy_cpu_freq="NONE"
economy_cx_lowest="LOW"
```


----------



## Mjölnir (Jun 24, 2020)

beckerg said:


> Thanks for the `pmcstat` tip!  Here's a refinement to make things more obvious.  Presuming you have at least six cores, use `cpuset` to affine the different commands to different cores:
> 
> `sudo cpuset -l5 pmcstat -s unhalted-core-cycles -w 1 2>&1 | sed -E 's/ {15}/ /g'`
> `cpuset -l0 yes > /dev/null`
> ...


THANK YOU VERY MUCH! You %*&#!$ made me so curious to produce a kernel dump by issueing `sudo pmcstat -s unhalted-core-cycles -w 1` on a 12.1-REL laptop! 
_This is meant ironically, but the crash is real.  Took >1 minute to write a minidump (3.5/12GB)_
Besides that, why don't you use`cpuset -l all`?


----------



## beckerg (Jun 24, 2020)

I am so sorry, I've used `pmcstat` quite a bit in the past and never seen a crash (although I vaguely recall it was wonky on AMD processors some six or seven years ago).  But always on server class machines, never tried it on a laptop.  You should definitely open a bug.

Anyway, I found the output of the `pmcstat` command to be unwieldy, so the `sed` command trims it down into manageable columns.  Regarding cpuset, I wanted to affine the `yes` command to a single core to so that it wasn't bouncing around between cores, making it much easier to see the impact...

For example, `yes` affined to core 0:

`$ sudo cpuset -l 5 pmcstat -s unhalted-core-cycles -w 1 2>&1 | sed -E -e 1d -e 's/ {15}/ /g'`


```
3474028811    90254872     1660105     1178391      757353     1154123      336475      905275      988859   100906507      331094     1343139
   3453580484   109896951     3293111     1683479      805901     1048177    40154343    39273167     1668235    13248847      509939     2452973
   3427515784     7148276     6013526   169761830    13079175     5772869     6145648     6617521    42756428     5212480    15067665     6458574
   3478412903      446569     1804973    13824373      984147     1206384      712884    16822268     1077741      425500     1310716   169979307
   3475027763     1379264     1665078     1529609     1438331      737815      972622      551855    77591791   122598480     1639236     1836901
   3483047164     1396920     1616834     1411969      636049     1520418     1598235    15703619   187730994     1812886      735751     2719895
   3468001464    15213857     1295998      494615     1345746      720952     1429654   103181673      471982    76591392      712543     1171020
   3466577339     2289021     1264953     1359863      692108      570183     1584620      608214   177971151    11386727    13444733     1622204
   3484906159     1727478     1188240     1198263   191481323      669411     1157325      701154      666785     1215916      792056      755810
```

And now `yes` affined to core 2:


```
272195273      332153  3479350259      777238     1593230      998757     1007001      487969      753392     1182435     1856548      959755
    144871519      731664  3294835216      273778      664827      961205      945279      610419      970046   188508270     1571452      357053
    149317072     2465404  3289234907     1850352    42589838      470706     2646538      945454     1227894   153648985     2387361      688197
    146426643      242522  3295584709     1138640   188263581      403405     1011106      611733      680076      423726     1485170      364120
    182414730     5063721  3264996395     5098084   170537049     8760258     5547601     5316092    23133576    16415013    34334105     4601020
    142463554     1796777  3294508250      522458      259298      603299     1477919     1857137      689867   199604741     1549785      780670
    144618958     1847341  3295497621     1178150     1002419      641835     2469212     1648838      991490   199495426     1462121      864022
    142241899      588684  3295763608      426099      519759     1001547      925372      377253      806343   193837555     1542085      491286
    142272950     1186817  3295123113      497148      263428     1491622     1641637      959018      557931   195237462     1404308      467166
```


----------

