move sensitive instructions from score to libcpu

Philipp Eppelt philipp.eppelt at mailbox.tu-dresden.de
Wed Apr 17 13:52:23 UTC 2013


Unfortunately, I got the wrong list at first and posted this on 
rtems-users. But as it is a matter of development I repost this on the 
right list. Sorry for that.


Hi,

while discussing the paravirtualization project for this years GSoC, the 
problem with the special CPU models arose.
If you are running in a virtual environment you can't execute privileged 
instruction like cli/sti or hlt (x86). They need to be exchanged with a 
call to the hypervisor (hypercall).

To solve this we see several options:
1) a new CPU model is introduced for every virtual BSP/CPU.
2) loads of #ifdef guards
3) split CPU model between score and libcpu. sensitive/privileged 
instructions go to libcpu.
4) new config option, which introduces a new directory packaging all 
virtual CPU models

1)
* a lot duplicated code and a cluttered cpukit/score/cpu/ directory

2)
* mixing virtual and non-virtual code

3)
explanation by Gedare:

> You need to split the existing code in score/cpu/${arch} so that none
> of it touches privileged/sensitive resources. Then you will move the
> privileged/sensitive accesses to libcpu/${arch}/shared and point to it
> for the non-virt targets, and write the hypercalls for the
> libcpu/${arch}/$[arch}virt. This will avoid the potential conflicts,
> but leaves the score/cpu "incomplete" in the sense that some
> functionality like context switch and ISR handling is no longer
> located there for that target. This needs to be considered by the
> other developers too, as I do not know all the ramifications for
> splitting the score/cpu code out. You might like to start a new ml
> thread to solicit feedback on the idea if it seems the likely
> direction.
>
> -Gedare

4)
* cpukit/score/cpu/virt/${arch} and libbsp/virt/${arch} introduced
* add --enable-virtual flag  to configure scripts
* modify configure scripts to adapt to the added virt/ in the source tree
* all virtual execution capable CPUs and BSPs bundled in the 
corresponding directory

The discussion leading here is on rtems-user called "Paravirtualization 
project - GSOC 2013".


So much for the overview. The solution in question is the one by Gedare. 
Is it feasible to split the code between score and libcpu?

If you like it, I would explore this approach in my GSoC project on the 
x86 architecture.


Regards,
Philipp



More information about the devel mailing list