Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I have a solution to solve this potential issue, CPUTune::readConfigAtRuntime(). #44

Open
iAaronLau opened this issue Feb 27, 2024 · 0 comments

Comments

@iAaronLau
Copy link

I have a solution to solve this potential issue, but as for my ability, I am unable to realize it:

// 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):

    // 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():

  1. replace all the "/tmp/"with "/tmp/CPUTune/" in the project;

in the init function:

  1. mkdir /tmp/CPUTune
  2. 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.

@syscl @asepms92 @Mrc527 @christophe-duc @schdt899

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant