All of lore.kernel.org
 help / color / mirror / Atom feed
From: hpa@zytor.com
To: Peter Zijlstra <peterz@infradead.org>, Waiman Long <longman@redhat.com>
Cc: "Jeremy Fitzhardinge" <jeremy@goop.org>,
	"Chris Wright" <chrisw@sous-sol.org>,
	"Alok Kataria" <akataria@vmware.com>,
	"Rusty Russell" <rusty@rustcorp.com.au>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	linux-arch@vger.kernel.org, x86@kernel.org,
	linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	xen-devel@lists.xenproject.org, kvm@vger.kernel.org,
	"Pan Xinhui" <xinhui.pan@linux.vnet.ibm.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Boris Ostrovsky" <boris.ostrovsky@oracle.com>,
	"Juergen Gross" <jgross@suse.com>
Subject: Re: [PATCH v2] x86/paravirt: Don't make vcpu_is_preempted() a callee-save function
Date: Mon, 13 Feb 2017 14:07:51 -0800	[thread overview]
Message-ID: <8BDFD84E-33DB-4017-8229-6E87F4F7A861@zytor.com> (raw)
In-Reply-To: <20170213215220.GN25813@worktop.programming.kicks-ass.net>

On February 13, 2017 1:52:20 PM PST, Peter Zijlstra <peterz@infradead.org> wrote:
>On Mon, Feb 13, 2017 at 03:12:45PM -0500, Waiman Long wrote:
>> On 02/13/2017 02:42 PM, Waiman Long wrote:
>> > On 02/13/2017 05:53 AM, Peter Zijlstra wrote:
>> >> On Mon, Feb 13, 2017 at 11:47:16AM +0100, Peter Zijlstra wrote:
>> >>> 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)));
>> >>>
>> >>> And if we could get rid of the sign extend on edi we could avoid
>all the
>> >>> 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;
>> >>
>> >> ?
>> > Yes, that looks good to me.
>> >
>> > Cheers,
>> > Longman
>> >
>> Sorry, I am going to take it back. The displacement or offset can
>only
>> 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
>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
>too big.

Oh, and unless you are explicitly forcing 32-bit addressing mode, displacements are always "e" (or "m" if you let gcc pick the addressing mode.)
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

WARNING: multiple messages have this Message-ID (diff)
From: hpa@zytor.com
To: Peter Zijlstra <peterz@infradead.org>, Waiman Long <longman@redhat.com>
Cc: linux-arch@vger.kernel.org, "Juergen Gross" <jgross@suse.com>,
	"Jeremy Fitzhardinge" <jeremy@goop.org>,
	x86@kernel.org, kvm@vger.kernel.org,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Boris Ostrovsky" <boris.ostrovsky@oracle.com>,
	"Pan Xinhui" <xinhui.pan@linux.vnet.ibm.com>,
	linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	"Chris Wright" <chrisw@sous-sol.org>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	xen-devel@lists.xenproject.org,
	"Alok Kataria" <akataria@vmware.com>,
	"Thomas Gleixner" <tglx@linutronix.de>
Subject: Re: [PATCH v2] x86/paravirt: Don't make vcpu_is_preempted() a callee-save function
Date: Mon, 13 Feb 2017 14:07:51 -0800	[thread overview]
Message-ID: <8BDFD84E-33DB-4017-8229-6E87F4F7A861@zytor.com> (raw)
In-Reply-To: <20170213215220.GN25813@worktop.programming.kicks-ass.net>

On February 13, 2017 1:52:20 PM PST, Peter Zijlstra <peterz@infradead.org> wrote:
>On Mon, Feb 13, 2017 at 03:12:45PM -0500, Waiman Long wrote:
>> On 02/13/2017 02:42 PM, Waiman Long wrote:
>> > On 02/13/2017 05:53 AM, Peter Zijlstra wrote:
>> >> On Mon, Feb 13, 2017 at 11:47:16AM +0100, Peter Zijlstra wrote:
>> >>> 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)));
>> >>>
>> >>> And if we could get rid of the sign extend on edi we could avoid
>all the
>> >>> 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;
>> >>
>> >> ?
>> > Yes, that looks good to me.
>> >
>> > Cheers,
>> > Longman
>> >
>> Sorry, I am going to take it back. The displacement or offset can
>only
>> 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
>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
>too big.

