From patchwork Thu Mar 10 09:55:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 8554701 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 52B5D9F7CA for ; Thu, 10 Mar 2016 09:57:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 79100201BB for ; Thu, 10 Mar 2016 09:57:45 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 831692010E for ; Thu, 10 Mar 2016 09:57:44 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1adxJP-0000f3-U0; Thu, 10 Mar 2016 09:55:19 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1adxJP-0000ep-EM for xen-devel@lists.xenproject.org; Thu, 10 Mar 2016 09:55:19 +0000 Received: from [193.109.254.147] by server-2.bemta-14.messagelabs.com id 21/D3-03301-68441E65; Thu, 10 Mar 2016 09:55:18 +0000 X-Env-Sender: JBeulich@suse.com X-Msg-Ref: server-14.tower-27.messagelabs.com!1457603716!17940975!1 X-Originating-IP: [137.65.248.74] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 15003 invoked from network); 10 Mar 2016 09:55:17 -0000 Received: from prv-mh.provo.novell.com (HELO prv-mh.provo.novell.com) (137.65.248.74) by server-14.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 10 Mar 2016 09:55:17 -0000 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Thu, 10 Mar 2016 02:55:15 -0700 Message-Id: <56E1529202000078000DB24F@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.0 Date: Thu, 10 Mar 2016 02:55:14 -0700 From: "Jan Beulich" To: "xen-devel" References: <56E14FF502000078000DB232@prv-mh.provo.novell.com> In-Reply-To: <56E14FF502000078000DB232@prv-mh.provo.novell.com> Mime-Version: 1.0 Cc: Andrew Cooper , Keir Fraser , Feng Wu Subject: [Xen-devel] [PATCH v2 3/3] x86: use 32-bit loads for 32-bit PV guest state reload X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This is slightly more efficient than loading 64-bit quantities. Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper x86: use 32-bit loads for 32-bit PV guest state reload This is slightly more efficient than loading 64-bit quantities. Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper --- a/xen/include/asm-x86/asm_defns.h +++ b/xen/include/asm-x86/asm_defns.h @@ -313,6 +313,13 @@ static always_inline void stac(void) 987: .endm +#define LOAD_ONE_REG(reg, compat) \ +.if !(compat); \ + movq UREGS_r##reg(%rsp),%r##reg; \ +.else; \ + movl UREGS_r##reg(%rsp),%e##reg; \ +.endif + /* * Reload registers not preserved by C code from frame. * @@ -326,16 +333,14 @@ static always_inline void stac(void) movq UREGS_r10(%rsp),%r10 movq UREGS_r9(%rsp),%r9 movq UREGS_r8(%rsp),%r8 -.if \ax - movq UREGS_rax(%rsp),%rax .endif -.elseif \ax - movl UREGS_rax(%rsp),%eax +.if \ax + LOAD_ONE_REG(ax, \compat) .endif - movq UREGS_rcx(%rsp),%rcx - movq UREGS_rdx(%rsp),%rdx - movq UREGS_rsi(%rsp),%rsi - movq UREGS_rdi(%rsp),%rdi + LOAD_ONE_REG(cx, \compat) + LOAD_ONE_REG(dx, \compat) + LOAD_ONE_REG(si, \compat) + LOAD_ONE_REG(di, \compat) .endm /* @@ -372,8 +377,9 @@ static always_inline void stac(void) .subsection 0 #endif .endif -987: movq UREGS_rbp(%rsp),%rbp - movq UREGS_rbx(%rsp),%rbx +987: + LOAD_ONE_REG(bp, \compat) + LOAD_ONE_REG(bx, \compat) subq $-(UREGS_error_code-UREGS_r15+\adj), %rsp .endm --- a/xen/include/asm-x86/asm_defns.h +++ b/xen/include/asm-x86/asm_defns.h @@ -313,6 +313,13 @@ static always_inline void stac(void) 987: .endm +#define LOAD_ONE_REG(reg, compat) \ +.if !(compat); \ + movq UREGS_r##reg(%rsp),%r##reg; \ +.else; \ + movl UREGS_r##reg(%rsp),%e##reg; \ +.endif + /* * Reload registers not preserved by C code from frame. * @@ -326,16 +333,14 @@ static always_inline void stac(void) movq UREGS_r10(%rsp),%r10 movq UREGS_r9(%rsp),%r9 movq UREGS_r8(%rsp),%r8 -.if \ax - movq UREGS_rax(%rsp),%rax .endif -.elseif \ax - movl UREGS_rax(%rsp),%eax +.if \ax + LOAD_ONE_REG(ax, \compat) .endif - movq UREGS_rcx(%rsp),%rcx - movq UREGS_rdx(%rsp),%rdx - movq UREGS_rsi(%rsp),%rsi - movq UREGS_rdi(%rsp),%rdi + LOAD_ONE_REG(cx, \compat) + LOAD_ONE_REG(dx, \compat) + LOAD_ONE_REG(si, \compat) + LOAD_ONE_REG(di, \compat) .endm /* @@ -372,8 +377,9 @@ static always_inline void stac(void) .subsection 0 #endif .endif -987: movq UREGS_rbp(%rsp),%rbp - movq UREGS_rbx(%rsp),%rbx +987: + LOAD_ONE_REG(bp, \compat) + LOAD_ONE_REG(bx, \compat) subq $-(UREGS_error_code-UREGS_r15+\adj), %rsp .endm