cessor. As described above, this approach reduces the
development cost by reusing software significantly.
When RTOS and SMP GPOS share one SMP sys-
tem, there is a possibility that the RTOS preempts
the SMP GPOS even when the SMP GPOS executes
a code in a critical section. This preemption may
cause critical performance degradation of the SMP
GPOS. The problem is called the lock holder preemp-
tion (LHP) problem. The existing solution for solving
the problem is called the delayed preemption tech-
nique (Uhlig et al., 2004). When a kernel thread of
SMP GPOS executes a critical section, RTOS is pro-
hibited to preempt the SMP GPOS. Thus, the LHP
problem does not occur, and there is no throughput
degradation of GPOS. However, the technique de-
creases the real-time responsiveness of RTOS as de-
scribed in Section 5 because the critical section in
GPOS like Linux is not enough short.
In this paper, we propose two new techniques for
avoiding the LHP problem. Both techniques rely on
the vCPU migration mechanism to migrate a virtual
core implemented by a virtualization layer among
physical cores. The first technique is called the trap
based migration technique, and the second technique
is the on demand migration technique. The two tech-
niques have different tradeoffs in terms of real-time
responsiveness and overhead. Each system needs to
choose the suitable one by taking into account the
tradeoffs of both techniques and the requirements of
each system. We have implemented the delayed pre-
emption technique and the proposed two techniques
on SPUMONE, a virtualization layer developed in our
research group. We also show the evaluation results
of the three techniques. The results present the merits
and demerits of each technique clearly.
The rest of the paper is structured as follows.
We first explain the LHP problem and show the ef-
fect on SPUMONE in Section 2. In Section 3,
we present an overview of SPUMONE. Section 4
presents the delayed preemption technique and the
effect on SPUMONE. In the section, two new tech-
niques are also proposed and we show how to imple-
ment them in SPUMONE. The evaluation of the new
techniques to avoid the LHP problem is shown in Sec-
tion 5 and Section 6 summarizes the paper.
2 THE LOCK HOLDER
PREEMPTION(LHP) PROBLEM
IN A VIRTUALIZATION LAYER
The LHP problem occurs in SMP OS in the following
situation: on a virtualization layer, multiple OSes may
run simultaneously on the same core. We assume that
RTOS uses one virtual core, and SMP GPOS uses two
virtual cores offered by a virtualization layer. We also
assume that the virtual core for RTOS and one virtual
core of SMP GPOS share the first physical core and
the other virtual core used by SMP GPOS that runs
on the second physical core. Now, a virtual core used
by SMP GPOS holds a spin lock, and the virtual core
used by RTOS becomes ready and preempts the ex-
ecution of the virtual core of SMP GPOS. When an-
other virtual core of SMP GPOS tries to acquire the
same spin lock, it needs to wait for the virtual core to
release the lock after RTOS becomes idle.
We also assume that the priority of RTOS is higher
than the priority of GPOS. This is a natural configu-
ration to use both RTOS and GPOS simultaneously.
So, the preempted GPOS cannot resume the execu-
tion until all activities in RTOS becomes idle. There-
fore, there is a high possibility that the lock holder
waits for a long time to be resumed and that other
physical cores are also stopped until RTOS becomes
idle. This degrades the throughput of SMP GPOS sig-
nificantly. Of course, the LHP problem is well dis-
cussed is the case when multiple SMP GPOSes run
on a multi-core processor. However, the combination
of RTOS and SMP GPOS may cause more serious
performance degradation.
There is also another problem related to the LHP
problem. Typical SMP GPOSes like Linux use the in-
ter core interrupt mechanism to synchronize between
physical cores. For example, the TLB shutdown uses
the mechanism to keep the consistency of TLBs of
all physical cores. GPOSes usually assume that the
synchronization cannot be preempted by other activi-
ties. Therefore, the preemption of the synchronization
also causes significant performance degradation, and
in the worst case, it may cause the deadlock in the
GPOS kernel.
We demonstrate the effect of the LHP problem
with a virtualization layer called SPUMONE.
In this demonstration, we are using SMP Linux
as SMP GPOS and TOPPERS/JSP (which we sim-
ply call “TOPPERS”) (Toppers, 2011) as RTOS
1
.
Figure 1 shows the result of running the hackbench
benchmarking program (Hackbench, 2011) on Linux,
when TOPPERS consumes CPU time every 500ms.
A virtual core is assigned to TOPPERS and four vir-
tual cores are assigned to Linux. The virtual core for
TOPPERS and one virtual core for Linux shares one
physical core. Three other virtual cores for Linux use
the remaining three respective physical cores.
1
TOPPERS is a open source RTOS that offers µITRON
interface, and it is used in many Japanese commercial prod-
ucts.
PECCS 2012 - International Conference on Pervasive and Embedded Computing and Communication Systems
370