Oh, and unless you are explicitly forcing 32-bit addressing mode, displacements are always "e" (or "m" if you let gcc pick the addressing mode.)
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

  parent reply	other threads:[~2017-02-13 22:15 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-10 15:43 [PATCH v2] x86/paravirt: Don't make vcpu_is_preempted() a callee-save function Waiman Long
2017-02-10 15:43 ` Waiman Long
2017-02-10 16:19 ` Peter Zijlstra
2017-02-10 16:19 ` Peter Zijlstra
2017-02-10 16:19   ` Peter Zijlstra
2017-02-10 16:35   ` Waiman Long
2017-02-10 16:35     ` Waiman Long
2017-02-10 17:00     ` Waiman Long
2017-02-10 17:00     ` Waiman Long
2017-02-10 17:00       ` Waiman Long
2017-02-13 10:47       ` Peter Zijlstra
2017-02-13 10:47       ` Peter Zijlstra
2017-02-13 10:47         ` Peter Zijlstra
2017-02-13 10:53         ` Peter Zijlstra
2017-02-13 10:53         ` Peter Zijlstra
2017-02-13 10:53           ` Peter Zijlstra
2017-02-13 19:42           ` Waiman Long
2017-02-13 19:42           ` Waiman Long
2017-02-13 19:42           ` Waiman Long
2017-02-13 20:12             ` Waiman Long
2017-02-13 20:12               ` Waiman Long
2017-02-13 21:52               ` Peter Zijlstra
2017-02-13 21:52               ` Peter Zijlstra
2017-02-13 21:52                 ` Peter Zijlstra
2017-02-13 22:00                 ` hpa
2017-02-13 22:00                 ` hpa
2017-02-13 22:00                   ` hpa
2017-02-13 22:07                 ` hpa [this message]
2017-02-13 22:07                   ` hpa
2017-02-13 22:07                 ` hpa
2017-02-13 22:34                 ` Waiman Long
2017-02-13 22:34                 ` Waiman Long
2017-02-13 22:34                   ` Waiman Long
2017-02-13 22:36                   ` hpa
2017-02-13 22:36                     ` hpa
2017-02-13 22:36                   ` hpa
2017-02-14  9:39                   ` Peter Zijlstra
2017-02-14  9:39                   ` Peter Zijlstra
2017-02-14  9:39                     ` Peter Zijlstra
2017-02-14 14:46                     ` Waiman Long
2017-02-14 14:46                     ` Waiman Long
2017-02-14 14:46                       ` Waiman Long
2017-02-14 16:03                       ` Peter Zijlstra
2017-02-14 16:03                       ` Peter Zijlstra
2017-02-14 16:03                         ` Peter Zijlstra
2017-02-14 16:18                       ` [Xen-devel] " Andrew Cooper
2017-02-14 16:18                       ` Andrew Cooper
2017-02-14 16:18                       ` [Xen-devel] " Andrew Cooper
2017-02-13 20:12             ` Waiman Long
2017-02-13 20:06           ` hpa
2017-02-13 20:06             ` hpa
2017-02-13 21:57             ` Peter Zijlstra
2017-02-13 21:57               ` Peter Zijlstra
2017-02-13 21:57             ` Peter Zijlstra
2017-02-13 22:24             ` Waiman Long
2017-02-13 22:24               ` Waiman Long
2017-02-13 22:31               ` Peter Zijlstra
2017-02-13 22:31               ` Peter Zijlstra
2017-02-13 22:31                 ` Peter Zijlstra
2017-02-13 22:24             ` Waiman Long
2017-02-13 20:06           ` hpa
2017-02-13 19:41         ` Waiman Long
2017-02-13 19:41         ` Waiman Long
2017-02-13 19:41         ` Waiman Long
2017-02-10 16:35   ` Waiman Long
2017-02-10 16:22 ` Paolo Bonzini
2017-02-10 16:22 ` Paolo Bonzini
2017-02-10 16:22   ` Paolo Bonzini
  -- strict thread matches above, loose matches on Subject: below --
2017-02-10 15:43 Waiman Long

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8BDFD84E-33DB-4017-8229-6E87F4F7A861@zytor.com \
    --to=hpa@zytor.com \
    --cc=akataria@vmware.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=chrisw@sous-sol.org \
    --cc=jeremy@goop.org \
    --cc=jgross@suse.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rkrcmar@redhat.com \
    --cc=rusty@rustcorp.com.au \
    --cc=tglx@linutronix.de \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    --cc=xinhui.pan@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.