From patchwork Sun Feb 14 08:38:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Razvan Cojocaru X-Patchwork-Id: 8301401 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D0087C02AE for ; Sun, 14 Feb 2016 08:42:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B6C55203DA for ; Sun, 14 Feb 2016 08:42:43 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A2ED5202DD for ; Sun, 14 Feb 2016 08:42:42 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aUsDD-0006Ii-BJ; Sun, 14 Feb 2016 08:39:23 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aUsDB-0006Id-V3 for xen-devel@lists.xen.org; Sun, 14 Feb 2016 08:39:22 +0000 Received: from [85.158.139.211] by server-14.bemta-5.messagelabs.com id 02/5E-18633-93D30C65; Sun, 14 Feb 2016 08:39:21 +0000 X-Env-Sender: rcojocaru@bitdefender.com X-Msg-Ref: server-11.tower-206.messagelabs.com!1455439159!9935255!1 X-Originating-IP: [91.199.104.161] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 24249 invoked from network); 14 Feb 2016 08:39:20 -0000 Received: from mx01.buh.bitdefender.com (HELO mx01.buh.bitdefender.com) (91.199.104.161) by server-11.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 14 Feb 2016 08:39:20 -0000 Comment: DomainKeys? See http://domainkeys.sourceforge.net/ DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=bitdefender.com; b=OfAlW8/wVM5NstgCg6KJvl6XsM5A0Z4SrPC1h4GyCEZtI8xHDKdWwjqqFd6WjAO6JrzvjwAqjoxKXpeFOLzWEHtJLxRKTdKjtfM1k1SfHx65jYtafDvbK5boOvk5EXd9rXfWQU3xrlUJTq16h2rp8oV6X9/K+xq79J86PVNSMCd6wu+wLOKYwEOrw4O5bmWht3PrCjXa1F/Y+WMQ5wRx6fg2w5sZ2RDphNQynzkv/8udk9lvW1vihH29uwxcF7Xprqxa5aziJKmx5D/zeMVppxXuoBDS5phN50eMUqWASlZxh+QWp6W0rcFTwhC/umAqnAMzq8jnPn7xsRJTMuP6KA==; h=Received:Received:Received:Received:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:X-BitDefender-Scanner:X-BitDefender-Spam:X-BitDefender-SpamStamp:X-BitDefender-CF-Stamp; DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bitdefender.com; h=from:to :cc:subject:date:message-id; s=default; bh=mMv+NfbDtlX1TwmHS3YoX +jgw+o=; b=xMF2pvGHwL8Ga+dEq01nyfJ6MqiahbtyQ6nKuxqhsX06QwaQ34Zl8 uHoEljNZKBD5WFLeedUbrnbmX5PkqKPIg2rHG4ETKsMTW+ybKpRikfVmIaJXNDy9 wBcziWyUNedKXzt/Da71vhgUU6uwRv2SX497G0xAoIJqXnlsZlWbqZsOO2516yml Sn9fqeyP54UJo1tx4LP6rbI4u8NohrsSL75OeW+LUhYLaYcVbYS/9Wfvn0iCJ/si RcIk2H658VV4/PITOaGXyWN4oQWTyyPaDpOkpGfgSJ83swqSqaxXtHof6Kahihw+ I9ZmmWvoZn0cuj2DW6TYOVyxlsQZ/CmUw== Received: (qmail 15744 invoked from network); 14 Feb 2016 10:39:18 +0200 Received: from unknown (HELO mx-sr.buh.bitdefender.com) (10.17.80.103) by mx01.buh.bitdefender.com with AES256-GCM-SHA384 encrypted SMTP; 14 Feb 2016 10:39:18 +0200 Received: from smtp02.buh.bitdefender.net (unknown [10.17.80.76]) by mx-sr.buh.bitdefender.com (Postfix) with ESMTP id C94177FBE0 for ; Sun, 14 Feb 2016 10:39:18 +0200 (EET) Received: (qmail 17418 invoked from network); 14 Feb 2016 10:39:18 +0200 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; 14 Feb 2016 10:39:17 +0200 From: Razvan Cojocaru To: xen-devel@lists.xen.org Date: Sun, 14 Feb 2016 10:38:58 +0200 Message-Id: <1455439138-19093-1-git-send-email-rcojocaru@bitdefender.com> X-Mailer: git-send-email 1.9.1 X-BitDefender-Scanner: Clean, Agent: BitDefender qmail 3.1.4 on smtp02.buh.bitdefender.net, sigver: 7.64497 X-BitDefender-Spam: No (0) X-BitDefender-SpamStamp: Build: [Engines: 2.15.6.743, Dats: 414167, Stamp: 3], Multi: [Enabled, t: (0.000009, 0.005774)], BW: [Enabled, t: (0.000005,0.000001)], RBL DNSBL: [Disabled], APM: [Enabled, Score: 500, t: (0.006161), Flags: 2A917CE3; NN_NO_CONTENT_TYPE; NN_LEGIT_SUMM_400_WORDS; NN_NO_LINK_NMD; NN_LEGIT_BITDEFENDER; NN_LEGIT_S_SQARE_BRACKETS; NN_LEGIT_MAILING_LIST_TO], SGN: [Enabled, t: (0.008753)], URL: [Enabled, t: (0.000005)], RTDA: [Enabled, t: (0.016402), Hit: No, Details: v2.3.3; Id: 2m1ghdn.1aaoi919p.615sf], total: 0(775) X-BitDefender-CF-Stamp: none Cc: tamas@tklengyel.com, wei.liu2@citrix.com, ian.campbell@citrix.com, Razvan Cojocaru , stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, stefano.stabellini@citrix.com, jbeulich@suse.com, keir@xen.org Subject: [Xen-devel] [PATCH V3] vm_event: Remove xc_mem_access_enable_emulate() and friends X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, 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 xc_mem_access_enable_emulate() and xc_mem_access_disable_emulate() are currently no-ops, that is all they do is set a flag that nobody else checks. The user can already set the EMULATE flags in the vm_event response if emulation is desired, and having an extra check above that is not inherently safer, but it does complicate (currenly unnecessarily) the API. This patch removes these functions and the corresponding hypervisor code. Signed-off-by: Razvan Cojocaru Acked-by: Tamas K Lengyel Acked-by: Jan Beulich Acked-by: Stefano Stabellini Acked-by: Wei Liu --- Changes since V1: - Commented-out the XENMEM_access_op_enable_emulate and XENMEM_access_op_disable_emulate #defines instead of simply removing them to prevent their reuse, as requested by Jan Beulich. --- tools/libxc/include/xenctrl.h | 11 ----------- tools/libxc/xc_mem_access.c | 24 ------------------------ xen/common/mem_access.c | 8 -------- xen/include/asm-arm/p2m.h | 14 -------------- xen/include/asm-x86/domain.h | 1 - xen/include/asm-x86/p2m.h | 24 ------------------------ xen/include/public/memory.h | 9 +++++++-- 7 files changed, 7 insertions(+), 84 deletions(-) diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h index 1a5f4ec..42eafa4 100644 --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -2101,17 +2101,6 @@ int xc_set_mem_access(xc_interface *xch, domid_t domain_id, int xc_get_mem_access(xc_interface *xch, domid_t domain_id, uint64_t pfn, xenmem_access_t *access); -/* - * Instructions causing a mem_access violation can be emulated by Xen - * to progress the execution without having to relax the mem_access - * permissions. - * This feature has to be first enabled, then in the vm_event - * response to a mem_access event it can be indicated if the instruction - * should be emulated. - */ -int xc_mem_access_enable_emulate(xc_interface *xch, domid_t domain_id); -int xc_mem_access_disable_emulate(xc_interface *xch, domid_t domain_id); - /*** * Monitor control operations. * diff --git a/tools/libxc/xc_mem_access.c b/tools/libxc/xc_mem_access.c index 3634c39..eee088c 100644 --- a/tools/libxc/xc_mem_access.c +++ b/tools/libxc/xc_mem_access.c @@ -62,30 +62,6 @@ int xc_get_mem_access(xc_interface *xch, return rc; } -int xc_mem_access_enable_emulate(xc_interface *xch, - domid_t domain_id) -{ - xen_mem_access_op_t mao = - { - .op = XENMEM_access_op_enable_emulate, - .domid = domain_id, - }; - - return do_memory_op(xch, XENMEM_access_op, &mao, sizeof(mao)); -} - -int xc_mem_access_disable_emulate(xc_interface *xch, - domid_t domain_id) -{ - xen_mem_access_op_t mao = - { - .op = XENMEM_access_op_disable_emulate, - .domid = domain_id, - }; - - return do_memory_op(xch, XENMEM_access_op, &mao, sizeof(mao)); -} - /* * Local variables: * mode: C diff --git a/xen/common/mem_access.c b/xen/common/mem_access.c index 159c036..0fb6699 100644 --- a/xen/common/mem_access.c +++ b/xen/common/mem_access.c @@ -98,14 +98,6 @@ int mem_access_memop(unsigned long cmd, break; } - case XENMEM_access_op_enable_emulate: - rc = p2m_mem_access_enable_emulate(d); - break; - - case XENMEM_access_op_disable_emulate: - rc = p2m_mem_access_disable_emulate(d); - break; - default: rc = -ENOSYS; break; diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h index 4c62725..433952a 100644 --- a/xen/include/asm-arm/p2m.h +++ b/xen/include/asm-arm/p2m.h @@ -89,20 +89,6 @@ typedef enum { } p2m_type_t; static inline -int p2m_mem_access_enable_emulate(struct domain *d) -{ - /* Not supported on ARM */ - return -ENOSYS; -} - -static inline -int p2m_mem_access_disable_emulate(struct domain *d) -{ - /* Not supported on ARM */ - return -ENOSYS; -} - -static inline void p2m_mem_access_emulate_check(struct vcpu *v, const vm_event_response_t *rsp) { diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h index 4072e27..4fad638 100644 --- a/xen/include/asm-x86/domain.h +++ b/xen/include/asm-x86/domain.h @@ -390,7 +390,6 @@ struct arch_domain } monitor; /* Mem_access emulation control */ - bool_t mem_access_emulate_enabled; bool_t mem_access_emulate_each_rep; /* Emulated devices enabled bitmap. */ diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h index fa46dd9..2a90491 100644 --- a/xen/include/asm-x86/p2m.h +++ b/xen/include/asm-x86/p2m.h @@ -647,30 +647,6 @@ bool_t p2m_mem_access_check(paddr_t gpa, unsigned long gla, struct npfec npfec, vm_event_request_t **req_ptr); -/* - * Emulating a memory access requires custom handling. These non-atomic - * functions should be called under domctl lock. - */ -static inline -int p2m_mem_access_enable_emulate(struct domain *d) -{ - if ( d->arch.mem_access_emulate_enabled ) - return -EEXIST; - - d->arch.mem_access_emulate_enabled = 1; - return 0; -} - -static inline -int p2m_mem_access_disable_emulate(struct domain *d) -{ - if ( !d->arch.mem_access_emulate_enabled ) - return -EEXIST; - - d->arch.mem_access_emulate_enabled = 0; - return 0; -} - /* Check for emulation and mark vcpu for skipping one instruction * upon rescheduling if required. */ void p2m_mem_access_emulate_check(struct vcpu *v, diff --git a/xen/include/public/memory.h b/xen/include/public/memory.h index 4df38d6..f69e92f 100644 --- a/xen/include/public/memory.h +++ b/xen/include/public/memory.h @@ -390,8 +390,13 @@ DEFINE_XEN_GUEST_HANDLE(xen_mem_paging_op_t); #define XENMEM_access_op 21 #define XENMEM_access_op_set_access 0 #define XENMEM_access_op_get_access 1 -#define XENMEM_access_op_enable_emulate 2 -#define XENMEM_access_op_disable_emulate 3 +/* + * XENMEM_access_op_enable_emulate and XENMEM_access_op_disable_emulate are + * currently unused, but since they have been in use please do not reuse them. + * + * #define XENMEM_access_op_enable_emulate 2 + * #define XENMEM_access_op_disable_emulate 3 + */ typedef enum { XENMEM_access_n,