From patchwork Wed Oct 5 14:42:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Razvan Cojocaru X-Patchwork-Id: 9363067 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 641D36075E for ; Wed, 5 Oct 2016 14:45:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 56E992899C for ; Wed, 5 Oct 2016 14:45:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B6FD289FC; Wed, 5 Oct 2016 14:45:44 +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 994A32899C for ; Wed, 5 Oct 2016 14:45:40 +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 1brnPQ-0002Em-FI; Wed, 05 Oct 2016 14:43:00 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1brnPP-0002Eg-Sa for xen-devel@lists.xen.org; Wed, 05 Oct 2016 14:42:59 +0000 Received: from [193.109.254.147] by server-4.bemta-6.messagelabs.com id 9F/3D-29421-37115F75; Wed, 05 Oct 2016 14:42:59 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprEIsWRWlGSWpSXmKPExsUSfTxjoW6R4Nd wg/ubVC2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oyJ35sYCz5wVqy/e4y5gbGVo4uRk0NIwF1i 6uSD7F2MXED2GkaJvRf3MUI41xglPp77xQJR5SaxfsJ1NojEPkaJZ+1NYAk2AUOJ1Rtb2EBsE QFpiWufLzOC2MwClRKdXy4B2RwcwgIhEk8nWYCEWQRUJU4++8UGEuYV8JR4diYEJCwhICdx8t hkVgg7R+Ly+gawEgkBKYn/rUogWyUEulkkGs5sYIKokZF4NPEm2wRGgQWMDKsYNYpTi8pSi3S NjPSSijLTM0pyEzNzdA0NzPRyU4uLE9NTcxKTivWS83M3MQLDigEIdjCumR94iFGSg0lJlHcT x9dwIb6k/JTKjMTijPii0pzU4kOMMhwcShK8XgJAOcGi1PTUirTMHGCAw6QlOHiURHiLQdK8x QWJucWZ6RCpU4yKUuK8jCAJAZBERmkeXBssqi4xykoJ8zICHSLEU5BalJtZgir/ilGcg1FJmD ceZApPZl4J3PRXQIuZgBbnL/0CsrgkESEl1cA4cfHLiUX7+b6wlFvabwpZ0v3t6Is9TrM8I9f +d63cHm79YgXbFP+/H6cUVD58bPLaVHNW9r8/dp8OxYa4bIj7OldM2Jt7+X6F1G9P25ylrKNf PT1qLpGvvuCD7oW/sWcunLbuD3j24NHcDb5hUQun7dx6flXebg0eztuqX5a5r2l8bP2Lh2nDR yWW4oxEQy3mouJEAGA4vvylAgAA X-Env-Sender: rcojocaru@bitdefender.com X-Msg-Ref: server-3.tower-27.messagelabs.com!1475678577!63211095!1 X-Originating-IP: [91.199.104.161] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 44526 invoked from network); 5 Oct 2016 14:42:58 -0000 Received: from mx01.bbu.dsd.mx.bitdefender.com (HELO mx01.bbu.dsd.mx.bitdefender.com) (91.199.104.161) by server-3.tower-27.messagelabs.com with DHE-RSA-AES128-GCM-SHA256 encrypted SMTP; 5 Oct 2016 14:42:58 -0000 Received: (qmail 25064 invoked from network); 5 Oct 2016 17:42:57 +0300 Received: from unknown (HELO mx-sr.buh.bitdefender.com) (10.17.80.103) by mx01.bbu.dsd.mx.bitdefender.com with AES256-GCM-SHA384 encrypted SMTP; 5 Oct 2016 17:42:57 +0300 Received: from smtp02.buh.bitdefender.net (smtp.bitdefender.biz [10.17.80.76]) by mx-sr.buh.bitdefender.com (Postfix) with ESMTP id D028B7FC21 for ; Wed, 5 Oct 2016 17:42:56 +0300 (EEST) Received: (qmail 9447 invoked from network); 5 Oct 2016 17:42:56 +0300 Received: from xen.dsd.ro (HELO xen.dsd.bitdefender.biz) (rcojocaru@bitdefender.com@10.10.14.109) by smtp02.buh.bitdefender.net with AES128-SHA256 encrypted SMTP; 5 Oct 2016 17:42:56 +0300 From: Razvan Cojocaru To: xen-devel@lists.xen.org Date: Wed, 5 Oct 2016 17:42:15 +0300 Message-Id: <1475678535-11241-1-git-send-email-rcojocaru@bitdefender.com> X-Mailer: git-send-email 1.9.1 X-BitDefender-Scanner: Clean, Agent: BitDefender qmail 3.1.6 on smtp02.buh.bitdefender.net, sigver: 7.67485 X-BitDefender-Spam: No (0) X-BitDefender-SpamStamp: Build: [Engines: 2.15.6.911, Dats: 433583, Stamp: 3], Multi: [Enabled, t: (0.000008, 0.001593)], BW: [Enabled, t: (0.000007,0.000001)], RBL DNSBL: [Disabled], APM: [Enabled, Score: 500, t: (0.002345), Flags: 85D2ED72; NN_NO_CONTENT_TYPE; NN_NO_LINK_NMD; NN_LEGIT_BITDEFENDER; NN_LEGIT_S_SQARE_BRACKETS; NN_LEGIT_MAILING_LIST_TO], SGN: [Enabled, t: (0.006459)], URL: [Enabled, t: (0.000007)], RTDA: [Enabled, t: (0.072006), Hit: No, Details: v2.3.11; Id: 2m1gj0i.1auag7af3.593k], total: 0(775) X-BitDefender-CF-Stamp: none Cc: andrew.cooper3@citrix.com, paul.durrant@citrix.com, Razvan Cojocaru , jbeulich@suse.com Subject: [Xen-devel] [PATCH V2] x86/hvm: Remove emulation context setting from hvmemul_cmpxchg() 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: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP hvmemul_cmpxchg() sets the read emulation context in p_new instead of p_old, which is inconsistent (and wrong). Since p_old is unused in any case and cmpxchg() semantics would be altered even if it wasn't, remove the emulation context setting code. Suggested-by: Jan Beulich Signed-off-by: Razvan Cojocaru --- Changes since V1: - Modified patch subject and description. - Removed the context setting code altogether. --- xen/arch/x86/hvm/emulate.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c index d759d3f..6ed7486 100644 --- a/xen/arch/x86/hvm/emulate.c +++ b/xen/arch/x86/hvm/emulate.c @@ -1026,17 +1026,6 @@ static int hvmemul_cmpxchg( unsigned int bytes, struct x86_emulate_ctxt *ctxt) { - struct hvm_emulate_ctxt *hvmemul_ctxt = - container_of(ctxt, struct hvm_emulate_ctxt, ctxt); - - if ( unlikely(hvmemul_ctxt->set_context) ) - { - int rc = set_context_data(p_new, bytes); - - if ( rc != X86EMUL_OKAY ) - return rc; - } - /* Fix this in case the guest is really relying on r-m-w atomicity. */ return hvmemul_write(seg, offset, p_new, bytes, ctxt); }