Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp49952ybm; Tue, 26 May 2020 10:27:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgFTQeI6ZFYrtZDTZtsHukoh+EIZGOx/LEQ0aulgAjFx+ugNo1kHSu6bNHgLDs4vXoymHF X-Received: by 2002:a50:fc04:: with SMTP id i4mr21669905edr.236.1590514054478; Tue, 26 May 2020 10:27:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590514054; cv=none; d=google.com; s=arc-20160816; b=Cy1EZU6ZEx9+egWZ2vbgQRAmtbXpk9v51QW+NFnWZiHUSxVJOQx4BXhJUleuFG/+YO KlXgS91y9PjlZzd1ffCM+R41/1h8l/8YB39ADsQ+wPzLlB5hCSa6O+f2O+7WTL20g95E Nk769/Ae2OVBgnBOAKaeIOctLCFT+LGJSOQDomLs1ntpyfeDnYr+96R8FKIOyxHA+mwg UTYJsc1TYo9mrAu9I0QDZZouLcxGyeBPJ7BUs1kegkyMnp0hNkwAfTbXDZXNsjQd2TOd C77D14D4iMFbfAcpcbLhlQ1fn/fWin4RtKZc0M9oH8E5Tg5mgVoJqnsgGSX/NsGNFuTb UX8Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mazbyic5SNu4z+oYUVy8aNG0fo9KurpfXXhcRmnZBAA=; b=dRRUNMFM8+t2sKC/9Ek74ili9xzLDZlPFj27Y9gX7809/XsUtsfuF7ss3kMUik9HOU dzV9G87bevmMg4JJh1kYaARYv63kDidW0miwLnouKQC5UlW1DFx36R5DYryqLd9eu8+4 ac/MWYJx1CkjtmUc/KHY3dvqQdaSLX5zOyY59dWNBqDD+RrMbe45NuqqEHzKlyzqWV9z 6ig9HNGDxcF741MNbyuULsWQyaxImQ0IvxgM0p+449dr7FXRYNj/qCWiwTIUaQRSSc0j 80HkoygN7NpihcEcaqTP+ve/9xhi+QAWwaFVv1dcNO2LrAOrYCgIi2hk9jsiTen6lfWT guRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=McbNL7jb; 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 dn4si226063edb.398.2020.05.26.10.27.11; Tue, 26 May 2020 10:27:34 -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=McbNL7jb; 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 S2389176AbgEZRXX (ORCPT + 99 others); Tue, 26 May 2020 13:23:23 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:50216 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389041AbgEZRXS (ORCPT ); Tue, 26 May 2020 13:23:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590513797; 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: in-reply-to:in-reply-to:references:references; bh=mazbyic5SNu4z+oYUVy8aNG0fo9KurpfXXhcRmnZBAA=; b=McbNL7jbIhlzjsntIKnmaPrxiVWAklJbg5OqqDFtyvNiN4bSFs8I0PDFCHV6fSB0/BEpUM 2ldTBW306JCZQLFuCULJ3cpcc4/7zSXp4Fw7sCGgkBnCGjtj5myQuieumsD2qKcHe0CrSB NWSF03I8NmtRY02KCMunVY5HRc4z7JA= 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-39-R9dLhXesMk2XvwjrBP7zzQ-1; Tue, 26 May 2020 13:23:13 -0400 X-MC-Unique: R9dLhXesMk2XvwjrBP7zzQ-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 530621855A08; Tue, 26 May 2020 17:23:12 +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 BE1F710013DB; Tue, 26 May 2020 17:23:11 +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 04/28] KVM: nSVM: remove exit_required Date: Tue, 26 May 2020 13:22:44 -0400 Message-Id: <20200526172308.111575-5-pbonzini@redhat.com> In-Reply-To: <20200526172308.111575-1-pbonzini@redhat.com> References: <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 All events now inject vmexits before vmentry rather than after vmexit. Therefore, exit_required is not set anymore and we can remove it. Signed-off-by: Paolo Bonzini --- arch/x86/kvm/svm/nested.c | 3 +-- arch/x86/kvm/svm/svm.c | 14 -------------- arch/x86/kvm/svm/svm.h | 3 --- 3 files changed, 1 insertion(+), 19 deletions(-) diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index 87fc5879dfaa..bbf991cfe24b 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -792,8 +792,7 @@ static int svm_check_nested_events(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm = to_svm(vcpu); bool block_nested_events = - kvm_event_needs_reinjection(vcpu) || svm->nested.exit_required || - svm->nested.nested_run_pending; + kvm_event_needs_reinjection(vcpu) || svm->nested.nested_run_pending; if (vcpu->arch.exception.pending) { if (block_nested_events) diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index 251c457820a1..270061fa6cfa 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -2889,13 +2889,6 @@ static int handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath) if (npt_enabled) vcpu->arch.cr3 = svm->vmcb->save.cr3; - if (unlikely(svm->nested.exit_required)) { - nested_svm_vmexit(svm); - svm->nested.exit_required = false; - - return 1; - } - if (is_guest_mode(vcpu)) { int vmexit; @@ -3327,13 +3320,6 @@ static fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu) svm->vmcb->save.rsp = vcpu->arch.regs[VCPU_REGS_RSP]; svm->vmcb->save.rip = vcpu->arch.regs[VCPU_REGS_RIP]; - /* - * A vmexit emulation is required before the vcpu can be executed - * again. - */ - if (unlikely(svm->nested.exit_required)) - return EXIT_FASTPATH_NONE; - /* * Disable singlestep if we're injecting an interrupt/exception. * We don't want our modified rflags to be pushed on the stack where diff --git a/arch/x86/kvm/svm/svm.h b/arch/x86/kvm/svm/svm.h index 8342032291fc..89fab75dd4f5 100644 --- a/arch/x86/kvm/svm/svm.h +++ b/arch/x86/kvm/svm/svm.h @@ -95,9 +95,6 @@ struct nested_state { u64 vmcb_msrpm; u64 vmcb_iopm; - /* A VMEXIT is required but not yet emulated */ - bool exit_required; - /* A VMRUN has started but has not yet been performed, so * we cannot inject a nested vmexit yet. */ bool nested_run_pending; -- 2.26.2