Librem-EC 1.12 for the Librem 14 has been released with a fix to the PL4 power limit to address sudden shutoffs that still remained in the 1.11 release.  Once again, the issue was in a subtle corner case, which we were able to identify with help from testers.  Update to 1.12 with our update instructions, and check out the source code. Thank you to all those who helped us troubleshoot and fix this issue!

PL4 Strikes Back

As we’ve discussed before, modern Intel CPUs have configurable power limits, called PL1 through PL4.  Flexible power limits allow the EC to tune the system based on the current power source (battery or AC), battery state of charge, and other factors.  Tuning these limits properly is the key to providing a device with long battery life and great performance.

PL4 is the preemptive power limit – the CPU will never exceed it.  We set PL4 based on the amount of power the battery and AC adapter (if present) can deliver.

In the 1.11 release, we reduced the PL4 values to account for normal variations in components.  However, some shutoffs persisted.  We received reports that Librem EC 1.7 had fewer shutoffs.  There were several changes between 1.7 and 1.8, and we isolated one by iterating with testers.  The remaining issue was not caused by the value of PL4, but by the way we were setting it.

Backtracking to 1.7

In older versions of Librem-EC, the firmware set the power limit every time it iterated to check its inputs – there was no persistent state.

Timing diagram showing PL4 being set at every iteration

We saw this as a lot of unneeded work, and we wanted to free up that time in the EC.  The EC runs at just 9 MHz, and much of its work is synchronous.  There is no need to set PL4 again if it hasn’t changed, so we had it remember the last PL4 setting.  This means the EC only tells the CPU about PL4 if something changes, such as plugging in the AC adapter, or the battery reaching low charge.

Timing diagram showing PL4 only set when AC adapter state changes

 

The implementation is pretty simple – the function power_peci_limit() decides what the PL4 should be based on our current inputs.  It just remembers the last decision, and if the new decision is the same, we don’t have to tell the CPU the current value of PL4.

However – there is one situation where the CPU will forget PL4 on its own.  If it enters any sleep state, the CPU will not remember PL4 when it resumes again.  The EC would not necessarily apply PL4 again, and we could end up running with no PL4 limit.

Of course, if you plugged in the AC adapter, the EC would update PL4.  If the system shuts off for more than 7 seconds on battery, the EC shuts off too, so it would apply PL4 when turning on again.  This meant that the problem was tough to find.  After the incorrect behavior occurred, the system had to cause a shutoff before the EC decided to change PL4.

Timing diagram showing PL4 cleared at suspend, and later running with no PL4 limit

Once we realized that this state transition caused the problem, I was finally able to reproduce the shutoff.  To fix it, we just forget our last PL4 setting if the CPU is in any sleep state.  When it resumes, we will always apply PL4 again.  This fixes the issue and preserves the optimization in Librem-EC 1.8.

Timing diagram with PL4 cleared on suspend and set again on resume.

Bonus Fix

While confirming this fix for the sudden shutoffs, we also received reports that this corrected a rare graphical corruption issue.  This may have been caused by power usage that pushed a power rail below its intended voltage, but not low enough to shut the system off.  Thanks to all of our users that helped test this issue and confirm the fix!

Purism Products and Availability Chart

 ModelStatusLead Time 
USB Security Token Purism Librem KeyLibrem Key

(Made in USA)
In Stock
($59+)
10 business days
Librem 5In Stock
($699+)
3GB/32GB
10 business days
Librem 5 COMSEC BundleIn Stock
($1299+)
Qty 2; 3GB/32GB
10 business days
Purism Liberty Phone with Made in USA ElectronicsLiberty Phone
(Made in USA Electronics)
Backorder
($1,999+)
4GB/128GB
Estimated fulfillment February
Librem 5 + SIMple
(3 GB Data)
In Stock
($99/mo)
10 business days
Librem 5 + SIMple Plus
(5 GB Data)
In Stock
($129/mo)
10 business days
Librem 5 + AweSIM
(Unlimited Data)
In Stock
($169/mo)
10 business days
Librem 11In Stock
($999+)
8GB/1TB
10 business days
Most Secure Laptop Purism Librem 14Librem 14Backorder
($1,370+)
Estimated fulfillment December
Most Secure PC Purism Librem Mini
Librem MiniBackorder
($799+)
10 business days
Most Secure Server Purism Librem ServersLibrem ServerIn Stock
($2,999+)
45 business days
The current product and shipping chart of Purism products, updated on October 18th, 2024

Recent Posts

Related Content

Tags