3

I try to model a multicore CPU with a service core using QEMU. eg. A 3-core CPU where Linux runs on 2 cores, and an RTOS runs on the 3rd core. The communication should be based on shared memory.
Currently I'm able to boot each OS separately.

Sep Roland
  • 33,889
  • 7
  • 43
  • 76
segfault
  • 489
  • 4
  • 16
  • 1
    How would you do it on a regular PC? – stark Dec 16 '22 at 15:19
  • 1
    Are you using a boot loader or qemu -kernel options? for the former I might understand how it would load and setup the system and become some sort of hypervisor or supervisor over the allocated memory and hardware. Qemu -kernel options are replacing the function of a boot loader and tries to put said kernel in virtual memory and jump to it, using 2, isn't possible with this scheme. How do you start them separately and if so, what boot loader method are you using? – CodeAsm Dec 17 '22 at 18:02

1 Answers1

3

The Linux kernel has an isolcpus option to not schedule tasks there or have that core handle interrupts, but I don't think you could boot a normal OS that expects to own all the memory and talk directly to hardware; it would have to know which areas of memory Linux made available for it to use. I think isolcpus normally lets you run user-space processes without interference, e.g. for microbenchmarking.

Perhaps you could boot Linux and the RTOS in separate VMs, with hardware virtualization, with a hypervisor that sets up a region of shared memory between them.

Or possibly just running the RTOS as a VM guest with Linux as the host hypervisor, but that might defeat the real-time guarantees, IDK.

(All of these problems are the same whether you're on bare metal or QEMU, although QEMU might be able to act as a hypervisor for two guests.)

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847