[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <cc581449-81e4-1299-2221-0b1733648fb5@linux.vnet.ibm.com>
Date: Thu, 17 Nov 2016 13:16:30 +0800
From: Pan Xinhui <xinhui@...ux.vnet.ibm.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Pan Xinhui <xinhui.pan@...ux.vnet.ibm.com>,
linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
virtualization@...ts.linux-foundation.org,
linux-s390@...r.kernel.org, xen-devel-request@...ts.xenproject.org,
kvm@...r.kernel.org, xen-devel@...ts.xenproject.org,
x86@...nel.org, benh@...nel.crashing.org, paulus@...ba.org,
mpe@...erman.id.au, mingo@...hat.com, paulmck@...ux.vnet.ibm.com,
will.deacon@....com, kernellwp@...il.com, jgross@...e.com,
pbonzini@...hat.com, bsingharora@...il.com, boqun.feng@...il.com,
borntraeger@...ibm.com, rkrcmar@...hat.com,
David.Laight@...LAB.COM, dave@...olabs.net, konrad.wilk@...cle.com
Subject: Re: [PATCH v7 06/11] x86, paravirt: Add interface to support kvm/xen
vcpu preempted check
在 2016/11/16 18:23, Peter Zijlstra 写道:
> On Wed, Nov 16, 2016 at 12:19:09PM +0800, Pan Xinhui wrote:
>> Hi, Peter.
>> I think we can avoid a function call in a simpler way. How about below
>>
>> static inline bool vcpu_is_preempted(int cpu)
>> {
>> /* only set in pv case*/
>> if (pv_lock_ops.vcpu_is_preempted)
>> return pv_lock_ops.vcpu_is_preempted(cpu);
>> return false;
>> }
>
> That is still more expensive. It needs to do an actual load and makes it
> hard to predict the branch, you'd have to actually wait for the load to
> complete etc.
>
yes, one more load in native case. I think this is acceptable as vcpu_is_preempted is not a critical function.
however if we use pv_callee_save_regs_thunk, more unnecessary registers might be save/resotred in pv case.
that will introduce a little overhead.
but I think I am okay with your idea. I can make another patch based on this patchset with your suggested-by.
thanks
xinhui
> Also, it generates more code.
>
> Paravirt muck should strive to be as cheap as possible when ran on
> native hardware.
>
Powered by blists - more mailing lists