RE: Performance overhead of paravirt_ops on native identified

From: Xin, Xiaohui
Date: Thu May 21 2009 - 21:27:41 EST


Remember we have done one experiment with "jump", the result shows seems the overhead is even more than the call.

Thanks
Xiaohui

-----Original Message-----
From: Jeremy Fitzhardinge [mailto:jeremy@xxxxxxxx]
Sent: 2009年5月22日 6:49
To: Chuck Ebbert
Cc: Ingo Molnar; Xin, Xiaohui; Li, Xin; Nakajima, Jun; H. Peter Anvin; Nick Piggin; Linux Kernel Mailing List; Xen-devel
Subject: Re: Performance overhead of paravirt_ops on native identified

Chuck Ebbert wrote:
> On Wed, 13 May 2009 17:16:55 -0700
> Jeremy Fitzhardinge <jeremy@xxxxxxxx> wrote:
>
>
>> Paravirt patching turns all the pvops calls into direct calls, so
>> _spin_lock etc do end up having direct calls. For example, the compiler
>> generated code for paravirtualized _spin_lock is:
>>
>> <_spin_lock+0>: mov %gs:0xb4c8,%rax
>> <_spin_lock+9>: incl 0xffffffffffffe044(%rax)
>> <_spin_lock+15>: callq *0xffffffff805a5b30
>> <_spin_lock+22>: retq
>>
>> The indirect call will get patched to:
>> <_spin_lock+0>: mov %gs:0xb4c8,%rax
>> <_spin_lock+9>: incl 0xffffffffffffe044(%rax)
>> <_spin_lock+15>: callq <__ticket_spin_lock>
>> <_spin_lock+20>: nop; nop /* or whatever 2-byte nop */
>> <_spin_lock+22>: retq
>>
>>
>
> Can't those calls be changed to jumps?
>

In this specific instance of this example, yes. But if you start
enabling various spinlock debug options then there'll be code following
the call. It would be hard for the runtime patching machinery to know
when it would be safe to do the substitution.

J

N?叉??y??b??千v??藓{.n???{?赙zXФ?塄}?财??j:+v???赙zZ+€?zf"?????i????ア??璀??撷f?^j谦y??@A?囤?0鹅h??i