Fixing the kworker CPU usage / ACPI errors issue on a Skylake motherboard (ASRock Z170 Pro4)

In which ASRock bricks my motherboard and a random $10 Chinese device comes to the rescue, with the help of a German gentleman

Since I no longer trust the spyware that is Windows 10, I have wanted to move my main PC (6700K CPU, R9 290 graphic card, ASRock Z170 Pro4 motherboard) to Linux for months now and finally did it yesterday. Everything worked as expected until, while working inside Ubuntu, I started getting messages that the computer was low on disk space even though I had allocated 25 gigabytes to the root partition.

Using ncdu in the terminal, I found that the log folder was taking up all the space, and found that /var/log/kern.log and /var/log/syslog were being written to at what seemed to be a rate of 1 MB/second, with endless repetitions of:

ACPI Error: Method parse/execution failed [\_GPE._L6F] (Node ...), AE_NOT_FOUND (...)

Another issue was that the kworker process was using constantly 100% of one of the eight CPU cores.

Forums suggested this was a motherboard firmware issue. So I decided to do a firmware update. My firmware was a pretty early one, something like version 1.5, while the latest available firmware is 7.3. I went to the UEFI interface and tried using the “Internet Flash” utility provided by ASRock. It successfully retrieved the fact that there was a 7.5 version update available to the firmware, but when clicking on update, it would conveniently fail to connect to the internet. Somehow the geniuses at ASRock had created software that could connect to the internet to ask if an update was available, but on downloading the update it would fail to connect to the internet. Still, I am glad that we are light years ahead of the pain, anguish and days of wasted labor that we used to suffer in the 90’s to fix a simple hardware issue.

I downloaded the BIOS binary file from the ASRock website, put it on a USB flash drive, and went to UEFI interface again, this time using the “Instant Flash” utility. The first time I tried it, the computer instantly crashed and rebooted, and nothing else happened. I tried a second time. This time it seemed to work, until the firmware update got stuck at 10%. I waited for hours to see if it would finish, but it didn’t. I left my computer on overnight, thinking that there might still be a tiny chance it would eventually finish. In the morning it hadn’t. So I hard rebooted my PC, and then nothing. It would turn on, but it wouldn’t give any output, not even the ASRock logo that shows at the beginning.

Knowing that the BIOS chip had probably become corrupted from the update and that I had probably upgraded my motherboard from an ASRock to an ASBrick, I looked to see what could be done. After yanking on the BIOS chip on the motherboard for a while, I found that it was designed to come off, so I took it out. I then learned about devices that can reflash a corrupted BIOS chip. I found out about the the Chinese device CH341A  that sells for about $10. I ordered one made by a company called SMAKN on Amazon with overnight delivery. This morning it arrived.

At first I was dismayed to see that there were three unattached pieces, I thought they might need soldiering:

But after watching this video by UltraNSC, I found that I wouldn’t be needing those pieces. I installed the software provided in the description of the video on an old but working Windows 7 laptop that I have, inserted the device, tried installing all the drivers in the file, and still the software (CH341A.exe) wouldn’t detect the device. I unplugged the device and moved to another USB port, and this time the software detected it.

The software detected that the BIOS chip had a size of 16 megabytes, similar to the binary file provided by ASRock. This was a good sign. I erased the BIOS chip with the software, then tried to open the binary file with the software but it wouldn’t detect it because the file provided by ASRock doesn’t have a filetype extension. I renamed the file to have a .bin extension, and now the software could see it. I loaded the file and clicked “Program” to write it to the chip. Everything worked without a problem. I clicked “Verify” to make absolutely sure the data was copied without error and that came out positive.

I put the BIOS chip back into the motherboard and turned the computer on. A message by American Megatrends came up, and clicking F12, it took me to the UEFI interface. I rebooted and was immediately taken into Windows as the UEFI had forgotten my preferred boot device order. Windows tried to do some sort of automatic repair then restarted the computer, at which point I went into the UEFI interface and told it to use my main SSD as the boot device. Restarting, I was taken into grub, and from there went into Ubuntu. Logging in, I saw that kworker wasn’t acting up anymore, and that the logs weren’t being flooded.

Now it is time to install Windows 7 in a networking-disabled virtual machine inside Ubuntu so that I can continue using OneNote and Photoshop without sending all my data to Microsoft. I have also kept my Windows 10 installation on another partition just in case I ever need it, for example to play Battlefield 1, though it seems I’ve become enough of an adult that video games barely interest me anymore, though I still enjoy watching Stodeh on Twitch.

Solve the invisible spaces problem in Word 2013

An annoying issue in Word 2013 is that sometimes the space key seems to stop working, until you press a non-space character, at which point Word deigns to show you both the space and non-space characters.

