This is an offshoot of the more general thread
I'm making this a separate question because it specifically involves Instruction Based Sampling.
I've been writing a kernel driver to run the IBS Ops facility. It runs on only one core at a time, and it has interrupts masked. It uses a timer to periodically check the Control MSR (c001_1033) to see if it has taken a sample, then it turns off the sample bit and the enable bit.
A little later the driver gets sample data from other Ibs Ops MSRs, and then sets the enable bit in the Control MSR.
After doing this for awhile, the computer freezes, just like was described in the above thread. The Event Viewer shows the same Kernel-Power error (event 41, task 63), as other people have encountered.
Depending on how often I enable the hardware, I get the freeze more quickly if I do the enabling more often.
Now I have a switch in the driver that omits the write to the MSR that enables counting. When I set this switch, the driver runs happy indefinitely.
This I take to be evidence that then the IBS is counting, it could be overheating the CPU, or getting into some other condition that drains a lot of power, and eventually triggers the shutdown.
Interestingly, most of the earlier reports of freezes involve ASUS PRIME motherboards, but also I saw Gigabyte. There was some talk about a BIOS bug regarding power state transitions. Could it be that different MBs have the same BIOS bug? I suppose if AMD supplied the code, that could happen.
Anyway, I upgraded my BIOS to the January 2018 version from ASUS.
There's also some talk about power plans. I downloaded the Ryzen Balanced plan and selected it. I also selected High Performance and Power Saver plans. I got the freeze with all of them.