Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756997AbbKRUuU (ORCPT ); Wed, 18 Nov 2015 15:50:20 -0500 Received: from mail-oi0-f47.google.com ([209.85.218.47]:34948 "EHLO mail-oi0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756912AbbKRUuR (ORCPT ); Wed, 18 Nov 2015 15:50:17 -0500 MIME-Version: 1.0 In-Reply-To: References: <1447877179-2775-1-git-send-email-boris.ostrovsky@oracle.com> <1447877179-2775-2-git-send-email-boris.ostrovsky@oracle.com> Date: Wed, 18 Nov 2015 15:50:16 -0500 Message-ID: Subject: Re: [PATCH 1/3] x86/xen: Avoid fast syscall path for Xen PV guests From: Brian Gerst To: Andy Lutomirski Cc: Boris Ostrovsky , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , David Vrabel , Konrad Rzeszutek Wilk , Andrew Lutomirski , Borislav Petkov , "linux-kernel@vger.kernel.org" , "xen-devel@lists.xenproject.org" , Linux Virtualization Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1871 Lines: 50 On Wed, Nov 18, 2015 at 3:21 PM, Andy Lutomirski wrote: > On Wed, Nov 18, 2015 at 12:06 PM, Boris Ostrovsky > wrote: >> After 32-bit syscall rewrite, and specifically after commit 5f310f739b4c >> ("x86/entry/32: Re-implement SYSENTER using the new C path"), the stack >> frame that is passed to xen_sysexit is no longer a "standard" one (i.e. >> it's not pt_regs). >> >> Since we end up calling xen_iret from xen_sysexit we don't need to fix >> up the stack and instead follow entry_SYSENTER_32's IRET path directly >> to xen_iret. >> >> We can do the same thing for compat mode even though stack does not need >> to be fixed. This will allow us to drop usergs_sysret32 paravirt op (in >> the subsequent patch) > > Looks generally quite nice. Minor comments below: > >> --- 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 >> + /* XEN PV guests always use IRET path */ >> + ALTERNATIVE "testl %eax, %eax", "xor %eax, %eax", X86_FEATURE_XENPV >> jz .Lsyscall_32_done > > Could we make this a little less subtle: > > ALTERNATIVE "testl %eax, %eax; lz .Lsyscall_32_done", "jmp > .Lsyscasll_32_done", X86_FEATURE_XENPV > > Borislav, what do you think? > > Ditto for the others. Can you just add !xen_pv_domain() to the opportunistic SYSRET check instead? Bury the alternatives in that macro, ie. static_cpu_has(X86_FEATURE_XENPV). That would likely benefit other code as well. -- Brian Gerst -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/