Cpu protection and disabling kernel interrupts

On Linux, what (if any) is a drawback to disable all interrupts on a particular processor core, or even all kernels on a single chip in a system containing multiple chips? When writing a C program that has extreme delay sensitivity, my natural tendency is to isolate the thread in its own kernel and transfer all other tasks to separate kernels, and I wonder what trade-offs are.

+6
source share
2 answers

The mainline Linux kernel is not designed to let all IRQs shut down on the processor for a long period of time. There are a number of internal kernel functions that require such IRQs - one of them is RCU. An RCU rack can and does reduce the rest of the system, and, avoiding such a rack, can (depending on the RCU implementation used) include IPI (interprocessor interrupts) broadcast to all processors.

However, there are experimental fixes for the correct implementation of such processor isolation; for example: http://lwn.net/Articles/268711/ - they go through all the internal rotations necessary to turn off the central processor (from the point of view of the rest of the kernel) before disabling interrupt routing. This is a pretty old patch series; you can contact the developer of a series of patches to find out if they have a newer version, or adapt these patches to the current kernel version. It is assumed that PREEMPT_RT people are also studying its implementation - check out their wiki at https://rt.wiki.kernel.org/index.php/Main_Page (not yet implemented). Good luck

+3
source

A few things to consider:

  • Less than one processor will run on any IRQ, which means you are likely to expect an interrupt. Obviously, this is becoming a problem as the number of processors grows.
  • Without interruptions, it will be much harder to make the process abandon execution. If he decides to enter an infinite loop, you cannot interrupt him to stop him.

If you have full confidence that the process will give up control in a reasonable amount of time and not worry about the order of interruption, then it would be useful to disable interruptions.

+2
source

Source: https://habr.com/ru/post/887401/


All Articles