WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [linux-2.6.18-xen] x86-64: streamline syscall code

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [linux-2.6.18-xen] x86-64: streamline syscall code
From: Xen patchbot-linux-2.6.18-xen <patchbot@xxxxxxx>
Date: Wed, 05 Oct 2011 13:55:04 +0100
Delivery-date: Wed, 05 Oct 2011 05:55:10 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1317818689 -7200
# Node ID 5bda145fc6dcda60cd125699d7ece4bbade0660f
# Parent  4dd3a1d5b26796c1c10c5c2a0026832675aa615d
x86-64: streamline syscall code

System calls using the sysret exit path (or its VGCF_in_syscall IRET
equivalent on Xen) always go into user mode, hence the conditionals
in HYPERVISOR_IRET can be omitted entirely.

Further, there's no need to spill %rcx to the stack upon syscall entry
(neither does native code): No argument gets passed there, and due to
the use of the syscall instruction the register's contents don't need
to be preserved either.

Finally, rather than restoring %rcx and %r11 (not preserved by syscall/
sysret anyway) from the stack frame, we can as well simply clear them
out (to avoid leaking kernel data), thus reducing the necessary memory
(cache) bandwidth.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---


diff -r 4dd3a1d5b267 -r 5bda145fc6dc arch/x86_64/kernel/entry-xen.S
--- a/arch/x86_64/kernel/entry-xen.S    Wed Oct 05 14:42:56 2011 +0200
+++ b/arch/x86_64/kernel/entry-xen.S    Wed Oct 05 14:44:49 2011 +0200
@@ -153,6 +153,7 @@
          * with rax, r11, and rcx being taken care of in the hypercall stub.
          */
        .macro HYPERVISOR_IRET flag
+       .if \flag == 0  # return from syscall always uses the hypercall
        testb $3,1*8(%rsp)
        jnz   2f
        testl $NMI_MASK,2*8(%rsp)
@@ -165,6 +166,7 @@
        orl   $3,1*8(%rsp)
        orl   $3,4*8(%rsp)
 1:     iretq
+       .endif
 
 2:     /* Slow iret via hypervisor. */
        andl  $~NMI_MASK, 2*8(%rsp)
@@ -248,7 +250,7 @@
 
 ENTRY(system_call)
        _frame (RIP-0x10)
-       SAVE_ARGS -8,0
+       SAVE_ARGS -8,1
        movq  %rax,ORIG_RAX-ARGOFFSET(%rsp) 
        GET_THREAD_INFO(%rcx)
        testl 
$(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%rcx)
@@ -279,8 +281,9 @@
         * sysretq will re-enable interrupts:
         */
        TRACE_IRQS_ON
-        XEN_UNBLOCK_EVENTS(%rsi)                
-       RESTORE_ARGS 0,8,0
+       RESTORE_ARGS 0,8,1,1
+       xor %ecx,%ecx
+       xor %r11,%r11
         HYPERVISOR_IRET VGCF_IN_SYSCALL
 
        /* Handle reschedules */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [linux-2.6.18-xen] x86-64: streamline syscall code, Xen patchbot-linux-2 . 6 . 18-xen <=