Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1523393

Re: [PATCH v7 06/11] x86, paravirt: Add interface to support kvm/xen vcpu preempted check

From Christian Borntraeger <borntraeger@de.ibm.com>
Newsgroups linux.kernel
Subject Re: [PATCH v7 06/11] x86, paravirt: Add interface to support kvm/xen vcpu preempted check
Date 2016-11-16 12:40 +0100
Message-ID <sE6Jj-2bm-5@gated-at.bofh.it> (permalink)
References <syW7T-1Vz-3@gated-at.bofh.it> <syW7U-1Vz-23@gated-at.bofh.it> <sDO9H-6Nu-13@gated-at.bofh.it> <sDZRv-62y-5@gated-at.bofh.it> <sE5Dz-1Aj-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 11/16/2016 11:23 AM, Peter Zijlstra wrote:
> 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.

Out of curiosity, why is that hard to predict?
On s390 the branch prediction runs asynchronously ahead of the downstream
pipeline (e.g. search for "IBM z Systems Processor Optimization Primer" page 11).
given enough capacity, I would assume that modern x86 processors would do the same
and be able to predict this is as soon as it becomes hot (and otherwise you would
 not notice the branch miss anyway). Is x86 behaving differently here?

> Also, it generates more code.
> 
> Paravirt muck should strive to be as cheap as possible when ran on
> native hardware.

As I am interested in this series from the s390 point of view, this is 
the only thing that block this series?

Is there a chance to add a static key around the paravirt ops somehow?

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v7 06/11] x86, paravirt: Add interface to support kvm/xen  vcpu preempted check Peter Zijlstra <peterz@infradead.org> - 2016-11-15 16:50 +0100
  Re: [PATCH v7 06/11] x86, paravirt: Add interface to support kvm/xen  vcpu preempted check Pan Xinhui <xinhui@linux.vnet.ibm.com> - 2016-11-16 05:20 +0100
    Re: [PATCH v7 06/11] x86, paravirt: Add interface to support kvm/xen  vcpu preempted check Peter Zijlstra <peterz@infradead.org> - 2016-11-16 11:30 +0100
      Re: [PATCH v7 06/11] x86, paravirt: Add interface to support kvm/xen  vcpu preempted check Christian Borntraeger <borntraeger@de.ibm.com> - 2016-11-16 12:40 +0100
        Re: [PATCH v7 06/11] x86, paravirt: Add interface to support kvm/xen  vcpu preempted check Peter Zijlstra <peterz@infradead.org> - 2016-11-16 12:50 +0100
      Re: [PATCH v7 06/11] x86, paravirt: Add interface to support kvm/xen  vcpu preempted check Pan Xinhui <xinhui@linux.vnet.ibm.com> - 2016-11-17 06:20 +0100

csiph-web