undervolting (e.g. skylake) in linux

Discussion in 'Hardware Components and Aftermarket Upgrades' started by conker_ts, Aug 13, 2017.

  1. _pk

    _pk Notebook Enthusiast

    Reputations:
    5
    Messages:
    10
    Likes Received:
    12
    Trophy Points:
    6
    Okay, so after testing it on my laptop with i5-4300M, it seems like the values are the same, but of course additionally it has one extra slider enabled.

    FIVRVoltage40 = analog i/o //checked it because it was missing above
    FIVRVoltage50 = digital i/o

    Additional one number, because it's what I'm using there (yea sad it can't go lower, I think it even eats more power than 6440HQ)
    -70.3 = F70

    -1, -2, +3, -4 gave same results as @conker_ts 's, and rest FIVRVoltageXY numbers match.
     
    conker_ts, alfazaz and Vasudev like this.
  2. tincmulc

    tincmulc Notebook Enthusiast

    Reputations:
    7
    Messages:
    10
    Likes Received:
    18
    Trophy Points:
    6
    I did a few experiments and I am pretty sure my initial observation were a bit off. I now believe the offset is actually an 11bit number. This makes steps about 1mV (1/1024 V - as posted by unclewebb).

    I noticed that all of the numbers observed in TS were even. So I then proceeded to try and set an odd offset with wrmsr - the computer instantly locked up. I tried it again a few times and each time I gave it an odd number it locked up. So I think the offset is actually only 11 bits and the 12th bit is something else (and setting it to 1 makes something go horribly wrong). Since most of us were just copying offsets from TS we never had that bit set, but someone following the formula might have.

    The "formula" changes to:

    hex((round(mv*1.024)<<21)+16**8)
     
    conker_ts, alfazaz and _pk like this.
  3. Vasudev

    Vasudev Notebook Virtuoso

    Reputations:
    791
    Messages:
    3,293
    Likes Received:
    1,569
    Trophy Points:
    231
    Maybe that extra bit is signed bit.
     
  4. _pk

    _pk Notebook Enthusiast

    Reputations:
    5
    Messages:
    10
    Likes Received:
    12
    Trophy Points:
    6
    You sure 16^8 is needed? Its 0x1 00000000 (1 and eight 0's) in hex, seems like it changes nothing. With my C floor code it seems to always give even numbers, with or without the 16^8.
     
  5. tincmulc

    tincmulc Notebook Enthusiast

    Reputations:
    7
    Messages:
    10
    Likes Received:
    18
    Trophy Points:
    6
    No, the "negativnes" is already represented by the standard binary way (2's complement).

    This is just python specific as without it python prints negative numbers with a negative sign (eg. '-0x6600000') and you need the actual binary representation of the negative number.
    It doesn't work with positive offsets (you get an extra 1 (eg 0x1xxxxxxxx)). Here is a fixed version that also handles positive offsets:

    format(round(mv*1.024)<<21, '08x') if (round(mv*1.024)<<21)>0 else format((round(mv*1.024)<<21)+16**8, '08x')

    Python really isn't fit for this binary manipulation kind of stuff, but it's not practical to put C code in the guide as it can't be run as easily.
     
    _pk and alfazaz like this.
  6. _pk

    _pk Notebook Enthusiast

    Reputations:
    5
    Messages:
    10
    Likes Received:
    12
    Trophy Points:
    6
    @up
    Oh okay, I never used Python so I dunno, but it seemed weird. Now it makes sense, and seems to work correctly. And it's nice to see people still improving undervolting.


    I hope you don't mind that I stole your code to write it in JS (I don't know Python, but I do know JS a bit). Use @tincmulc code, this one might be error prone.
    Code:
    var mV = 3;
    var result = (((Math.round(mV*1.024)<<21)& 0xFFF00000)>>>0).toString(16);
    '0'.repeat(8 - result.length) + result;
    
     
  7. conker_ts

    conker_ts Notebook Enthusiast

    Reputations:
    5
    Messages:
    30
    Likes Received:
    37
    Trophy Points:
    26
    Woa, ok, at least I wrote a disclaimer in my post :rolleyes:
    Thank you for testing. Looking at it like this, it makes even more sense, why we see saw only even numbers ...

    Haha, yes, Python is awesome in general, but this binary stuff is incovenient. At least JS is as bad o_O (no offense @_tk ^^)
    One advantage is, that you have lot's of possibilites to run the Python code. In Linux it's usually preinstalled, and even if you don't have it on your device, you can paste it in online terminals and evaluate the code instantly.

    Hm, I feared that something like different cases and format are needed. This 2 complement is really annoying (and the prefix 1 in the positive offsets).
    You can at least change the middle part to mv>0 in your version
    or try my version:
    (I'm not 100% sure with this manual 2's complement 'magic' with &0xFFF, but it works with all the numbers I tested)
    Combine it in one, and select the needed bits with &
    format(0xFFE00000&( (round(mv*1.024)&0xFFF) <<21), '08x')
     
    Last edited: Aug 28, 2017
    Vasudev and _pk like this.
  8. tincmulc

    tincmulc Notebook Enthusiast

    Reputations:
    7
    Messages:
    10
    Likes Received:
    18
    Trophy Points:
    6
    Much better, thanks.
     
  9. conker_ts

    conker_ts Notebook Enthusiast

    Reputations:
    5
    Messages:
    30
    Likes Received:
    37
    Trophy Points:
    26
    I just got curious, why it crashed when setting bit 20.
    And I guess this could be prevented, just by reading the older messages and sticking to them:

    The more exact post would be https://forums.anandtech.com/threads/what-controls-turbo-core-in-xeons.2496647/page-40#post-38971756
    I didn't plan to even test the absolute voltages, as I currently don't see where the benefits are (except during OC)
    The this part is the most interesting:
    Code:
    Command 0x10 Read Voltages and ratios, 0x11 Set Voltages and ratios
    Bit(s)
    7:0    Ratio limit
    19:8   Static Voltage   ( V / 1024)
    20     0 = Dynamic Voltage, 1 = Fixed Voltage
    31:21  Offset Voltage, -1024 to 1023 (-1V to +0.999V)

    By setting bit 20, it switched to static voltage, and as this was in the previous range (and probably 0), the CPU had voltage 0 and the system froze, makes sense. At least you can be sure, you didn't fry anything. Kudos to Intel Devs, they probably expected this :p

    But in general this was also a really valuable lesson: So when you see only even numbers, your binary starting point may be wrong :cool:
     
    Last edited: Aug 28, 2017
    _pk, alfazaz, Vasudev and 1 other person like this.
  10. alfazaz

    alfazaz Newbie

    Reputations:
    0
    Messages:
    9
    Likes Received:
    9
    Trophy Points:
    6
    I underclock now my i7 7700HQ under linux... Great ! Thanks !
     
    Vasudev likes this.
Loading...

Share This Page