To solve the problem, press enter to create a new line, then go back to your line. The problem is caused by a bug in Word where having a page break or section break right after the line you are on prevents spaces from showing. Make sure there is a line (empty or not) below the line you are typing on, and the problem disappears.

How to export the entire sequence by default in Adobe Premiere Pro CS6

  1. Move the yellow playback marker far to the right, until it goes into the blank area and the preview window becomes black. If you are doing batch work, move the marker farther than any of your clips are going to be. For example, if you are exporting 1 minute videos, move the marker to the 2 minute mark.
  2. On the bar below the playback marker’s bar, find the right end of the selection bar and move it to the far left, so that there are 0 seconds selected. The left end of the selection marker should also be to the far left, obviously.
  3. That’s all. Now when exporting, Premiere will automatically select the entire sequence for export.

AWS Storage Historical Pricing and Future Projections

Some blogs are calling the recent price wars between cloud providers “a race to zero”. But this is the wrong way to think about it. As technology progresses, we simply need to start thinking in terms of larger units.

Here is a table of historical Amazon S3 prices:

Date $/GB/Month $/TB/Month
14-Mar-06 0.15 150
1-Nov-08 0.15 150
1-Nov-10 0.14 140
1-Feb-12 0.125 125
1-Dec-12 0.095 95
1-Feb-14 0.085 85
1-Apr-14 0.03 30

In terms of gigabytes the prices seem to be approaching zero. But in terms of terabytes, the prices are just barely starting to become reasonable. The linear projection below suggests that we will be using terabytes as our unit of choice when speaking of cloud storage until 2020 and later, when prices will start going below $1 per terabyte per month.

Some time after 2020, perhaps around 2025, we will start speaking in terms of petabytes per month.

Fire Phone folder where screenshots are stored

Using my Windows 7 computer to browse the Fire Phone’s files, I found the screenshots in the following folder:

Computer\Fire\Internal storage\Pictures\Screenshots

To take screenshots, you need to hold down the volume down and power buttons together. You will hear a sound and see an animation informing you that the screenshot was successfully taken.

List of 20,000 right-angled triangles with whole-number sides

Some mathematical investigations can benefit from having a handy list of right-angled triangles with whole number sides. We know of the common [a = 3,b = 4, c = 5] triangle often used to illustrate the Pythagorean theorem (5^2 = sqrt(3^2 + 4^2)), but sometimes we need more of these. For this reason I made the following lists, placed inside handy text files. They start from the smallest possible triangle (the [3,4,5] one) and iterate up.

List of 20,000 right-angled triangles with whole-number sides sorted by the smallest side (i.e. side a).

List of 20,000 right-angled triangles with whole-number sides sorted by the largest side (i.e. the hypotenuse or side c).

Mashing two regular expressions together in JavaScript on the fly

var pattern1 = /Aug/;
var pattern2 = /ust/;
var fullpattern = (new RegExp( (pattern1+'').replace(/^\/(.*)\/$/,'$1') + (pattern2+'').replace(/^\/(.*)\/$/,'$1') ));

Explanation:

  • pattern1+'' turns (“casts”) the regular expression object into a string.
  • .replace(/^\/(.*)\/$/,'$1') removes the beginning and ending slashes from the pattern
  • new RegExp() turns the resultant string into a regular expression object. There is no need to add back a regular expression delimiter (i.e. slashes usually) since the RegExp() function (“constructor”) adds the delimiter if it is lacking.
  • If you want the resultant expression to have a flag, for example i, you add it so: new RegExp(string,'i');
  • This code is quite unreadable and you might be doing yourself and others a kindness if you use a less clever method. To make it more readable, the technique can be wrapped in a function:
var rmash = function(reg1,reg2) {
var fullpattern = (new RegExp( (reg1+'').replace(/^\/(.*)\/$/,'$1') + (reg2+'').replace(/^\/(.*)\/$/,'$1') ));
return fullpattern;
};

var my_new_pattern = rmash(pattern1,pattern2);

Generalizing the mash function to handle an arbitrary number of regular expressions and flags is left as an exercise.

How to do long-running computations in JavaScript while avoiding the “maximum call stack size exceeded” error

The following program calculates the value of the series of the Basel Problem. The result is a number that starts with 1.644934. Like π, this sequence can go on forever, which means the program never exits. Without proper design, such a program runs into the maximum call stack size exceeded error, which is designed to prevent a program from using too much memory.

var cr = 1;
var total = 0;
var x = function() {

    total = total + (1/(cr*cr));

    
    if(! (cr % 20000)) {
        $('#t1').val(total);
        $('#t2').val(cr);
        setTimeout(x,0);
    }
    else {
        x();
    }
    cr++;

};
x(); //initial call to x().

