Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp402061pxu; Tue, 5 Jan 2021 14:32:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJzq6ktmMIafukwoJwszrOyr8XxY/sOod6K5419nrIL9F/kjqGvYSg/y+XUCPGBvQfucnSRL X-Received: by 2002:aa7:c403:: with SMTP id j3mr1867542edq.217.1609885930292; Tue, 05 Jan 2021 14:32:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609885930; cv=none; d=google.com; s=arc-20160816; b=wuZUi2/bwd0lU/R+CXi9F4quJXjEI7zvn2+dhwZD/ReCmZOZdGGXHVCv4XhyzaQJoN qri8sPvIm6AmhHDeSQrZjAa/5hvLW+H4nRUqrOHIueOMCsNXjEtwKwlhFQ0RbGjsD2FR TFz3B2384z93zKF1X6o+fgxg7lJS0PoVrx7KQE86RWxsjweJsTLtfaJ2cWvGMsLIzrYl dUjbAD3O+rE0ihp87DTJsvn7+4JM8k7zByK2PASYLn/K8tD5SS4JFE8flYTOvid31C8Y RXKZgdLea3EZy8/9epJrXgSZh6yXS/UCKzjcKQx8BChcurCYsGICOUe22Wt50mib7yA6 B5EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=Hugo6ZEFcgLqAbh5AX1tterJDrXPcf7pVF8nJ3VeGds=; b=0sauwIcfoWvUqpLOfEMoADBu6+tnVvNAobHidWBDhfwSuKxZ2HbmGnKShHmDct1xhb G+ZEgumYjiRur4NNjGc7mvOLjzO470R7qF4ehNVl/xsfstfKdTXagraNEeaCQvPAr0MO Ch9bxnC+iK9taJXOPXczeopwtmIA93XK68/Ht03P+znu869Stx6EdbGVXG1VPmEMXP1H 50qOhDO+t6jnEXygtZBwv4ewWN6liivfRELJ1UuhDZ6gCwVgFw6q2Xs+9jSc68gcAxXB ZBbaT5S8NkRBdqZwfYEEnf90xa2GV3gUMvG5aC//K0K5sHPeH8fbP8rTUOrECmTYyxql Q/uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bAbuv8Qt; 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 p12si205877eji.735.2021.01.05.14.31.47; Tue, 05 Jan 2021 14:32:10 -0800 (PST) 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=bAbuv8Qt; 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 S1730819AbhAETaU (ORCPT + 99 others); Tue, 5 Jan 2021 14:30:20 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:25386 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728230AbhAETaU (ORCPT ); Tue, 5 Jan 2021 14:30:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609874933; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Hugo6ZEFcgLqAbh5AX1tterJDrXPcf7pVF8nJ3VeGds=; b=bAbuv8QtQrvlH8eRVqU9NP7sBn2E8mbAYnWVj8BrpAf0mAvvcMyPW+n17lnhoNgysskDPP iVXUE8kKjQDZTsYeJJoyKSX1n4j3Cti1bRrwDQ33MiAIXVTRHrRxKEkyL2NP7UZyIrzNg8 9PXEoxifvg7E+FCCSwTa0xdNAh3NFvA= 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-35-cyKzp4EYOGi4vuaXDDFyug-1; Tue, 05 Jan 2021 14:28:50 -0500 X-MC-Unique: cyKzp4EYOGi4vuaXDDFyug-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E3166800D53; Tue, 5 Jan 2021 19:28:48 +0000 (UTC) Received: from virtlab500.virt.lab.eng.bos.redhat.com (virtlab500.virt.lab.eng.bos.redhat.com [10.19.152.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A92D53C9F; Tue, 5 Jan 2021 19:28:45 +0000 (UTC) From: Nitesh Narayan Lal To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, seanjc@google.com, w90p710@gmail.com, pbonzini@redhat.com, vkuznets@redhat.com, nitesh@redhat.com Subject: [PATCH] Revert "KVM: x86: Unconditionally enable irqs in guest context" Date: Tue, 5 Jan 2021 14:28:44 -0500 Message-Id: <20210105192844.296277-1-nitesh@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This reverts commit d7a08882a0a4b4e176691331ee3f492996579534. After the introduction of the patch: 87fa7f3e9: x86/kvm: Move context tracking where it belongs since we have moved guest_exit_irqoff closer to the VM-Exit, explicit enabling of irqs to process pending interrupts should not be required within vcpu_enter_guest anymore. Conflicts: arch/x86/kvm/svm.c Signed-off-by: Nitesh Narayan Lal --- arch/x86/kvm/svm/svm.c | 9 +++++++++ arch/x86/kvm/x86.c | 11 ----------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index cce0143a6f80..c9b2fbb32484 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -4187,6 +4187,15 @@ static int svm_check_intercept(struct kvm_vcpu *vcpu, static void svm_handle_exit_irqoff(struct kvm_vcpu *vcpu) { + kvm_before_interrupt(vcpu); + local_irq_enable(); + /* + * We must have an instruction with interrupts enabled, so + * the timer interrupt isn't delayed by the interrupt shadow. + */ + asm("nop"); + local_irq_disable(); + kvm_after_interrupt(vcpu); } static void svm_sched_in(struct kvm_vcpu *vcpu, int cpu) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 3f7c1fc7a3ce..3e17c9ffcad8 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -9023,18 +9023,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) kvm_x86_ops.handle_exit_irqoff(vcpu); - /* - * Consume any pending interrupts, including the possible source of - * VM-Exit on SVM and any ticks that occur between VM-Exit and now. - * An instruction is required after local_irq_enable() to fully unblock - * interrupts on processors that implement an interrupt shadow, the - * stat.exits increment will do nicely. - */ - kvm_before_interrupt(vcpu); - local_irq_enable(); ++vcpu->stat.exits; - local_irq_disable(); - kvm_after_interrupt(vcpu); if (lapic_in_kernel(vcpu)) { s64 delta = vcpu->arch.apic->lapic_timer.advance_expire_delta; -- 2.27.0