From patchwork Fri Sep 21 08:22:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Kagan X-Patchwork-Id: 10609375 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 8B52415A6 for ; Fri, 21 Sep 2018 08:58:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A7A42D873 for ; Fri, 21 Sep 2018 08:58:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6E04B2D889; Fri, 21 Sep 2018 08:58:37 +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=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C88CD2D874 for ; Fri, 21 Sep 2018 08:58:36 +0000 (UTC) Received: from localhost ([::1]:54601 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g3HGm-0008ML-50 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 21 Sep 2018 04:58:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49083) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g3Gi0-0006kh-8F for qemu-devel@nongnu.org; Fri, 21 Sep 2018 04:22:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g3Ghx-00026d-K6 for qemu-devel@nongnu.org; Fri, 21 Sep 2018 04:22:40 -0400 Received: from mail-eopbgr70098.outbound.protection.outlook.com ([40.107.7.98]:35648 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g3Ghx-0001yN-B7 for qemu-devel@nongnu.org; Fri, 21 Sep 2018 04:22:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QkYzzwr5zzVRqRaCU+tPXUsJiFM3BG57ktO7T6gfu5U=; b=TcvrQCk1jXpE8Bhy5TqhoK0ORkD9+3mjdlptVng/GVN2x3Tydd2tDqws7cUMhMZGFvI+aKtTIz+bsmAU70igKWyZIwtk9jSX9032bsYcB86/N9uVG9SVIlMyW/rprvdhjzE04hh8BqTuSQcj3uIqKfbiglV+7qRVxNzawgRf4fw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rkagan@virtuozzo.com; Received: from rkaganb.sw.ru (185.231.240.5) by AM0PR08MB3588.eurprd08.prod.outlook.com (2603:10a6:208:e1::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.18; Fri, 21 Sep 2018 08:22:34 +0000 From: Roman Kagan To: qemu-devel@nongnu.org Date: Fri, 21 Sep 2018 11:22:11 +0300 Message-Id: <20180921082217.29481-5-rkagan@virtuozzo.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180921082217.29481-1-rkagan@virtuozzo.com> References: <20180921082217.29481-1-rkagan@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: VI1P193CA0003.EURP193.PROD.OUTLOOK.COM (2603:10a6:800:bd::13) To AM0PR08MB3588.eurprd08.prod.outlook.com (2603:10a6:208:e1::30) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ceed3755-a359-4454-9885-08d61f9b62d6 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3588; X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3588; 3:a/aQywTXx/vJhClzkeYHfu6iypR48fJat6/I53j2tbfKgbngut6YbjkgZRNI2z3VxPJEqxjaV6EIxcEL3XI4U9nrgnpC/YJsQ36QBHKoHjs94arWfXhZu+TgkqOqAvptLzzJjiPR9fTsLZPJcu1CKI2uM2r6tXCSLD1HXtC8uVjhr4ZSOnjLNfDQc/k5VF3E86eEZBcLxYkX+ea1O76U/nX/NpIagqwM7YquuCfYZehlr/NGWmj0rVduV3pOh06j; 25:TQWfH0mkUll2e8BKSb659ge7NdBMKX106f5DHiQ7QDXKpiTXTK0IqlGHWBBDxpSDugcn1nVN3wDOhJYrKT3bfRMGLzprgvZuMFq3NbKZT54iRlRewQ6gjx+SLZp8FDLezTKOvbiuytcQiroYM9MRyqc2x6nvr6yy2g49Ln0yaCUDlwej8NBNAyBhDzT0WiqixuaByf7GR0CnHnlWF6/oq8Tg9You8/iigxE3tDECDTob0aGeaU8ONd0DJThWxwyI7mEZhbTEaZdROnGLWPkXRU65ODW8xki7quZZMQE0QbFUofzRFgQP8QnZGX58AYvw+j6PBkn+k8paB37yl1Vt5A==; 31:Md8mZ6mmRTAb0ffPuo9rD6Q0Do3SZVSVXmfHxef/W2iNxzBKSeDBEw82FN9pjVfIqR4TMZkPssP4uhO2IHXmf321DRWWeC/VGdoQFzShJmAjp2ut243RPSLJHhiRs3ogWVAz/LeUy4x+D//7SdNl4mM+nPXyKLznB/vmjZYqi905plUfljxgcdTo5v4zwEoiRYao/G5G6sknz6uKGEcqHnDrNZ8TiaKhM1jEDQ7Iapk= X-MS-TrafficTypeDiagnostic: AM0PR08MB3588: X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3588; 20:VO/L1/MFGCuNZMrYcWp1Y1e9DFILxb+sF5nHhNzhVeYOQjrJt8J2x8pxGl8S19SnXfWsC5/zOYFn/wro0Sfj2OmCOlexhTpaIjpEaZQjeHsSiVDtQUA83SsP6cbf/kf7+nThIGeV1GL45rx2nfHQU8gSI4BWxAdZnnT4XAzNb9um29Sx78sdgNghlQ5jdl+gwIQjt7t//5pI6vhvUWSxrma9yM1e7SmxlJ9m5ic65sOjC99raH5fH/HFv+MofJNRgifsXNYq4WdK+TFaeYppoOAOinoh+FvATd8w68rct0BPmQ6x7wuBnwCjs7OEnl+/T3SZm/inCquE5xKFV0Mc8xRg9J/74DQ3z6kX24LkZvcc5VXj+5SzACRkpoZPnCLGqsoeS8JKOND0Pp7E77YvgpwiRSfh4/VV6yHAGsrsxP5m+kKoeN+ToGGulwYKgnDV6IrpUNiK5+LDuhdjsysE2RK71xPw+NXoNbjJwzffUECdLmz10LOWr+5FSdYRD+Wc; 4:mWHYqdMEA5dSurchnS+gvI9Q39ppVM0kCVe31wWJ8s8JZiGyMWSTM/FnHW2MU3svTO3gnSPEwVIJXjaCN9B/xyre1sVuC3Y3ZJqq5+efNFkazN1OmFapak/53t88yyA4qASukvJDo4BAzPJ8acW5rDlTD4is8oOJJMSm8E/9ZOj+RuIzkiXjzEk0KlzxoZ10BKmm+Rgj0OKuwxpex3a9uxGF9jVx8tvULi4uDW9Mf0nO+LMyZjenazFnrS/K+8xKysFcjMuszudrQKB3vTz2Ew== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231355)(944501410)(52105095)(10201501046)(3002001)(149027)(150027)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123564045)(201708071742011)(7699051); SRVR:AM0PR08MB3588; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3588; X-Forefront-PRVS: 0802ADD973 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(346002)(136003)(396003)(39850400004)(366004)(376002)(189003)(199004)(6916009)(16526019)(5660300001)(36756003)(3846002)(54906003)(48376002)(6506007)(476003)(486006)(14444005)(52116002)(446003)(1076002)(76176011)(386003)(51416003)(186003)(6116002)(16586007)(2906002)(66066001)(6512007)(7416002)(50226002)(53936002)(25786009)(106356001)(53416004)(81166006)(47776003)(316002)(956004)(11346002)(2616005)(7736002)(8936002)(305945005)(8676002)(2351001)(105586002)(97736004)(4326008)(86362001)(6666003)(68736007)(478600001)(6486002)(2361001)(50466002)(26005)(69596002)(81156014); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3588; H:rkaganb.sw.ru; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR08MB3588; 23:FX6AGDI2rr8AHgAoKO12TBNbtHHwX7kZ3ItehRTn8?= FzBosH8aHBoAI9P41LpJ0tfCXoTO9WZ44eIZSpNouwEVgw7D97epRDiwQkpWkmEu9jjAcpu4yzMnbYJTDE6wfHd7XyEMQej4NMieg0LmFbAHOU6u1TdqO4htdAHFxTdis4xBO/QkLNq2Jncf0/fpp3BgBIfaF1cNtXtxIPVlLS7mUFILTnPPpUWYuCxj8Asc2F5fc7e8wrH+h7D+tzHBRo7TXYbtHv+DJeJErdw80hpzoqbmRlBQS7CjPNBsUunqsb4A4zDNHhQQRxPMjjbbDFblmn38p1GK8KJnJS6K6qSe18qtQHZ9QuSVu/XHMIl1vy7dpq1brq2M8LAg1hIF0aJgplHsn8+yEQi+oRBqFZuHq16yD7qfIA+4v6Iy39gojtWr+5E0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yAuNWaRsqpNDrnD0GsKVc8b2rkWqBZk5e SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3588; 20:aPUo36Zrt9rCC07knDOZ7w0RaJs2dZOjlWC/XDyfrA+BYhvSA26tQ+paWjELqhBB9haVckCL/rfTnC5QdFmfbunKRE/MosytNsWEMUZzF6hPmVxUKbb91z9QgPWLv71pVFiFb2zXeGmHMhOrQYMeSLSNVpFGd2mCd4UaayIMLBs= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2018 08:22:34.6880 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ceed3755-a359-4454-9885-08d61f9b62d6 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3588 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.7.98 Subject: [Qemu-devel] [PATCH 04/10] hyperv: make overlay pages for SynIC X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vijayabhaskar Balakrishna , Eduardo Habkost , Konrad Rzeszutek Wilk , "Michael S. Tsirkin" , Venu Busireddy , Liran Alon , Paolo Bonzini , Si-Wei Liu , Igor Mammedov , Boris Ostrovsky , Karl Heubaum Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Per Hyper-V spec, SynIC message and event flag pages are to be implemented as so called overlay pages. That is, they are owned by the hypervisor and, when mapped into the guest physical address space, overlay the guest physical pages such that 1) the overlaid guest page becomes invisible to the guest CPUs until the overlay page is turned off 2) the contents of the overlay page is preserved when it's turned off and back on, even at a different address; it's only zeroed at vcpu reset This particular nature of SynIC message and event flag pages is ignored in the current code, and guest physical pages are used directly instead. This happens to (mostly) work because the actual guests seem not to depend on the features listed above. This patch implements those pages as the spec mandates. Since the extra RAM regions, which introduce migration incompatibility, are only added at SynIC object creation which only happens when hyperv_synic_kvm_only == false, no extra compat logic is necessary. Signed-off-by: Roman Kagan --- hw/hyperv/hyperv.c | 51 +++++++++++++++++++++++++++++++++++++++++--- target/i386/hyperv.c | 20 +++++++++++------ 2 files changed, 62 insertions(+), 9 deletions(-) diff --git a/hw/hyperv/hyperv.c b/hw/hyperv/hyperv.c index 3d6f044282..70cf129d04 100644 --- a/hw/hyperv/hyperv.c +++ b/hw/hyperv/hyperv.c @@ -10,6 +10,7 @@ #include "qemu/osdep.h" #include "qemu/main-loop.h" #include "qapi/error.h" +#include "exec/address-spaces.h" #include "sysemu/kvm.h" #include "hw/hyperv/hyperv.h" @@ -21,6 +22,10 @@ typedef struct SynICState { bool enabled; hwaddr msg_page_addr; hwaddr event_page_addr; + MemoryRegion msg_page_mr; + MemoryRegion event_page_mr; + struct hyperv_message_page *msg_page; + struct hyperv_event_flags_page *event_page; } SynICState; #define TYPE_SYNIC "hyperv-synic" @@ -36,8 +41,28 @@ static void synic_update(SynICState *synic, bool enable, { synic->enabled = enable; - synic->msg_page_addr = msg_page_addr; - synic->event_page_addr = event_page_addr; + if (synic->msg_page_addr != msg_page_addr) { + if (synic->msg_page_addr) { + memory_region_del_subregion(get_system_memory(), + &synic->msg_page_mr); + } + if (msg_page_addr) { + memory_region_add_subregion(get_system_memory(), msg_page_addr, + &synic->msg_page_mr); + } + synic->msg_page_addr = msg_page_addr; + } + if (synic->event_page_addr != event_page_addr) { + if (synic->event_page_addr) { + memory_region_del_subregion(get_system_memory(), + &synic->event_page_mr); + } + if (event_page_addr) { + memory_region_add_subregion(get_system_memory(), event_page_addr, + &synic->event_page_mr); + } + synic->event_page_addr = event_page_addr; + } } void hyperv_synic_update(CPUState *cs, bool enable, @@ -54,11 +79,31 @@ void hyperv_synic_update(CPUState *cs, bool enable, static void synic_realize(DeviceState *dev, Error **errp) { + Object *obj = OBJECT(dev); + SynICState *synic = SYNIC(dev); + char *msgp_name, *eventp_name; + uint32_t vp_index; + + /* memory region names have to be globally unique */ + vp_index = hyperv_vp_index(synic->cs); + msgp_name = g_strdup_printf("synic-%u-msg-page", vp_index); + eventp_name = g_strdup_printf("synic-%u-event-page", vp_index); + + memory_region_init_ram(&synic->msg_page_mr, obj, msgp_name, + sizeof(*synic->msg_page), &error_abort); + memory_region_init_ram(&synic->event_page_mr, obj, eventp_name, + sizeof(*synic->event_page), &error_abort); + synic->msg_page = memory_region_get_ram_ptr(&synic->msg_page_mr); + synic->event_page = memory_region_get_ram_ptr(&synic->event_page_mr); + + g_free(msgp_name); + g_free(eventp_name); } - static void synic_reset(DeviceState *dev) { SynICState *synic = SYNIC(dev); + memset(synic->msg_page, 0, sizeof(*synic->msg_page)); + memset(synic->event_page, 0, sizeof(*synic->event_page)); synic_update(synic, false, 0, 0); } diff --git a/target/i386/hyperv.c b/target/i386/hyperv.c index 0216735d67..3f76c3e266 100644 --- a/target/i386/hyperv.c +++ b/target/i386/hyperv.c @@ -12,6 +12,7 @@ */ #include "qemu/osdep.h" +#include "qemu/main-loop.h" #include "hyperv.h" #include "hw/hyperv/hyperv.h" #include "hyperv-proto.h" @@ -38,6 +39,13 @@ void hyperv_x86_synic_update(X86CPU *cpu) hyperv_synic_update(CPU(cpu), enable, msg_page_addr, event_page_addr); } +static void async_synic_update(CPUState *cs, run_on_cpu_data data) +{ + qemu_mutex_lock_iothread(); + hyperv_x86_synic_update(X86_CPU(cs)); + qemu_mutex_unlock_iothread(); +} + int kvm_hv_handle_exit(X86CPU *cpu, struct kvm_hyperv_exit *exit) { CPUX86State *env = &cpu->env; @@ -48,11 +56,6 @@ int kvm_hv_handle_exit(X86CPU *cpu, struct kvm_hyperv_exit *exit) return -1; } - /* - * For now just track changes in SynIC control and msg/evt pages msr's. - * When SynIC messaging/events processing will be added in future - * here we will do messages queues flushing and pages remapping. - */ switch (exit->u.synic.msr) { case HV_X64_MSR_SCONTROL: env->msr_hv_synic_control = exit->u.synic.control; @@ -67,7 +70,12 @@ int kvm_hv_handle_exit(X86CPU *cpu, struct kvm_hyperv_exit *exit) return -1; } - hyperv_x86_synic_update(cpu); + /* + * this will run in this cpu thread before it returns to KVM, but in a + * safe environment (i.e. when all cpus are quiescent) -- this is + * necessary because memory hierarchy is being changed + */ + async_safe_run_on_cpu(CPU(cpu), async_synic_update, RUN_ON_CPU_NULL); return 0; case KVM_EXIT_HYPERV_HCALL: {