The solution is to add a setTimeout call somewhere in the program before things get too close to exceeding the call stack. In the above program, cr is a counter variable that starts with 1 and increases by 1 for every iteration of the x function. Using the conditional if(! (cr % 20000)) allows the program to catch its breath every 20,000 iterations and empties the call stack. It checks whether cr is divisible by 20,000 without a remainder. If it is not, we do nothing and let the program run its course. But if is divisible without a remainer, it means we have reached the end of a 20,000 iteration run. When this happens, we output the value of the total and the cr variables to two textboxes, t1 and t2.

Next, instead of calling x() the normal way, we call it via setTimeout(x,0);. As you know, setTimeout is genearlly used to run a function after a certain amount of time has passed, which is why usually the second argument is non-zero. But in this case, we do not need any wait time. The fact that we are calling x() via setTimeout is what matters, as this breaks the flow of the program, allowing proper screen output of the variables and the infinite continuation of the program.

The program is extremely fast, doing 1 million iterations about every 2.4 seconds on my computer. The result (the value of total) is not perfectly accurate due to the limitations of JavaScript numbers. More accuracy can be had using an extended numbers library.

You may wonder why we cannot put all calls to x() inside a setTimeout(). The reason is that doing so prevents the JavaScript interpreter from optimizing the program, causing it to run extremely slowly (about 1000 iterations per second on my computer). Using the method above, we run the program in optimized blocks of 20,000 iterations (the first block is actually 19,999 iterations since cr starts from 1, but for simplicity I have said 20,000 throughout the article).

Using an object anonymously in JavaScript

var month = 'Jan'; //or another three-letter abbreviation

//After the following operation, proper_month will contain the string "January".
var proper_month = {'Jan':'January',
                              'Feb': 'February',
                              'Mar' : 'March',
                              'Apr' : 'April',
                              'May'   : 'May',
                              'Jun'  : 'June',
                              'Jul'  : 'July',
                              'Aug'   : 'August',
                              'Sep'  : 'September',
                              'Oct'   : 'October',
                              'Nov'   : 'November',
                              'Dec'   : 'December'
                             
                             }[month];

How to: Become wise

If you want to become wise, read 100 books that interest you. The books you choose to read can be about any topic and they can be of any quality, good or bad. The important thing is that you should find them interesting, because the fact that you find a book interesting means it contains information that is new1 to you (and thus it increases wisdom), because “interesting” simply means “something that provides new information to the brain”.

No book is going to solve all of your problems. Each book may make you a 1% wiser person. Thus if you want to become double as wise as you are now, you would have to read about 70 books. 100 books would be a safer number.

Some of the books you read will contain false information, because almost any book will contain some claims and assumptions that are false. But if you don’t give up and continue reading books one after another, as your knowledge increases, so will your awareness of what is true and what is false. Wisdom is simply a map of reality (accurate information about how things really are), and each book you read (even a simple story) tries to give you a small piece of the map. Some books will give you false pieces that do not describe anything that actually exists on the map. But as you read more books, your knowledge increases about the other pieces that surround the false piece, and thus you start to have an intuitive sense of what the false piece should actually look like, and thus you recognize the false piece for what it is: false. Recognition of the falsehood in itself increases your knowledge, for your brain can abstract the patterns of falsehood, and it can actually build a map of what falsehood itself looks like, and thus it will become increasingly hard for falsehoods to mislead you.

If you start to read a book that at first seems interesting, but eventually lose interest in it and start to find it boring and tiring, you should feel no qualms about abandoning the book and starting another. When this happens, it can be due to one of two things:

  1. The book does not contain anything that’s new to you, and thus your brain recognizes it as a repetition of things that you already know very well, and therefore you brain is asking you to stop wasting your time with the book.
  2. The book contains information that has too many prerequisites, and thus your brain is not equipped to handle the information. You should abandon the book now and return to it after reading many other books.

Spend a year doing this and at the end of it you may laugh at how unwise and biased you used to be a year ago. During your journey you would have picked up some new biases, therefore it is unwise to stop your journey. Continue reading books and these biases will be cleared up. You will never stop picking up biases, but their frequency will decrease as your wisdom increases, for biases have patterns of their own and the wise mind can learn to avoid many of them. This is why you find the wisest people to be those who are least ready to make final judgments on any topic–they are “open-minded”, knowing when they do not have enough information.

In most cases, when it comes to most topics, humans rarely have perfect knowledge, therefore the wisest often refuse to give final answers on anything or to give counsel freely to those who ask for it. They will speak about what they know, and refuse to delve into what they do not know.

Page 7 of 8
1 2 3 4 5 6 7 8