From patchwork Tue Jul 16 17:06:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petre Ovidiu PIRCALABU X-Patchwork-Id: 11046527 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1CC976C5 for ; Tue, 16 Jul 2019 17:08:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 05A9D2867F for ; Tue, 16 Jul 2019 17:08:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB25D28685; Tue, 16 Jul 2019 17:08: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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B96AB2867F for ; Tue, 16 Jul 2019 17:08:25 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hnQuN-0005ni-4A; Tue, 16 Jul 2019 17:06:31 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hnQuL-0005nD-Id for xen-devel@lists.xenproject.org; Tue, 16 Jul 2019 17:06:29 +0000 X-Inumbo-ID: 0ba4e05e-a7ec-11e9-97af-778b0c9a337c Received: from mx01.bbu.dsd.mx.bitdefender.com (unknown [91.199.104.161]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 0ba4e05e-a7ec-11e9-97af-778b0c9a337c; Tue, 16 Jul 2019 17:06:26 +0000 (UTC) Received: from smtp.bitdefender.com (smtp02.buh.bitdefender.net [10.17.80.76]) by mx01.bbu.dsd.mx.bitdefender.com (Postfix) with ESMTPS id 9300F3074839; Tue, 16 Jul 2019 20:06:25 +0300 (EEST) Received: from bitdefender.com (unknown [195.189.155.70]) by smtp.bitdefender.com (Postfix) with ESMTPSA id 6EEE5304F602; Tue, 16 Jul 2019 20:06:25 +0300 (EEST) From: Petre Pircalabu To: xen-devel@lists.xenproject.org Date: Tue, 16 Jul 2019 20:06:14 +0300 Message-Id: X-Mailer: git-send-email 2.7.4 Subject: [Xen-devel] [PATCH v2 00/10] Per vcpu vm_event channels X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Petre Pircalabu , Stefano Stabellini , Razvan Cojocaru , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Tamas K Lengyel , Jan Beulich , Alexandru Isaila , Volodymyr Babchuk , =?utf-8?q?Roger_Pau_Monn?= =?utf-8?q?=C3=A9?= MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patchset adds a new mechanism of sending synchronous vm_event requests and handling vm_event responses without using a ring. As each synchronous request pauses the vcpu until the corresponding response is handled, it can be stored in a slotted memory buffer (one per vcpu) shared between the hypervisor and the controlling domain. The main advantages of this approach are: * the ability to dynamicaly allocate the necessary memory used to hold the requests/responses (the size of vm_event_request_t/vm_event_response_t can grow unrestricted by the ring's one page limitation) * the ring's waitqueue logic is unnecessary in this case because the vcpu sending the request is blocked until a response is received. --- Changes from v1: * Dropped the "tools/libxc: Consistent usage of xc_vm_event_* interface" because it was not a hard requirement for this patchset. * Removed sched.h from vm_event.h and replaced it fw declarations of "struct domain" and "struct vm"event_domain" * Reworked the vm_event_ng memory allocation mechanism to use vzalloc/share_xen_page_with_guest. * Replaced the new domctl with a flag in the existing one. When the client (libxc) wants to use the new interface the XEN_VM_EVENT_FLAGS_NG_OP bit should be set. Also, the file xen/common/vm_event_ng.c was removed because the domctl is shared between interfaces, and having 2 separated files would unnecessary expose non-interface functions. * The xen-access related patch was split in 3 new ones: * getopt_long for cmdline parsing * code-cleanup according to the XEN style guide * the vm_event_ng interface support --- Petre Pircalabu (10): vm_event: Define VM_EVENT type vm_event: Remove "ring" suffix from vm_event_check_ring vm_event: Add 'struct domain' backpointer to vm_event_domain. vm_event: Simplify vm_event interface vm_event: Move struct vm_event_domain to vm_event.c vm_event: Decouple implementation details from interface. vm_event: Add vm_event_ng interface xen-access: Use getopt_long for cmdline parsing xen-access: Code cleanup xen-access: Add support for vm_event_ng interface tools/libxc/include/xenctrl.h | 10 + tools/libxc/xc_mem_paging.c | 13 +- tools/libxc/xc_memshr.c | 13 +- tools/libxc/xc_monitor.c | 27 +- tools/libxc/xc_private.h | 18 +- tools/libxc/xc_vm_event.c | 154 ++++-- tools/tests/xen-access/Makefile | 7 +- tools/tests/xen-access/vm-event-ng.c | 183 +++++++ tools/tests/xen-access/vm-event.c | 194 ++++++++ tools/tests/xen-access/xen-access.c | 435 +++++++---------- tools/tests/xen-access/xen-access.h | 91 ++++ xen/arch/arm/mem_access.c | 2 +- xen/arch/x86/mm.c | 7 + xen/arch/x86/mm/mem_access.c | 4 +- xen/arch/x86/mm/mem_paging.c | 2 +- xen/arch/x86/mm/mem_sharing.c | 5 +- xen/arch/x86/mm/p2m.c | 10 +- xen/common/mem_access.c | 2 +- xen/common/monitor.c | 4 +- xen/common/vm_event.c | 912 +++++++++++++++++++++++++---------- xen/drivers/passthrough/pci.c | 2 +- xen/include/public/domctl.h | 82 +--- xen/include/public/memory.h | 2 + xen/include/public/vm_event.h | 47 ++ xen/include/xen/sched.h | 24 +- xen/include/xen/vm_event.h | 80 ++- 26 files changed, 1631 insertions(+), 699 deletions(-) create mode 100644 tools/tests/xen-access/vm-event-ng.c create mode 100644 tools/tests/xen-access/vm-event.c create mode 100644 tools/tests/xen-access/xen-access.h