Thread (10 messages) 10 messages, 4 authors, 2017-02-14

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

flat view

From: hpa@zytor.com
Date: 2017-02-13 22:44:01
Also in: kvm, linux-arch, lkml

Possibly related (same subject, not in this thread)

On February 13, 2017 2:34:01 PM PST, Waiman Long [off-list ref] wrote:
On 02/13/2017 04:52 PM, Peter Zijlstra wrote:
quoted
On Mon, Feb 13, 2017 at 03:12:45PM -0500, Waiman Long wrote:
quoted
On 02/13/2017 02:42 PM, Waiman Long wrote:
quoted
On 02/13/2017 05:53 AM, Peter Zijlstra 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
quoted
quoted
quoted
quoted
And if we could get rid of the sign extend on edi we could avoid
all the
quoted
quoted
quoted
quoted
quoted
push-pop nonsense, but I'm not sure I see how to do that (then
again,
quoted
quoted
quoted
quoted
quoted
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;

?
Yes, that looks good to me.

Cheers,
Longman
Sorry, I am going to take it back. The displacement or offset can
only
quoted
quoted
be up to 32-bit. So we will still need to use at least one more
register, I think.
I don't think that would be a problem, I very much doubt we declare
more
quoted
than 4G worth of per-cpu variables in the kernel.

In any case, use "e" or "Z" as constraint (I never quite know when to
use which). That are s32 and u32 displacement immediates resp. and
should fail compile with a semi-sensible failure if the displacement
is
quoted
too big.
It is the address of &steal_time that will exceed the 32-bit limit.

Cheers,
Longman
That seems odd in the extreme?
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help