Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp48508ybm; Tue, 26 May 2020 10:25:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwE8yNwgjPH66kfQsAHPkC+SWnLV4PAFY9aoSKikrr2p5ADI+4fVn3RcGBfFDerWBDpiIm+ X-Received: by 2002:a17:906:2b14:: with SMTP id a20mr2183870ejg.387.1590513919633; Tue, 26 May 2020 10:25:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590513919; cv=none; d=google.com; s=arc-20160816; b=Z58Y8/JEC4s4tyAFO3pSHHKZek57fHohmjeRqQPLF2/ds4DbD+fL52lh9HhVPajkoh w8jFx0PxHzQ9ST3ImNkt627CC7LgjHQH+IyYyceIC4qWax1QqbHRZSdVJpAQXjjNSWfe reSoSysJRl0pxAGeYWkMMcUcIJUiNtjURrB+U7Vf/4KYTYTdlRYuOqiZU2Qql9g3X/pY tgVs3Yrq4fqGSLd5ZB8B2Fil8bUxMvNNJUm9McWHNbnNEe6ZRK7oIQ5MNjK7OIaqUba9 AqZUyI4yp2s25MNHc7lBlwAn0ZrE3PyEliLZ7ts/jask+/f3pP1iVW7I6WBfpsXslivP LLLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=PT+9sIc45kDpdRXOEm8Xg9MAFO/U8LI2utirVVEKJpA=; b=ARL0W8+X0DYcD9Z7s7onHZ5/QwajWHG7w/FN0kmYgctd28lIP2pLivwAtfOCwgwLEZ gRp8jr59V04h1YqTFKTMXbvNr2MPRqWVaIeBCW04KUWryOr46AlLLlRvPw5b8uUX76Hp upclLQR+thkUPo4RTz5CV6LeSmX8SnpreNrqHW+dIJIVSvyeIrFqHObenIRaiA6JFBhZ 8TRuxsHWJIdMpmWUTEJJZZ+RagwAhTk5+YpQzKmFX8YKE8Uwg4NEWBCW2XIsbsIFf/C9 ReKbdw4+EDTkUfVh+4cD4B1WNakfy4/uoGNccMigy0qy294WIS8+OB87RDVz6F66Q5pc BwlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cAxZER4d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a17si246315eje.506.2020.05.26.10.24.56; Tue, 26 May 2020 10:25:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cAxZER4d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389025AbgEZRXR (ORCPT + 99 others); Tue, 26 May 2020 13:23:17 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:29967 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388606AbgEZRXP (ORCPT ); Tue, 26 May 2020 13:23:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590513794; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=PT+9sIc45kDpdRXOEm8Xg9MAFO/U8LI2utirVVEKJpA=; b=cAxZER4dUBVi9b2DmGppIvruiEJgU2mlG2+k3RakHDELl/PR97LzwnQQj4gx3hEoYxlokE g8b/oSeU8M8zcqH6K4DWS4eYHO0XIeeZAKgevdZ1qFuOznjz1QOPPCLoL7rtU8pQRw7y9l 4+lgVY4r3DmVslowax/2AuESwnh+QGk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-235-lZL-I7WRM1i5yn5yU8gw6w-1; Tue, 26 May 2020 13:23:11 -0400 X-MC-Unique: lZL-I7WRM1i5yn5yU8gw6w-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 82845108BD0B; Tue, 26 May 2020 17:23:09 +0000 (UTC) Received: from virtlab511.virt.lab.eng.bos.redhat.com (virtlab511.virt.lab.eng.bos.redhat.com [10.19.152.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5C321001B07; Tue, 26 May 2020 17:23:08 +0000 (UTC) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: vkuznets@redhat.com, mlevitsk@redhat.com, Sean Christopherson , Jim Mattson Subject: [PATCH v2 00/28] KVM: nSVM: event fixes and migration support Date: Tue, 26 May 2020 13:22:40 -0400 Message-Id: <20200526172308.111575-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Compared to v1, this fixes some incorrect injections of VINTR that happen on kvm/queue while running nested guests, and it clarifies the code that handles INT_CTL. The most important part here is the first three patches, which further cleanup event injection and remove another race between inject_pending_event and kvm_cpu_has_injectable_intr. Two other important patches are "KVM: nSVM: restore clobbered INT_CTL fields after clearing VINTR" and "KVM: nSVM: synthesize correct EXITINTINFO on vmexit", which fix various hangs that were happening with v1. Nested Hyper-V is still broken with these patches; the bug is only marginally related to event injection and the fix is simple, so it can go into 5.7. And it's Vitaly who heroically debugged it, so I'll leave it to him to post it. Paolo Paolo Bonzini (28): KVM: x86: track manually whether an event has been injected KVM: x86: enable event window in inject_pending_event KVM: nSVM: inject exceptions via svm_check_nested_events KVM: nSVM: remove exit_required KVM: nSVM: correctly inject INIT vmexits KVM: SVM: always update CR3 in VMCB KVM: nVMX: always update CR3 in VMCS KVM: nSVM: move map argument out of enter_svm_guest_mode KVM: nSVM: extract load_nested_vmcb_control KVM: nSVM: extract preparation of VMCB for nested run KVM: nSVM: move MMU setup to nested_prepare_vmcb_control KVM: nSVM: clean up tsc_offset update KVM: nSVM: pass vmcb_control_area to copy_vmcb_control_area KVM: nSVM: remove trailing padding for struct vmcb_control_area KVM: nSVM: save all control fields in svm->nested KVM: nSVM: restore clobbered INT_CTL fields after clearing VINTR KVM: nSVM: synchronize VMCB controls updated by the processor on every vmexit KVM: nSVM: remove unnecessary if KVM: nSVM: extract svm_set_gif KVM: SVM: preserve VGIF across VMCB switch KVM: nSVM: synthesize correct EXITINTINFO on vmexit KVM: nSVM: remove HF_VINTR_MASK KVM: nSVM: remove HF_HIF_MASK KVM: nSVM: split nested_vmcb_check_controls KVM: nSVM: leave guest mode when clearing EFER.SVME KVM: MMU: pass arbitrary CR0/CR4/EFER to kvm_init_shadow_mmu selftests: kvm: add a SVM version of state-test KVM: nSVM: implement KVM_GET_NESTED_STATE and KVM_SET_NESTED_STATE arch/x86/include/asm/kvm_host.h | 12 +- arch/x86/include/asm/svm.h | 9 +- arch/x86/include/uapi/asm/kvm.h | 17 +- arch/x86/kvm/cpuid.h | 5 + arch/x86/kvm/irq.c | 1 + arch/x86/kvm/mmu.h | 2 +- arch/x86/kvm/mmu/mmu.c | 14 +- arch/x86/kvm/svm/nested.c | 624 ++++++++++++------ arch/x86/kvm/svm/svm.c | 154 ++--- arch/x86/kvm/svm/svm.h | 33 +- arch/x86/kvm/vmx/nested.c | 5 - arch/x86/kvm/vmx/vmx.c | 25 +- arch/x86/kvm/x86.c | 141 ++-- .../testing/selftests/kvm/x86_64/state_test.c | 69 +- 14 files changed, 687 insertions(+), 424 deletions(-) -- 2.26.2