From patchwork Wed Jun 8 12:50:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 9164521 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 90EE560467 for ; Wed, 8 Jun 2016 12:53:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8124328179 for ; Wed, 8 Jun 2016 12:53:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 750D22823D; Wed, 8 Jun 2016 12:53:11 +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 7B61528179 for ; Wed, 8 Jun 2016 12:53:10 +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 1bAcwr-0007AJ-1b; Wed, 08 Jun 2016 12:51:05 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bAcwp-0007A1-8B for xen-devel@lists.xenproject.org; Wed, 08 Jun 2016 12:51:03 +0000 Received: from [85.158.137.68] by server-7.bemta-3.messagelabs.com id 26/F1-15536-6B418575; Wed, 08 Jun 2016 12:51:02 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrEIsWRWlGSWpSXmKPExsXS6fjDS3erSES 4wZf3ahbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8baU7cYC14IVSztP8LewLiTt4uRk0NIIE/i xs/vTF2MHBy8AnYSXy7GgoQlBAwl9s1fxQZiswioSly+coUFxGYTUJdoe7adFaRcRMBA4tzRJ JAws0C0xIkDvxhBbGEBY4lzZxrZICYKSvzdIQxRYiex8vdWpgmMXLMQMrOQZCBsLYmHv26xQN jaEssWvmYGKWcWkJZY/o8DImwpceDcBmZMJS4S9/tiFzByrGJUL04tKkst0jXVSyrKTM8oyU3 MzNE1NDDWy00tLk5MT81JTCrWS87P3cQIDLt6BgbGHYyXvzodYpTkYFIS5VV0Dw8X4kvKT6nM SCzOiC8qzUktPsQow8GhJMH7RCgiXEiwKDU9tSItMwcYATBpCQ4eJRFeXWGgNG9xQWJucWY6R OoUo6KUOK8sSEIAJJFRmgfXBou6S4yyUsK8jAwMDEI8BalFuZklqPKvGMU5GJWEeblBpvBk5p XATX8FtJgJaPHyI+Egi0sSEVJSDYyGZjlnJfravjF1N4n2fZj9n41JeNOC8vsTTk2NNskP2Gz 2+H75OrXM159cMvaXLv255vwE/gL3w1vsZpw6dSjgQtnxqv1yatPvM87+6rb1hI3yrNwDE26f CvoptYG9w0zhxAsmFrF1B35sVFnww2T7mUSxnYudWs4sys56pHHqWNn8B0tN64JrlFiKMxINt ZiLihMBDa75W7UCAAA= X-Env-Sender: JBeulich@suse.com X-Msg-Ref: server-9.tower-31.messagelabs.com!1465390259!7693220!1 X-Originating-IP: [137.65.248.74] X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50 X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 37132 invoked from network); 8 Jun 2016 12:51:01 -0000 Received: from prv-mh.provo.novell.com (HELO prv-mh.provo.novell.com) (137.65.248.74) by server-9.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 8 Jun 2016 12:51:01 -0000 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Wed, 08 Jun 2016 06:50:59 -0600 Message-Id: <575830D002000078000F309E@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.0 Date: Wed, 08 Jun 2016 06:50:56 -0600 From: "Jan Beulich" To: "xen-devel" Mime-Version: 1.0 Cc: Andrew Cooper , Shuai Ruan Subject: [Xen-devel] [PATCH] x86/XSTATE: clarify XRSTOR() macro 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 Make obvious that xcomp_bv is expected to be clear when we get here with XSTATE_COMPACTION_ENABLED not set. Signed-off-by: Jan Beulich x86/XSTATE: clarify XRSTOR() macro Make obvious that xcomp_bv is expected to be clear when we get here with XSTATE_COMPACTION_ENABLED not set. Signed-off-by: Jan Beulich --- a/xen/arch/x86/xstate.c +++ b/xen/arch/x86/xstate.c @@ -387,8 +387,11 @@ void xrstor(struct vcpu *v, uint64_t mas { \ if ( unlikely(!(ptr->xsave_hdr.xcomp_bv & \ XSTATE_COMPACTION_ENABLED)) ) \ - ptr->xsave_hdr.xcomp_bv |= ptr->xsave_hdr.xstate_bv | \ - XSTATE_COMPACTION_ENABLED; \ + { \ + ASSERT(!ptr->xsave_hdr.xcomp_bv); \ + ptr->xsave_hdr.xcomp_bv = ptr->xsave_hdr.xstate_bv | \ + XSTATE_COMPACTION_ENABLED; \ + } \ _xrstor(pfx "0x0f,0xc7,0x1f"); /* xrstors */ \ } \ else \ Reviewed-by: Shuai Ruan --- a/xen/arch/x86/xstate.c +++ b/xen/arch/x86/xstate.c @@ -387,8 +387,11 @@ void xrstor(struct vcpu *v, uint64_t mas { \ if ( unlikely(!(ptr->xsave_hdr.xcomp_bv & \ XSTATE_COMPACTION_ENABLED)) ) \ - ptr->xsave_hdr.xcomp_bv |= ptr->xsave_hdr.xstate_bv | \ - XSTATE_COMPACTION_ENABLED; \ + { \ + ASSERT(!ptr->xsave_hdr.xcomp_bv); \ + ptr->xsave_hdr.xcomp_bv = ptr->xsave_hdr.xstate_bv | \ + XSTATE_COMPACTION_ENABLED; \ + } \ _xrstor(pfx "0x0f,0xc7,0x1f"); /* xrstors */ \ } \ else \