• Douglas Anderson's avatar
    arm64: dts: qcom: sc7180: Base dynamic CPU power coefficients in reality · 82ea7d41
    Douglas Anderson authored
    The sc7180's dynamic-power-coefficient violates the device tree bindings.
    The bindings (arm/cpus.yaml) say that the units for the
    dynamic-power-coefficient are supposed to be "uW/MHz/V^2". The ones for
    sc7180 aren't this. Qualcomm arbitrarily picked 100 for the "little" CPUs
    and then picked a number for the big CPU based on this.
    
    At the time, there was a giant dicussion about this. Apparently Qualcomm
    Engineers were instructed not to share the actual numbers here. As part
    of the discussion, I pointed out [1] that these numbers shouldn't really
    be secret since once a device is shipping anyone can just run a script
    and produce them. This patch is the result of running the script I posted
    in that discussion on sc7180-trogdor-coachz, which is currently available
    for purchase by consumers.
    
    [1] https://lore.kernel.org/r/CAD=FV=U1FP0e3_AVHpauUUZtD-5X3XCwh5aT9fH_8S_FFML2Uw@mail.gmail.com/
    
    I ran the script four times, measuring little, big, little, big. I used
    the 64-bit version of dhrystone 2.2 in my test. I got these results:
    
    576 kHz, 596 mV, 20 mW, 88 Cx
    768 kHz, 596 mV, 32 mW, 122 Cx
    1017 kHz, 660 mV, 45 mW, 97 Cx
    1248 kHz, 720 mV, 87 mW, 139 Cx
    1324 kHz, 756 mV, 109 mW, 148 Cx
    1516 kHz, 828 mV, 150 mW, 148 Cx
    1612 kHz, 884 mV, 182 mW, 147 Cx
    1708 kHz, 884 mV, 192 mW, 146 Cx
    1804 kHz, 884 mV, 207 mW, 149 Cx
    Your dynamic-power-coefficient for cpu 0: 132
    
    825 kHz, 596 mV, 142 mW, 401 Cx
    979 kHz, 628 mV, 183 mW, 427 Cx
    1113 kHz, 656 mV, 224 mW, 433 Cx
    1267 kHz, 688 mV, 282 mW, 449 Cx
    1555 kHz, 812 mV, 475 mW, 450 Cx
    1708 kHz, 828 mV, 566 mW, 478 Cx
    1843 kHz, 884 mV, 692 mW, 476 Cx
    1900 kHz, 884 mV, 722 mW, 482 Cx
    1996 kHz, 916 mV, 814 mW, 482 Cx
    2112 kHz, 916 mV, 862 mW, 483 Cx
    2208 kHz, 916 mV, 962 mW, 521 Cx
    2323 kHz, 940 mV, 1060 mW, 517 Cx
    2400 kHz, 956 mV, 1133 mW, 518 Cx
    Your dynamic-power-coefficient for cpu 6: 471
    
    576 kHz, 596 mV, 26 mW, 103 Cx
    768 kHz, 596 mV, 40 mW, 147 Cx
    1017 kHz, 660 mV, 54 mW, 114 Cx
    1248 kHz, 720 mV, 97 mW, 151 Cx
    1324 kHz, 756 mV, 113 mW, 150 Cx
    1516 kHz, 828 mV, 154 mW, 148 Cx
    1612 kHz, 884 mV, 194 mW, 155 Cx
    1708 kHz, 884 mV, 203 mW, 152 Cx
    1804 kHz, 884 mV, 219 mW, 155 Cx
    Your dynamic-power-coefficient for cpu 0: 142
    
    825 kHz, 596 mV, 148 mW, 530 Cx
    979 kHz, 628 mV, 189 mW, 475 Cx
    1113 kHz, 656 mV, 230 mW, 461 Cx
    1267 kHz, 688 mV, 287 mW, 466 Cx
    1555 kHz, 812 mV, 469 mW, 445 Cx
    1708 kHz, 828 mV, 567 mW, 480 Cx
    1843 kHz, 884 mV, 699 mW, 482 Cx
    1900 kHz, 884 mV, 719 mW, 480 Cx
    1996 kHz, 916 mV, 814 mW, 484 Cx
    2112 kHz, 916 mV, 861 mW, 483 Cx
    2208 kHz, 916 mV, 963 mW, 522 Cx
    2323 kHz, 940 mV, 1063 mW, 520 Cx
    2400 kHz, 956 mV, 1135 mW, 519 Cx
    Your dynamic-power-coefficient for cpu 6: 489
    
    As you can see, the calculations aren't perfectly consistent but
    roughly you could say about 480 for big and 137 for little.
    
    The ratio between these numbers isn't quite the same as the ratio
    between the two numbers that Qualcomm used. Perhaps this is because
    Qualcomm measured something slightly different than the 64-bit version
    of dhrystone 2.2 or perhaps it's because they fudged these numbers a
    bit (and fudged the capacity-dmips-mhz). As per discussion [2], let's
    use the numbers I came up with and also un-fudge
    capacity-dmips-mhz. While unfudging capacity-dmips-mhz, let's scale it
    so that bigs are 1024 which seems to be the common practice.
    
    In general these numbers don't need to be perfectly exact. In fact,
    they can't be since the CPU power depends a lot on what's being run on
    the CPU and the big/little CPUs are each more or less efficient in
    different operations. Historically running the 32-bit vs. 64-bit
    versions of dhrystone produced notably different numbers, though I
    didn't test this time.
    
    We also need to scale all of the sustainable-power numbers by the same
    amount. I scale ones related to the big CPUs by the adjustment I made
    to the big dynamic-power-coefficient and the ones related to the
    little CPUs by the adjustment I made to the little
    dynamic-power-coefficient.
    
    [2] https://lore.kernel.org/r/0a865b6e-be34-6371-f9f2-9913ee1c5608@codeaurora.org/
    
    Fixes: 71f87316 ("arm64: dts: qcom: sc7180: Add dynamic CPU power coefficients")
    Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
    Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
    Link: https://lore.kernel.org/r/20210902145127.v2.1.I049b30065f3c715234b6303f55d72c059c8625eb@changeid
    82ea7d41
sc7180-trogdor-coachz.dtsi 5.37 KB