Designing a hard-realtime addon to an operating system
Posted: Thu Dec 12, 2019 4:09 am
I have a very specific application in mind for this. Imagine that you have a 1G sample AD converter card (they typically come as PCI-cards that should be plugged into graphics grade PCI slots), and want to analyze up to a minute or so of data for unknown patterns. First, I will just want to collect 100Gbytes or so of realtime data and do the analysis in retrospect. However, as I get to know the data, I probably would want to do at least part of the analysis in realtime and reduce the data to some other form that is much smaller. Typical designs would add the logic to the data acquisition equipment since typical operating systems like Windows and Linux simply cannot handle this in realtime.
I looked for hardware suitable for this project, and a promising setup is a two CPU AMD EPYC board. I could populate it with two rather low-end EPYC processors to begin with, and then upgrade them if necessary. This board also has dedicated RAM for each processor, and so the amount of installed RAM could be different between the analyzer and the operating system.
The realtime analyzer should work with physical memory and not linear memory (unity mapping). This is largely incompatible with modern operating systems but should be possible to implement if the realtime system run on dedicated core(s) in its own mode. Given that the function must be able to access huge amounts of RAM, it will need to run in long mode regardless of the mode used in the operating system.
I envision that there needs to be a communication interface with the operating system. The realtime system can send interrupts to an operating system driver. For one, the realtime system must allocate physical memory, preferently in large blocks, like 100GB of continous RAM. It must also be possible to debug the realtime system from the operating system driver. When the realtime system encounter faults it should stop and inform the operating system driver. It should be possible to singlestep the realtime system code, which can be done with the trap interrupt. It must also be possible for the operating system driver to put the realtime system into debug state, for instance by sending it an interrupt.
I don't want to do this in Linux or Windows, rather in my own operating system. I have a simulator, so the first step probably is to run the realtime system code in a simulator, tying read/write of physical memory to real physical memory. Typical simulators will not work since I need to debug the interaction between the operating system and the realtime system. Once I have the debug interface done, I can then use that for debugging the realtime system instead of using a simulator.
I looked for hardware suitable for this project, and a promising setup is a two CPU AMD EPYC board. I could populate it with two rather low-end EPYC processors to begin with, and then upgrade them if necessary. This board also has dedicated RAM for each processor, and so the amount of installed RAM could be different between the analyzer and the operating system.
The realtime analyzer should work with physical memory and not linear memory (unity mapping). This is largely incompatible with modern operating systems but should be possible to implement if the realtime system run on dedicated core(s) in its own mode. Given that the function must be able to access huge amounts of RAM, it will need to run in long mode regardless of the mode used in the operating system.
I envision that there needs to be a communication interface with the operating system. The realtime system can send interrupts to an operating system driver. For one, the realtime system must allocate physical memory, preferently in large blocks, like 100GB of continous RAM. It must also be possible to debug the realtime system from the operating system driver. When the realtime system encounter faults it should stop and inform the operating system driver. It should be possible to singlestep the realtime system code, which can be done with the trap interrupt. It must also be possible for the operating system driver to put the realtime system into debug state, for instance by sending it an interrupt.
I don't want to do this in Linux or Windows, rather in my own operating system. I have a simulator, so the first step probably is to run the realtime system code in a simulator, tying read/write of physical memory to real physical memory. Typical simulators will not work since I need to debug the interaction between the operating system and the realtime system. Once I have the debug interface done, I can then use that for debugging the realtime system instead of using a simulator.