I have a solution to solve this potential issue, CPUTune::readConfigAtRuntime().
iAaronLau opened this issue · comments
Shouyue Lau commented
I have a solution to solve this potential issue, but as for my ability, I am unable to realize it:
CPUTune/CPUTuneCore/CPUTune/CPUTune.cpp
Line 158 in 3ba49ae
// FIXME: As per Apple Document (https://developer.apple.com/library/archive/documentation/DeviceDrivers/Conceptual/IOKitFundamentals/HandlingEvents/HandlingEvents.html#//apple_ref/doc/uid/TP0000018-BAJFFJAD Listing 7-5):
// Events originating from timers are handled by the driver’s Action routine.
// As with other event handlers, this routine should never block indefinitely.
// This specifically means that timer handlers, and any function they invoke,
// must not allocate memory or create objects, as allocation can block for unbounded periods of time.
// As for now, the reading procedure reads only one byte, which is fairly fast in our case, so we assume
// this routine will not cause infinite blocking. Let me know if you have some other good ideas.
The solution just need to do a replacement and to modify the function CPUTune::init():
- replace all the "/tmp/"with "/tmp/CPUTune/" in the project;
in the init function:
- mkdir /tmp/CPUTune
- mount a disk made by RAM with just 1MB size; All the config files work in RAM.
In this way, the disk I/O requests could be transformed into RAM requests. Therefore the
infinite blocking risk avoided.