From patchwork Thu Mar 3 15:41:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: David Woodhouse X-Patchwork-Id: 12767652 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F47EC433F5 for ; Thu, 3 Mar 2022 15:41:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234608AbiCCPmc (ORCPT ); Thu, 3 Mar 2022 10:42:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234569AbiCCPma (ORCPT ); Thu, 3 Mar 2022 10:42:30 -0500 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 016691959C1 for ; Thu, 3 Mar 2022 07:41:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To: Content-ID:Content-Description:In-Reply-To:References; bh=XWF5VMFkk6L4UE9diwBbalnWZxrWgn+B7Eu8T2VVPwc=; b=hTbBMS4rQLzOmZr1r4eOJoMD0u W59ZAULPkY/Wzaj0UxV4WeycTD3Gee6viDyMxCuk2LBMFlhFEeBcY3jbMtDb1mASJzYvJgs3E7ZFX SQyuMLK5NHCLyq8zoG813T1q9RD17b77URm34I9cdmZ1/DUIWusSjioNXkLj/9d185fCGqjqYTlKh tKAWLO+UxBDcQKV/Cf4P2npTkrJjMfjbU/fpZik8E9/oYNIXzCvm3G0hm1pF0Rz6ksPgfvKfD/5lx 1H11hlc08buHjdIBPUWJiSaJdefv1vFgmGbwDYOgdCmn8qSdIyzxyRabOcIWNVut1bgdVnp/pL/96 hNo1nDQw==; Received: from [2001:8b0:10b:1:85c4:81a:fb42:714d] (helo=i7.infradead.org) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nPna5-00Ewju-CE; Thu, 03 Mar 2022 15:41:29 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nPna4-000qmL-O2; Thu, 03 Mar 2022 15:41:28 +0000 From: David Woodhouse To: kvm@vger.kernel.org, Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Joao Martins , Boris Ostrovsky , Metin Kaya , Paul Durrant Subject: [PATCH v3 00/17] KVM: Add Xen event channel acceleration Date: Thu, 3 Mar 2022 15:41:10 +0000 Message-Id: <20220303154127.202856-1-dwmw2@infradead.org> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 Sender: David Woodhouse X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org This series adds event channel acceleration for Xen guests. In particular it allows guest vCPUs to send each other IPIs without having to bounce all the way out to the userspace VMM in order to do so. Likewise, the Xen singleshot timer is added, and a version of SCHEDOP_poll. Those major features are based on Joao and Boris' patches from 2019. Cleaning up the event delivery into the vcpu_info involved using the new gfn_to_pfn_cache for that, and that means I ended up doing so for *all* the places the guest can have a pvclock. v0: Proof-of-concept RFC v1: • Drop the runstate fix which is merged now. • Add Sean's gfn_to_pfn_cache API change at the start of the series. • Add KVM self tests • Minor bug fixes v2: • Drop dirty handling from gfn_to_pfn_cache • Fix !CONFIG_KVM_XEN build and duplicate call to kvm_xen_init_vcpu() v3: • Add KVM_XEN_EVTCHN_RESET to clear all outbound ports. • Clean up a stray #if 1 in a part of the the test case that was once being recalcitrant. • Check kvm_xen_has_pending_events() in kvm_vcpu_has_events() and *not* kvm_xen_has_pending_timer() which is checked from elsewhere. • Fix warnings noted by the kernel test robot : • Make kvm_xen_init_timer() static. • Make timer delta calculation use an explicit s64 to fix 32-bit build. Boris Ostrovsky (1): KVM: x86/xen: handle PV spinlocks slowpath David Woodhouse (12): KVM: Remove dirty handling from gfn_to_pfn_cache completely KVM: x86/xen: Use gfn_to_pfn_cache for runstate area KVM: x86: Use gfn_to_pfn_cache for pv_time KVM: x86/xen: Use gfn_to_pfn_cache for vcpu_info KVM: x86/xen: Use gfn_to_pfn_cache for vcpu_time_info KVM: x86/xen: Make kvm_xen_set_evtchn() reusable from other places KVM: x86/xen: Support direct injection of event channel events KVM: x86/xen: Add KVM_XEN_VCPU_ATTR_TYPE_VCPU_ID KVM: x86/xen: Kernel acceleration for XENVER_version KVM: x86/xen: Support per-vCPU event channel upcall via local APIC KVM: x86/xen: Advertise and document KVM_XEN_HVM_CONFIG_EVTCHN_SEND KVM: x86/xen: Add self tests for KVM_XEN_HVM_CONFIG_EVTCHN_SEND Joao Martins (3): KVM: x86/xen: intercept EVTCHNOP_send from guests KVM: x86/xen: handle PV IPI vcpu yield KVM: x86/xen: handle PV timers oneshot mode Sean Christopherson (1): KVM: Use enum to track if cached PFN will be used in guest and/or host Documentation/virt/kvm/api.rst | 133 +- arch/x86/include/asm/kvm_host.h | 23 +- arch/x86/kvm/irq.c | 11 +- arch/x86/kvm/irq_comm.c | 2 +- arch/x86/kvm/x86.c | 119 +- arch/x86/kvm/xen.c | 1271 ++++++++++++++++---- arch/x86/kvm/xen.h | 67 +- include/linux/kvm_host.h | 26 +- include/linux/kvm_types.h | 11 +- include/uapi/linux/kvm.h | 44 + .../testing/selftests/kvm/x86_64/xen_shinfo_test.c | 337 +++++- virt/kvm/pfncache.c | 53 +- 12 files changed, 1722 insertions(+), 375 deletions(-)