From patchwork Fri Oct 20 14:24:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 10020333 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9E84960234 for ; Fri, 20 Oct 2017 14:28:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89FBF28D48 for ; Fri, 20 Oct 2017 14:28:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E71A28D9F; Fri, 20 Oct 2017 14:28:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 1B31B28D48 for ; Fri, 20 Oct 2017 14:28:25 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e5YE3-0001W3-An; Fri, 20 Oct 2017 14:24:39 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e5YE1-0001V3-Kg for xen-devel@lists.xenproject.org; Fri, 20 Oct 2017 14:24:37 +0000 Received: from [193.109.254.147] by server-1.bemta-6.messagelabs.com id 2D/45-31121-4270AE95; Fri, 20 Oct 2017 14:24:36 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKIsWRWlGSWpSXmKPExsXS6fjDS1eF/VW kwfQXKhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bCg1+YC06zVux+0sbWwDiHpYuRk0NIIE/i 2dd1zCA2r4CdxLuOR6wgtoSAocTphTfBalgEVCWmvJkMZrMJqEu0PdsOVMPBISJgIHHuaBJIm FkgXOL7o142EFsYaMzi8z2MEOPtJP5dnM8OYnMK2EtM+DuLHaSVV0BQ4u8OYYhWLYmHv26xQN jaEssWvmYGKWEWkJZY/o9jAiPfLISGWUgaZiFpmIXQsICRZRWjenFqUVlqka6ZXlJRZnpGSW5 iZo6uoYGZXm5qcXFiempOYlKxXnJ+7iZGYOAxAMEOxnkn/A8xSnIwKYnyBla+jBTiS8pPqcxI LM6ILyrNSS0+xCjDwaEkwevF9ipSSLAoNT21Ii0zBxgDMGkJDh4lEd7JIGne4oLE3OLMdIjUK UZjjhsPr/9h4ui4efcPkxBLXn5eqpQ4bwxIqQBIaUZpHtwgWGxeYpSVEuZlBDpNiKcgtSg3sw RV/hWjOAejkjBvGsgUnsy8Erh9r4BOYQI6hd3+BcgpJYkIKakGRtkbZ5+kCIjPTfteyT6Rf/e i2JkKHzZvzLq1nzH/iYn5KulP/+zduvZcjfNOr3Wd5uC0V89M+8rJvvNHdVo9PxrOiJzG+KGW MZJ/W7zDEs6JswKXm94+Wnqy6qHQ9VlK3a+yDoa8/vBMZ2q+Q+GuvT0LrK4ULRC5JVPVpHnL8 f8/HuUPLruOiSqxFGckGmoxFxUnAgD8sYW+yAIAAA== X-Env-Sender: JBeulich@suse.com X-Msg-Ref: server-14.tower-27.messagelabs.com!1508509474!100193276!1 X-Originating-IP: [137.65.248.74] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 23294 invoked from network); 20 Oct 2017 14:24:36 -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; 20 Oct 2017 14:24:36 -0000 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Fri, 20 Oct 2017 08:24:34 -0600 Message-Id: <59EA23420200007800188C1C@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.2 Date: Fri, 20 Oct 2017 08:24:34 -0600 From: "Jan Beulich" To: "xen-devel" References: <59EA201F0200007800188BF5@prv-mh.provo.novell.com> In-Reply-To: <59EA201F0200007800188BF5@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Disposition: inline Cc: Andrew Cooper , Julien Grall Subject: [Xen-devel] [PATCH 3/3] x86: avoid FS/GS base reads when possible 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-Virus-Scanned: ClamAV using ClamSMTP They're being zeroed a few lines down when non-null selectors are being found in the respective registers. Signed-off-by: Jan Beulich --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -1449,10 +1449,11 @@ static void save_segments(struct vcpu *v if ( cpu_has_fsgsbase && !is_pv_32bit_vcpu(v) ) { - v->arch.pv_vcpu.fs_base = __rdfsbase(); + if ( !(regs->fs & ~3) ) + v->arch.pv_vcpu.fs_base = __rdfsbase(); if ( v->arch.flags & TF_kernel_mode ) v->arch.pv_vcpu.gs_base_kernel = __rdgsbase(); - else + else if ( !(regs->gs & ~3) ) v->arch.pv_vcpu.gs_base_user = __rdgsbase(); }