From patchwork Wed Jan 6 10:49:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Levitsky X-Patchwork-Id: 12001331 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61388C433E0 for ; Wed, 6 Jan 2021 10:52:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 13AC923105 for ; Wed, 6 Jan 2021 10:52:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725868AbhAFKvk (ORCPT ); Wed, 6 Jan 2021 05:51:40 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:50938 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725896AbhAFKvj (ORCPT ); Wed, 6 Jan 2021 05:51:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609930213; 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=kLT4c0oVgoGQ28S7o/zFiab9Iekvo6wVtsgLAAzAA9w=; b=dROA8l8vbpcPP/ENQxmQgn2VsNnDehOiutNsk5BC9B/aP95Gh4MPJ2iAkKP4gdk01hqskd 9MeF0jXJaJsgG1eEVrYvIfzSMhNIH7o3hicFrh08IQY03hcjxmn3iCmJXD7W8r/Z1rxx4/ gKHehC6biapXkEj/8N80vwnoY3RrC1s= 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-382-ViKoHO4uNXW5l6wig8wqkg-1; Wed, 06 Jan 2021 05:50:11 -0500 X-MC-Unique: ViKoHO4uNXW5l6wig8wqkg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2220D800D55; Wed, 6 Jan 2021 10:50:09 +0000 (UTC) Received: from localhost.localdomain (unknown [10.35.206.196]) by smtp.corp.redhat.com (Postfix) with ESMTP id C2805669FC; Wed, 6 Jan 2021 10:50:03 +0000 (UTC) From: Maxim Levitsky To: kvm@vger.kernel.org Cc: Ingo Molnar , Thomas Gleixner , Paolo Bonzini , Sean Christopherson , linux-kernel@vger.kernel.org (open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)), Jim Mattson , Joerg Roedel , x86@kernel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)), Wanpeng Li , "H. Peter Anvin" , Vitaly Kuznetsov , Borislav Petkov , Maxim Levitsky Subject: [PATCH 0/6] KVM: nSVM: few random fixes Date: Wed, 6 Jan 2021 12:49:55 +0200 Message-Id: <20210106105001.449974-1-mlevitsk@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org This is a series of fixes to nested SVM, that finally makes my kvm on kvm stress test pass, and fix various other issues/regressions. Patches 1-2 are a fix for disappearing interrupts in L2 on migration which usually make the L2 hang. Same issue happens on VMX and WIP, patches for this will be sent in a separate series. Paulo helped me to find the root cause of this issue. Note that this patch likely breaks a nested guest that uses software interrupt injections (SVM_EXITINTINFO_TYPE_SOFT) because currently kvm ignores these on SVM. Patch 3 is a fix for recent regression related to code that delayed the nested msr bitmap processing to the next vm entry, and started to crash the L1 after my on demand nested state allocation patches. The problem was that the code assumed that we will still be in the nested guest mode on next vmentry after setting the nested state, but a pending event can cause a nested vmexit prior to that. Patches 4,5,6 are few things I found while reviewing the nested migration code. I don't have a reproducer for them. Best regards, Maxim Levitsky Maxim Levitsky (6): KVM: SVM: create svm_process_injected_event KVM: nSVM: fix for disappearing L1->L2 event injection on L1 migration KVM: nSVM: cancel KVM_REQ_GET_NESTED_STATE_PAGES on nested vmexit KVM: nSVM: correctly restore nested_run_pending on migration KVM: nSVM: always leave the nested state first on KVM_SET_NESTED_STATE KVM: nSVM: mark vmcb as dirty when forcingly leaving the guest mode arch/x86/kvm/svm/nested.c | 21 ++++++++++++-- arch/x86/kvm/svm/svm.c | 58 ++++++++++++++++++++++----------------- arch/x86/kvm/svm/svm.h | 4 +++ 3 files changed, 55 insertions(+), 28 deletions(-)