[HN Gopher] Intel-undervolt: CPU undervolting and throttling con...
       ___________________________________________________________________
        
       Intel-undervolt: CPU undervolting and throttling configuration tool
       for Linux
        
       Author : cl3misch
       Score  : 121 points
       Date   : 2024-06-17 22:44 UTC (1 days ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | voidbert wrote:
       | Please consider the risks of the following vulnerability before
       | deciding whether or not to undervolt: https://plundervolt.com/
        
         | rany_ wrote:
         | In all likelihood this tool does not work for most users,
         | specifically in response to this vulnerability. If you're on
         | the latest microcode, undervolting is no longer possible due to
         | Intel's mitigation:
         | https://www.intel.com/content/www/us/en/security-center/advi...
        
           | gravescale wrote:
           | Which is a pity because my i7 Lenovo laptop is acoustically
           | and thermally some kind of jet turbine in a case, because I
           | was foolish enough to believe a review, and I _really_ wish I
           | could undervolt it so it can make it to lunchtime on a
           | charge.
        
         | yjftsjthsd-h wrote:
         | > We were able to corrupt the integrity of Intel SGX on Intel
         | Core processors by controling the voltage when executing
         | enclave computations
         | 
         | > If you are not using SGX, no actions are required. If you are
         | using SGX, it suffices to apply the microcode update provided
         | by Intel to mitigate Plundervolt.
         | 
         | It's not _nothing_ , but that seems minor to irrelevant to most
         | people.
        
         | aftbit wrote:
         | Wow, I never considered a power attack from software of an
         | untrusted OS. Ring -1 and SGX and the like lead to some very
         | harsh security environments for modern processors. IMO if you
         | want cryptographic security, you should probably use an
         | external component that you control, but that isn't always
         | possible and is never the cheaper option.
        
         | dannyw wrote:
         | Isn't SGX mostly used for DRM, remote attestation, and other
         | anti-consumer stuff in practice today?
         | 
         | I haven't came across a use case of SGX that benefits me.
        
           | mscrivo wrote:
           | Here's one: https://signal.org/blog/private-contact-
           | discovery/
        
             | RussianCow wrote:
             | But that's something that Signal implements on their own
             | backend, not something that runs on consumer devices, so
             | it's not really relevant to a discussion about the risks of
             | undervolting your CPU.
        
               | mscrivo wrote:
               | I was directly replying to the parent's question of
               | whether there were any uses of SGX that were not anti-
               | consumer. Signal's use of it, is very much in line with
               | my thinking of what constitutes pro-consumer.
               | 
               | I agree though, we're all getting slightly off topic
        
           | AshamedCaptain wrote:
           | Except when Apple does it (on their server hardware). Then it
           | supposedly benefits you. See the thread for the "Private
           | Cloud" analysis.
        
           | bobbiechen wrote:
           | SGX is actually deprecated on client devices like PCs, so it
           | is rather difficult to use it in anti-consumer ways now (and
           | as mentioned in a sibling thread, makes this rather
           | irrelevant to the topic of undervolting your own PC).
           | 
           | In my experience (working in the field at Anjuna), SGX and
           | other Confidential Computing are quietly used on the server-
           | side in enterprises a lot. It's a part of defense-in-depth,
           | often to protect critical secrets and cryptographic keys, or
           | the systems that manage them.
        
         | tedunangst wrote:
         | If you're in a position to choose not to undervolt, you're not
         | vulnerable.
        
         | gruez wrote:
         | Aren't you vulnerable to this regardless of whether wether
         | you're using this tool? The vulnerability in question relies on
         | untrusted code being able to lower voltages to very low levels,
         | causing the cpu to malfunction. Using this tool or having it
         | installed isn't a relevant factor. If you have untrusted code
         | running on your PC, it's already game over, and any malicious
         | tool can use the same api this tool uses to control voltages.
        
           | Bognar wrote:
           | Not exactly. The promise of SGX and secure hardware enclaves
           | is that the code that executes there should run with access
           | to protected encrypted memory pages (enforced by the CPU
           | VMM), and the state of the enclave can be remotely attested.
           | Basically, it's designed to run a secure application in an
           | untrusted computing environment as long as you trust the
           | hardware to implement the features correctly.
           | 
           | That last part being the rub.
        
             | damsalor wrote:
             | Yea about that ,,promise" ...
        
       | jauntywundrkind wrote:
       | It was sad seeing AMDGPU limit undervolting semi-recently. A
       | couple complaints or bits of damage ruined a practice that a lot
       | of people were using just fine to save significsnt wattage,
       | https://www.phoronix.com/news/AMDGPU-Lower-Power-Limit
        
         | fbdab103 wrote:
         | Super frustrating. From the mailing thread:
         | However, this is not good as it remove under-powering range too
         | far. I was getting only about 7% less performance but 90W(!)
         | less consumption when set to my 115W before. Also I wonder if
         | we as a OS of options and freedom have to stick to such very
         | high reference for min values without ability to override them
         | through some sys ctrls. Commit was done by amd guy and I wonder
         | if because of maybe this post that I made few months
         | ago(business strategy?)
         | 
         | I have certainly crossed a threshold where hardware seems good
         | enough. I do not need the 99th percentile performance if it
         | comes with a non-linear increase in power consumption.
        
           | Rinzler89 wrote:
           | _> I have certainly crossed a threshold where hardware seems
           | good enough. I do not need the 99th percentile performance if
           | it comes with a non-linear increase in power consumption._
           | 
           | But this is how AMD, Intel and Nvidia have been pushing
           | performance improvements to consumers every generation. To
           | quote Darth Sidious: _" UNLIMITED POWER!"_
        
         | nottorp wrote:
         | Not just AMD. I recently bought a nvidia 4060 card and i can't
         | set the power limit lower than something like 75-90 W, at least
         | in Linux.
         | 
         | Of course, it's possible that the lower limit has always been
         | there for nvidia, but I just didn't know because I went without
         | a dedicated video card for like 4 years.
         | 
         | For AMD aren't the drivers (partially) open source? Can't the
         | change be reverted?
        
           | forbiddenlake wrote:
           | Yes, for example, the alternative kernel, Zen, did so.
           | 
           | https://github.com/zen-kernel/zen-kernel/issues/344
        
         | formerly_proven wrote:
         | It's kinda curious that AMD GPUs still don't have idiot-proof
         | power management. Can you still blow them up from software as
         | well?
        
       | chx wrote:
       | > my i7-8650U
       | 
       | those can but 10nm CPUs after Plundervolt can't undervolt , it's
       | disabled from UEFI and not only there's no option to reenable it
       | in the UI, the very EFI variable itself is write locked. I have
       | an X1 Gen 4 (Intel 11th gen) and you just can't do it.
        
         | lm411 wrote:
         | Damn, you mean we can't just swap resistors to under/over volt
         | anymore?
         | 
         | I am getting old.
         | 
         | (tongue in cheek, and yes, I am getting old)
         | 
         | Shit, I remember just using a pencil to lower resistance
         | values.
        
           | ngneer wrote:
           | You can. The main thing is that software-based attacks are
           | easier to perform.
        
             | chx wrote:
             | That'd be reason to take away the reenable from UEFI but
             | write protecting the EFI variable where changing it already
             | requires to boot into an EFI editor is just being dicks,
             | pardon my French. Just let me enable it , I am aware of the
             | risks.
        
           | Scoundreller wrote:
           | I remember some boards, you would have to paint a cpu pin
           | with nail polish to stop it from conducting, or carefully
           | jump one of the several hundred pins on the socket...
        
         | bytehowl wrote:
         | On my Lenovo Legion 5 Pro with i7-13700HX I can disable
         | undervolting protection in stock UEFI. The only problem is that
         | Windows virtualization features get disabled when undervolting
         | is allowed, and I kind of need those.
        
           | chx wrote:
           | That's good news, then they reenabled it after three
           | generations of it being disabled.
        
         | hmm37 wrote:
         | Many times you can still edit the EFI variable that has been
         | disabled.
         | 
         | https://brendangreenley.com/undervolting-2020-dell-laptops-l...
        
           | chx wrote:
           | Nope, you can't read please
           | 
           | > for the Comet Lake 10750H processor
           | 
           | That's not 10nm that's just Skylake+++++++++++
        
         | hu3 wrote:
         | Not trivial but some folks (including me) HEX edit a bit or two
         | from UFEI/Bios to reenable undervolting.
        
           | chx wrote:
           | The laptop BIOS is signed.
           | 
           | I am not exactly unfamiliar with a hex editor but really: you
           | can't.
        
             | hu3 wrote:
             | You can disable secure boot. Then edit firmware.
             | 
             | So yes, you can. I did.
        
       | nubinetwork wrote:
       | Why would I want this? With a properly configured kernel, Intel
       | chips can downclock to somewhere in the 400-800mhz range when
       | idle.
        
         | inhumantsar wrote:
         | iirc a lot of Intel chips (12th gen+ esp) can be slightly
         | undervolted to achieve better power efficiency and lower
         | temperatures with negligible impact to clock speeds.
         | particularly useful on laptops, mini PCs, and desktops that
         | spend a lot of time at idle.
        
           | declan_roberts wrote:
           | Where can I find out more about this? Just picked up an i5
           | 13500 and my primary concern is low power usage.
        
             | damsalor wrote:
             | Basically the same as overclocking; set, test, reset,
             | retest ....
             | 
             | Be careful with the verification runs as they can easily
             | eat up the energy savings that you are trying to archive
        
             | BSDobelix wrote:
             | Check here:
             | 
             | https://www.reddit.com/r/buildapc/comments/14kll95/intel_i5
             | _...
             | 
             | it seams -100mv - -150mv is the maximum (maybe not stable)
             | undervolting.
        
         | dijit wrote:
         | Undervolting can make your CPU use less power and produce less
         | heat. It's popular for people attempting to overclock because
         | of the thermal headroom it gives- essentially its the same
         | concept as overclocking in that the silicon lottery can mean
         | CPUs can be better than their factory tuning because Intel is
         | hitting the lowest common denominator in the stock config.
         | 
         | I have used this to moderate success on a 8th generation mobile
         | Xeon to drop the temps ~7C under load, and get the system idle
         | from 6w to 4w (going lower would have been really hard as at
         | that point the CPU was responsible for very little of what
         | remained).
         | 
         | Undervolting is not the same as downclocking, it is supplying
         | less voltage which has a strangely profound impact with no
         | performance loss. However your system can be much less stable.
        
           | nottorp wrote:
           | > a strangely profound impact
           | 
           | Something like power consumption being proportional to the
           | square of voltage iirc.
        
           | whalesalad wrote:
           | Mobile Xeon? Pardon?
        
             | dijit wrote:
             | Yeah, Dell Precision 5520 with Xeon E3-1505Mv6
             | 
             | I loved it.
             | 
             | https://www.dell.com/support/manuals/sv-
             | se/precision-15-5520...
        
             | Moto7451 wrote:
             | There are multiple tiers of Xeon. The "base" tier (I am
             | very much over-simplifying) is the same silicon as consumer
             | desktop/mobile with some features turned on like ECC.
             | Mobile workstations and the like get Mobile Xeons. It's
             | less crazy than Desktop Replacements with socketed Desktop
             | CPUs.
        
               | bee_rider wrote:
               | It's a pretty fuzzy barrier anyway. Like the original
               | Skylake i9 desktop chips were basically just Xeons,
               | right? It isn't like there's anything magic in a Xeon,
               | it's just a bunch of cores, why not pop one in a
               | laptop... just don't hurt your back carrying the power
               | brick.
        
             | ComputerGuru wrote:
             | Still rocking my Intel Xeon E3-1545M v5 (Skylake) from
             | 2016. It was the only way to get ECC ram on a mobile
             | workstation.
        
         | bravetraveler wrote:
         | In the interest of simplified manufacturing and support, they
         | leave some power consumption on the table.
         | 
         | You can take that back and get a little more juice, at the risk
         | of instability or time.
         | 
         | No automated system is perfect, /shrug
        
         | nikanj wrote:
         | Because the CPU is never idle, there's always some JS jockey's
         | piece-of-shit Electron app redrawing in a hot loop, some manic
         | search tool re-indexing all the contents of all mounted drives
         | etc
        
         | hanikesn wrote:
         | Undervolting mostly helps with power consumption under load.
        
         | washadjeffmad wrote:
         | To add to this, undervolting isn't about idle clocks, but
         | temperature and power control under load. I typically only
         | apply them to "turbo" boost clocks, which are a frequent cause
         | of thermal throttling even with water cooling.
         | 
         | Intel's 13/14th gen CPUs draw significantly (~70-100W) more
         | power on boost, which can stress the VRMs in otherwise correct
         | pairings and lead to current/EDP or power limit throttling.
         | Lowering the voltage at certain frequencies can allow the
         | system to sustain higher clocks without performance
         | degradation.
        
         | throwup238 wrote:
         | You can underclock most laptop CPUs by 50-100mV without losing
         | any performance. They're usually tuned so far into diminishing
         | returns out of the factory that it's free efficiency.
        
         | Dwedit wrote:
         | Undervolting is not underclocking. With undervolting, you keep
         | performance the same, but use less voltage. It requires trial
         | and error to find the "magic value" that you can reach without
         | experiencing system instability.
        
         | thot_experiment wrote:
         | Why would you _not_ want this, a properly undervolted system
         | loses no perf and gains lifespan and draws less power.
         | Amortized over the now increased lifespan of the processor you
         | could end up with hundreds of dollars of savings, especially in
         | a laptop where a dead CPU or battery often results in a full
         | system replacement. Undervolting is why my 4 year old HP laptop
         | still gets 6 hours of battery life even with heavy mobile use
         | every day.
        
       | M95D wrote:
       | So, why is this not in kernel?
        
         | zamadatix wrote:
         | The ability to do this is exposed via the kernel (writing
         | MSRs). The userspace app here just makes that friendly.
        
       | ycui1986 wrote:
       | In 2006, I had my first laptop right before the release of
       | Windows Vista. Unfortunately, running Windows Vista makes my
       | laptop hot and the fan kicked in to make a lot noise. I cannot
       | remember the software's name which can reduce the core voltage of
       | my single core Centrino processor. I was successful to undervolt
       | the CPU to the lowest possible voltage. That cools down the CPU
       | by a large margin, the laptop became quiet again (also stable). I
       | was happy. The functionality disappears with the newer generation
       | intel CPU releases, I had not been able to do similar thing ever
       | since.
       | 
       | Back then, Intel had the best semiconductor process, and they had
       | a wide margin on undervolting the CPU.
        
         | LoganDark wrote:
         | > The functionality disappears with the newer generation intel
         | CPU releases, I had not been able to do similar thing ever
         | since.
         | 
         | I don't know about under _volting_ , but ThrottleStop allowed
         | me to run my 230W laptop off a 65W power adapter by
         | downclocking the CPU to 800MHz!
        
           | juujian wrote:
           | Did I get that right? A laptop that needs a 230W power brick
           | and wasn't really intended to run on 65W, though it does?
           | 800MHz, that was what we had in the 90s, I assume that's the
           | era? Meanwhile, my laptop is idlying at ~9W playing YouTube.
           | Crazy.
           | 
           | How long did the battery last? Less than 30m I assume.
        
             | triblemaster wrote:
             | Most 230W laptops were not meant to be run without power
             | brick. They were more portable desktops than laptops. Even
             | sold as such.
        
               | LoganDark wrote:
               | Oh no, portable workstations are a whole nother thing.
               | This was 100% marketed and sold as a laptop. But gaming
               | laptops have never been good with battery life.
               | 
               | They even tried to make it thin and light, which makes me
               | cringe every time. Gamers don't need thin and light, wtf.
        
             | LoganDark wrote:
             | The laptop is designed to accept power over some terrible
             | barrel jack that isn't actually made of metal. The
             | conductive coating can scrape off after just a couple
             | months of use and render it completely inert. That had
             | happened again so I was stuck with USB-C charging, and that
             | particular laptop only supported up to 65W via its single
             | Thunderbolt port. I eventually fixed this for good by just
             | stripping the barrel off and hard soldering the power cable
             | directly to the motherboard.
             | 
             | Anyway, indeed, that laptop was not designed to run off
             | 65W. Mainly because it had a dedicated Nvidia GPU, but also
             | because it had a bunch of other stuff (couple 6W fans,
             | bright 4K panel, etc.).
             | 
             | The battery basically didn't exist from the very day I got
             | the laptop brand new from Best Buy. I'm not sure if it's
             | possible to get good battery life out of a 99Wh battery
             | while pulling 230W. Of course, you could simply increase
             | the battery capacity, but a not-insignificant fraction of
             | laptop buyers want to bring them on planes so that'd be a
             | pretty dumb idea.
        
           | bityard wrote:
           | This reminds of me a funny/annoying thing I had happen to me.
           | 
           | A few years back, I bought a Dell laptop that was under their
           | "workstation" line. Dell Precision 7520. The default config
           | when ordering these was had a power-hungry nVidia GPU on a
           | dedicated card. I customized the laptop upon ordering to
           | remove the GPU since I wasn't going to be doing anything that
           | needed a GPU. (I just wanted lots of ports, a nice keyboard,
           | and a touchpad with three buttons. Thinkpad was not an option
           | at the time for reasons.)
           | 
           | Unfortunately, the 7520 firmware was hardcoded with power
           | requirements for a fully-loaded system. It came with a big
           | 180-watt brick. I knew that the laptop wasn't going to need
           | that much power, so I would occasionally use a 90W Dell power
           | brick that I had laying around. I turned off the boot-time
           | warning about an undersized power brick, reasoning that if
           | the battery started draining while plugged in, then I would
           | give up and switch to the bigger brick. The battery never
           | drained.
           | 
           | What did happen, though, is that sometimes I would notice
           | that certain UI things were really, really slow. I always ran
           | a lightweight Linux desktop on the laptop, so generally the
           | web browser was the only thing that would cause any serious
           | CPU or memory usage. For the longest time, I just put up with
           | the occasional slowness on big heavy drunk-with-UX-power
           | websites.
           | 
           | Eventually, I got to wondering what was wrong with this
           | laptop that made it _feel_ so much slower _sometimes_ than
           | any other Linux system I dealt with on a daily basis. One
           | day, after working on the couch for a bit in the morning (on
           | battery), I went back to my desk and plugged into the AC and
           | noticed that Slack got _very_ slow. And so did a few other
           | things. Undock the laptop, and things were fast again. Huh, I
           | thought. That's weird. Nothing in the kernel logs or system
           | journal but when I happened to look at the CPU, I saw it was
           | reporting as an 800 MHz Intel Core i5-7300HQ! Okay, that's
           | not right!
           | 
           | It turns out that Dell hard-coded the firmware to throttle
           | the CPU when a lower-than-expected wattage power brick was
           | used. Even in configurations where that wasn't necessary or
           | made sense. This is silly. I would have much rather had my
           | battery start discharging if the power became an issue, than
           | to silently throttle the CPU. (It's very common to monitor
           | the battery! Not the CPU frequency!) (And no, the firmware
           | warning message that I disabled didn't say that it would
           | underclock the CPU if a lower-spec power brick was used. Just
           | that it might lead to system instability or discharging the
           | battery, or something to that effect.)
           | 
           | Anyway, there is a command you can run in Linux to force the
           | CPU back to full speed. Once I did that, I never had any
           | problems afterward.
        
             | LoganDark wrote:
             | > It turns out that Dell hard-coded the firmware to
             | throttle the CPU when a lower-than-expected wattage power
             | brick was used.
             | 
             | My laptop throttles the CPU to 800MHz when it thinks it
             | detects a power brick that doesn't have the correct sense
             | wire. Or, more commonly, when the power brick is not all
             | the way plugged in (even if it is working fine).
        
       | hu3 wrote:
       | I slightly undervolted an i7 11800H by -100mV.
       | 
       | That resulted in a -10C average CPU temperature. Massive!
       | 
       | I don't remember last time I heard the fans. Not even with Docker
       | + Jetbrains IDEs.
       | 
       | I wonder why doesn't it come like this by default. It runs faster
       | too because it's no longer frequently thermal throttled.
        
         | atVelocet wrote:
         | Cause the CPU can get unstable under certain loads. So Intel
         | plays it safe and ramps up the voltage. And no.. there is no
         | easy way to measure this. Also every CPU is slightly different.
        
           | StrangeDoctor wrote:
           | I ultimately gave up playing this game, spent hours testing
           | and tuning. Each core is slightly different (on amd, I'm sure
           | intel has something similar) and stress test for 1-24h each
           | tweak invoking a reboot. Then some new workload comes and
           | kernel panic/bsod.
           | 
           | Stock settings just work, maybe I lost the silicon lottery
           | but too tired to check anymore.
        
           | rcthompson wrote:
           | It's not just unstable, it's a security issue because control
           | over CPU voltage allows someone to use that instability to
           | compromise computations that are supposed to be performed
           | securely (e.g. look up "Plundervolt").
        
             | epcoa wrote:
             | If plundervolt is a viable attack you've got much bigger
             | problems (the attacker must already have gained full
             | privileges). Not sure how this is relevant to just using
             | throttled or similar to conditionally undervolt the CPU
             | with fixed levels that can be proven reasonably stable.
        
         | Out_of_Characte wrote:
         | Because not all chips will be stable at -100mV Intel is
         | providing the chip with warranty/guarantee that the chip
         | performs 'up to' spec.
         | 
         | Is your chip completely stable in all workloads? Would it be
         | stable at 90c? when all Dram slots are occupied? When driving
         | all pcie lanes at max?
         | 
         | I bet that you could make any chip unstable with the right
         | tools and knowledge.
        
           | hu3 wrote:
           | At the time, I ran a CPU stress test which put all cores at
           | full load for a couple of hours.
           | 
           | Then I ran RAM tests.
           | 
           | Then I ran NVMe stress tests.
           | 
           | Then I ran GPU stress tests (NVIDIA GPU is underclocked).
           | 
           | Then I ran all of these tests together.
           | 
           | Worked butter smooth. Not a crash to this day.
           | 
           | To be fair, -100mV is on the safe side according to the
           | articles I read at the time. Some folks run at -200mV or
           | less. I don't need that kind of tweak.
        
             | thot_experiment wrote:
             | chips _do_ increasingly come like that as intel gets better
             | at binning, they don 't want to leave money on the table
             | and are creating more SKUs in order to mark up good chips
             | like yours (this is why silicon lottery is no longer in
             | business)
             | 
             | the reason your chip didn't come like that is because intel
             | plays it very safe when it comes to stability and their
             | margins for error are likely broader than yours, the
             | stochastic nature of the failures means that the voltage
             | margin between one crash for every 2 hours of stress test
             | and one crash for every day of stress test can be hundreds
             | of milivolts, but they're definitely working on it because
             | pat doesn't want you getting free real estate
        
         | throwup238 wrote:
         | _> I wonder why doesn 't it come like this by default. It runs
         | faster too because it's no longer frequently thermal
         | throttled._
         | 
         | Because pumping up the voltage also allows them to increase the
         | base clock frequency without causing instability. Consumers
         | learned to compare the frequencies during the CPU wars so
         | that's what they juice for marketing purposes.
         | 
         | Newer Thinkpads are notorious for this. Many of them can
         | operate fanless 99% of the time if they just undervolted them
         | by 100mV like you did. It's the first thing I do with a new
         | laptop after installing a clean OS.
        
       | sharpshadow wrote:
       | Dell stopped the option to undervolt the XPS series with some
       | BIOS update. Would need to downgrade the BIOS first.
        
       ___________________________________________________________________
       (page generated 2024-06-18 23:01 UTC)