public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: "H. Peter Anvin" <hpa@zytor.com>, Borislav Petkov <bp@alien8.de>,
	Andy Lutomirski <luto@amacapital.net>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	xen-devel <xen-devel@lists.xen.org>,
	David Vrabel <david.vrabel@citrix.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: Re: [PATCH] xen/x86: Adjust stack pointer in xen_sysexit
Date: Tue, 17 Nov 2015 09:40:23 -0500	[thread overview]
Message-ID: <564B3C57.5000002@oracle.com> (raw)
In-Reply-To: <564A50C3.1000200@zytor.com>

On 11/16/2015 04:55 PM, H. Peter Anvin wrote:
> On 11/16/15 12:22, Borislav Petkov wrote:
>> Huh, so what's wrong with a jump:
>>
>> 	jmp 1f
>> 	swapgs
>> 	1:
>>
> What is the point of that jump?
>
>>> If it would make you feel better, it could be X86_BUG_XENPV :-p
>> That doesn't matter - I just don't want to open the flood gates on
>> pseudo feature bits.
>>
>> hpa, what do you think?
> Pseudo feature bits are fine, we already have plenty of them.  They make
> sense as they let us reuse a lot of infrastructure.


So how about something like this? And then I think we can remove 
usergs_sysret32 and irq_enable_sysexit pv ops completely as noone will 
use them (lguest doesn't set them)

diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S
index 3eb572e..c43df7b 100644
--- a/arch/x86/entry/entry_32.S
+++ b/arch/x86/entry/entry_32.S
@@ -308,7 +308,8 @@ sysenter_past_esp:

         movl    %esp, %eax
         call    do_fast_syscall_32
-       testl   %eax, %eax
+       /* PV guests always use IRET path */
+       ALTERNATIVE "testl %eax, %eax", "jmp .Lsyscall_32_done", 
X86_FEATURE_PV
         jz      .Lsyscall_32_done

  /* Opportunistic SYSEXIT */
diff --git a/arch/x86/entry/entry_64_compat.S 
b/arch/x86/entry/entry_64_compat.S
index c320183..2d1bc82 100644
--- a/arch/x86/entry/entry_64_compat.S
+++ b/arch/x86/entry/entry_64_compat.S
@@ -121,7 +121,7 @@ sysenter_flags_fixed:

         movq    %rsp, %rdi
         call    do_fast_syscall_32
-       testl   %eax, %eax
+       ALTERNATIVE "testl %eax, %eax", "jmp .Lsyscall_32_done", 
X86_FEATURE_PV
         jz      .Lsyscall_32_done
         jmp     sysret32_from_system_call

@@ -200,7 +200,8 @@ ENTRY(entry_SYSCALL_compat)

         movq    %rsp, %rdi
         call    do_fast_syscall_32
-       testl   %eax, %eax
+       /* PV guests always use IRET path */
+       ALTERNATIVE "testl %eax, %eax", "jmp .Lsyscall_32_done", 
X86_FEATURE_PV
         jz      .Lsyscall_32_done

         /* Opportunistic SYSRET */
diff --git a/arch/x86/include/asm/cpufeature.h 
b/arch/x86/include/asm/cpufeature.h
index e4f8010..723327b 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -216,6 +216,7 @@
  #define X86_FEATURE_PAUSEFILTER ( 8*32+13) /* AMD filtered pause 
intercept */
  #define X86_FEATURE_PFTHRESHOLD ( 8*32+14) /* AMD pause filter 
threshold */
  #define X86_FEATURE_VMMCALL     ( 8*32+15) /* Prefer vmmcall to vmcall */
+#define X86_FEATURE_PV          ( 8*32+16) /* Paravirtual guest */


  /* Intel-defined CPU features, CPUID level 0x00000007:0 (ebx), word 9 */



  reply	other threads:[~2015-11-17 14:40 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-13 23:18 [PATCH] xen/x86: Adjust stack pointer in xen_sysexit Boris Ostrovsky
2015-11-13 23:26 ` Andy Lutomirski
2015-11-14  1:23   ` Boris Ostrovsky
2015-11-15 18:02     ` Andy Lutomirski
2015-11-16 16:25       ` Boris Ostrovsky
2015-11-16 19:03         ` Andy Lutomirski
2015-11-16 19:59           ` Borislav Petkov
2015-11-16 20:11             ` Andy Lutomirski
2015-11-16 20:22               ` Borislav Petkov
2015-11-16 20:48                 ` Boris Ostrovsky
2015-11-16 20:50                   ` Andy Lutomirski
2015-11-16 21:00                     ` Borislav Petkov
     [not found]                     ` <20151116210314.GA10307@char.us.oracle.com>
2015-11-16 21:04                       ` Andy Lutomirski
2015-11-17 10:53                         ` Joao Martins
2015-11-16 21:55                 ` H. Peter Anvin
2015-11-17 14:40                   ` Boris Ostrovsky [this message]
2015-11-17 18:49                     ` Andy Lutomirski
2015-11-17 19:12                       ` [Xen-devel] " Andrew Cooper
2015-11-17 19:16                         ` Andy Lutomirski
2015-11-17 19:21                           ` Borislav Petkov
2015-11-17 19:29                           ` Andrew Cooper
2015-11-17 19:36                             ` Andy Lutomirski
2015-11-17 19:37                           ` Boris Ostrovsky
2015-11-17 19:38                             ` Boris Ostrovsky
2015-11-16 20:31           ` Boris Ostrovsky

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=564B3C57.5000002@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=bp@alien8.de \
    --cc=david.vrabel@citrix.com \
    --cc=hpa@zytor.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=xen-devel@lists.xen.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox