From patchwork Thu Oct 25 04:48:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 10655403 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 E7C4E109C for ; Thu, 25 Oct 2018 04:48:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D6D792B019 for ; Thu, 25 Oct 2018 04:48:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CAACF2B03A; Thu, 25 Oct 2018 04:48:43 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 745ED2B019 for ; Thu, 25 Oct 2018 04:48:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727106AbeJYNTl (ORCPT ); Thu, 25 Oct 2018 09:19:41 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:42048 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726527AbeJYNTl (ORCPT ); Thu, 25 Oct 2018 09:19:41 -0400 Received: by mail-pf1-f193.google.com with SMTP id f26-v6so3554372pfn.9 for ; Wed, 24 Oct 2018 21:48:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=/x1v5BIl5pMtxTLMUYFNu2XNcmto4sWCpEB+0WHqFgI=; b=fCmjyDl/tBn4sh9YY4SPlvloqcA4C7v5unSj2bE0CzDU1bDBjsuJwv/Or1Aiprsv5h MvJ6kEJIMkSwKIuU3XyZHPrzQrhx8IT6crciE6QUPdvOyGh2zM+j9zWnXSvX44O99OQm wBqYuLSsC+pWV1dyfSSJruThUXwMuLf2CwxVd/0n9BRrrGHT0vFswlooM0bl0XGJiK2t OssJFcmKAfNAFB84KUhOc6SZ6PFoCyhelmcOIClMNZwtxh/yoBEYouFuKy6QJJsCjnTp XEHgvI7zTf7J3nm3+iZqnu+Ogor+hcd/jZJKCe0qAlZiEskLjLlsPpE4zcawWrVbH17P TLyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/x1v5BIl5pMtxTLMUYFNu2XNcmto4sWCpEB+0WHqFgI=; b=JgHLkUoVrambAbG7RVRagXrIE6Wp0IBihJqaHOhUAupyQihM4MpSdK53sMpDPZCNDl 15GdNr7jXeIK4Y33x2knBACpUr34DQ7O5f8s9OaQEfHwjmNjQm9UqAs9l7OS1u4oeiyW lLisI/JFcBS4jqCKvdTwvDcJg9/6Ko+mNvEhHcGnojleTGW099d3EoZAT/39+20WcsJp JF+55kWXOFE+QGZU/ciLqLQgBaftdpfoifbk+GvSVTt0DnbJYdVHvwo2PMn+ZCFbToHs 5gUN1BWmVqEpG0xgyA54wJactwq07pMjVCWGFbf7u1NplD8mFe9ib2AMBIbTYbK2nht6 /TyA== X-Gm-Message-State: AGRZ1gLDyqMxL19vgpqVyG+Gh/pWXBXob5/JOyozaKeS/Pag5zjsJZ5F yYjnAX1bSXz2adwhZxWsas6VZOp9 X-Google-Smtp-Source: AJdET5eCZAm9tNsIpitgcwYVgOpTVwuZNW50t31Li2tMqEomvjpskDmxIYmdtfeFtwRjVE/xzpRJsg== X-Received: by 2002:a63:3842:: with SMTP id h2-v6mr52053pgn.300.1540442920532; Wed, 24 Oct 2018 21:48:40 -0700 (PDT) Received: from localhost (c-73-189-176-234.hsd1.ca.comcast.net. [73.189.176.234]) by smtp.gmail.com with ESMTPSA id y7-v6sm7140865pfl.57.2018.10.24.21.48.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Oct 2018 21:48:39 -0700 (PDT) From: Isaku Yamahata To: kvm@vger.kernel.org Cc: pbonzini@redhat.com, rkrcmar@redhat.com, vkuznets@redhat.com, kys@microsoft.com, Tianyu.Lan@microsoft.com, yi.y.sun@intel.com, chao.gao@intel.com, isaku.yamahta@intel.com, Isaku Yamahata Subject: [PATCH v2 0/6] x86/kernel/hyper-v: xmm fast hypercall Date: Wed, 24 Oct 2018 21:48:25 -0700 Message-Id: X-Mailer: git-send-email 2.14.1 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch series implements xmm fast hypercall for hyper-v as guest and kvm support as VMM. With this patch, HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE without gva list, HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE_EX(vcpu > 64) and HVCALL_SEND_IPI_EX(vcpu > 64) can use xmm fast hypercall. benchmark result: At the moment, my test machine have only pcpu=4, ipi benchmark doesn't make any behaviour change. So for now I measured the time of hyperv_flush_tlb_others() by ktap with 'hardinfo -r -f text'. the average of 5 runs are as follows. (When large machine with pcpu > 64 is avaialble, ipi_benchmark result is interesting. But not yet now.) hyperv_flush_tlb_others() time by hardinfo -r -f text: with path: 9931 ns without patch: 11111 ns With patch of 4bd06060762b, __send_ipi_mask() now uses fast hypercall when possible. so in the case of vcpu=4. So I used kernel before the parch to measure the effect of xmm fast hypercall with ipi_benchmark. The following is the average of 100 runs. ipi_benchmark: average of 100 runs without 4bd06060762b with patch: Dry-run 0 495181 Self-IPI 11352737 21549999 Normal IPI 499400218 575433727 Broadcast IPI 0 1700692010 Broadcast lock 0 1663001374 without patch: Dry-run 0 607657 Self-IPI 10915950 21217644 Normal IPI 621712609 735015570 Broadcast IPI 0 2173803373 Broadcast lock 0 2150451543 Isaku Yamahata (6): x86/kernel/hyper-v: xmm fast hypercall as guest x86/hyperv: use hv_do_hypercall for __send_ipi_mask_ex() x86/hyperv: use hv_do_hypercall for flush_virtual_address_space_ex hyperv: use hv_do_hypercall instead of hv_do_fast_hypercall x86/kvm/hyperv: implement xmm fast hypercall local: hyperv: test ex hypercall arch/x86/hyperv/hv_apic.c | 16 +++- arch/x86/hyperv/mmu.c | 24 +++-- arch/x86/hyperv/nested.c | 2 +- arch/x86/include/asm/hyperv-tlfs.h | 3 + arch/x86/include/asm/mshyperv.h | 180 ++++++++++++++++++++++++++++++++++-- arch/x86/kvm/hyperv.c | 101 ++++++++++++++++---- drivers/hv/connection.c | 3 +- drivers/hv/hv.c | 3 +- drivers/pci/controller/pci-hyperv.c | 7 +- 9 files changed, 291 insertions(+), 48 deletions(-)