From patchwork Fri Feb 12 09:04:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Razvan Cojocaru X-Patchwork-Id: 8288861 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 AEDF6BEEE5 for ; Fri, 12 Feb 2016 09:07:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AF0E3203B0 for ; Fri, 12 Feb 2016 09:07:47 +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 9873C202D1 for ; Fri, 12 Feb 2016 09:07:46 +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 1aU9en-00010E-LF; Fri, 12 Feb 2016 09:04:53 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aU9em-000109-3n for xen-devel@lists.xen.org; Fri, 12 Feb 2016 09:04:52 +0000 Received: from [85.158.143.35] by server-3.bemta-4.messagelabs.com id 11/8B-31122-330ADB65; Fri, 12 Feb 2016 09:04:51 +0000 X-Env-Sender: rcojocaru@bitdefender.com X-Msg-Ref: server-11.tower-21.messagelabs.com!1455267890!15353513!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 36770 invoked from network); 12 Feb 2016 09:04:50 -0000 Received: from mx01.buh.bitdefender.com (HELO mx01.buh.bitdefender.com) (91.199.104.161) by server-11.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 12 Feb 2016 09:04:50 -0000 Comment: DomainKeys? See http://domainkeys.sourceforge.net/ DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=bitdefender.com; b=aks9OiytyvQJ9/CBL8Nph5l5RKH0NMwXcaNzFP6RPR2WiE0GFWkDsGnx5zj0zb02BqnQnwCzPDXEGRQ2c0CotDttOjJoREPWlHJkokLBL0OrmuQIafY6vkVCfbAYsFkaOK2wrB3NrXKPkkc0X1K7L3O1rChyKE9AaXgWjlciQmS8T8LriOxHjylsiLgeznRacz6P7aKKovDfBXvskTHfAMVKxf6FuCTNtATuG6HjzuKfPJL7Z4cOfDAoaY7S/J1tY+Gp1kxqqxSh7nDipiBsFHADQxffGVOkYgDfHdHaskytJKrNW/4QNj7p0LUNNQG/vK9QVELD3wH5pMb4iRTFiA==; 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=beWR8GVC0fwbH7HTjtzW+ ql1hDs=; b=skjvGbe4glqP9qeqZfwV88+rcMJwqXtk2dVylLplQ4HysRUu7wd7X m+1VRjtLRXOhGOvHvLrPrMfMM6PGq/EzSKKF04K0DHjTOWRI3rYnU6ZSjL4tfCwV XSsgUs25NDehJnkEyLsCcNfauuVh+d0Q+Q1O1OA0ANw7+8XPUYVFejBFoXG9vgtF GO9QqasAYhA9oevxPj/JjR5MQ8MRR+S2VmfilVqxxSZ6/6vyhEwz+/qCcCY0vchH kXcdnPy4vz2nmmMuaJISE78BBafxAA6JnqtSXJQOpBI1w051Yuueus3wcvis/xGC wstz4w/r5zqPUcVpNjpE/wljNx0QiugAg== Received: (qmail 24033 invoked from network); 12 Feb 2016 11:04:49 +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; 12 Feb 2016 11:04:49 +0200 Received: from smtp03.buh.bitdefender.org (unknown [10.17.80.77]) by mx-sr.buh.bitdefender.com (Postfix) with ESMTP id 13A3D7F8BE for ; Fri, 12 Feb 2016 11:04:49 +0200 (EET) Received: (qmail 30625 invoked from network); 12 Feb 2016 11:04:49 +0200 Received: from xen.dsd.ro (HELO xen.dsd.bitdefender.biz) (rcojocaru@bitdefender.com@10.10.14.109) by smtp03.buh.bitdefender.org with AES128-SHA256 encrypted SMTP; 12 Feb 2016 11:04:48 +0200 From: Razvan Cojocaru To: xen-devel@lists.xen.org Date: Fri, 12 Feb 2016 11:04:34 +0200 Message-Id: <1455267874-14191-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 smtp03.buh.bitdefender.org, sigver: 7.64477 X-BitDefender-Spam: No (0) X-BitDefender-SpamStamp: Build: [Engines: 2.15.6.743, Dats: 414095, Stamp: 3], Multi: [Enabled, t: (0.000008, 0.005470)], BW: [Enabled, t: (0.000006,0.000001)], RBL DNSBL: [Disabled], APM: [Enabled, Score: 500, t: (0.003804), 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.008436)], URL: [Enabled, t: (0.000005)], RTDA: [Enabled, t: (0.022957), Hit: No, Details: v2.3.3; Id: 2m1ghaj.1aaoicsp1.4t16r], 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] 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 --- 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 | 2 -- 7 files changed, 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..baa8ce1 100644 --- a/xen/include/public/memory.h +++ b/xen/include/public/memory.h @@ -390,8 +390,6 @@ 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 typedef enum { XENMEM_access_n,