Thread (13 messages) 13 messages, 4 authors, 2017-02-13

Re: [PATCH v2] x86/paravirt: Don't make vcpu_is_preempted() a callee-save function

flat view

From: Waiman Long <longman@redhat.com>
Date: 2017-02-13 22:24:41
Also in: kvm, linux-arch, lkml

On 02/13/2017 03:06 PM, hpa@zytor.com wrote:
On February 13, 2017 2:53:43 AM PST, Peter Zijlstra [off-list ref] wrote:
quoted
On Mon, Feb 13, 2017 at 11:47:16AM +0100, Peter Zijlstra wrote:
quoted
That way we'd end up with something like:

asm("
push %rdi;
movslq %edi, %rdi;
movq __per_cpu_offset(,%rdi,8), %rax;
cmpb $0, %[offset](%rax);
setne %al;
pop %rdi;
" : : [offset] "i" (((unsigned long)&steal_time) + offsetof(struct
steal_time, preempted)));
quoted
And if we could get rid of the sign extend on edi we could avoid all
the
quoted
push-pop nonsense, but I'm not sure I see how to do that (then again,
this asm foo isn't my strongest point).
Maybe:

movsql %edi, %rax;
movq __per_cpu_offset(,%rax,8), %rax;
cmpb $0, %[offset](%rax);
setne %al;

?
We could kill the zero or sign extend by changing the calling interface to pass an unsigned long instead of an int.  It is much more likely that a zero extend is free for the caller than a sign extend.
I have thought of that too. However, the goal is to eliminate memory
read/write from/to stack. Eliminating a register sign-extend instruction
won't help much in term of performance.

Cheers,
Longman
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help