Received: by 2002:a17:90a:9307:0:0:0:0 with SMTP id p7csp3944578pjo; Tue, 3 Mar 2020 09:52:14 -0800 (PST) X-Google-Smtp-Source: ADFU+vtkv0yNpQCqexAwpM5aZljRhWiKuqe1h/d7PdNWmxbcyoXTRWLF/kUL9dyMrGDlPaF6IShP X-Received: by 2002:a9d:f67:: with SMTP id 94mr4310625ott.46.1583257934836; Tue, 03 Mar 2020 09:52:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583257934; cv=none; d=google.com; s=arc-20160816; b=Mnovl1PgmMe0hLnlvICIu4u1Ub8tm6asw6vIgKB7lXvPyP1twZTmnoG9TiLWbrL9Gs DW/xcmTRJ/QdL32SCfIXaLVqKxcEPIkSuRAt6YWq6SOhfg4WY82qkuuLz8uGvfBiRYDQ 4WPRhRkVAef38c3rBJpBZZnPehWYy5m2MvFLfuzi4SZx9slCdhvynqwOHWn/be7+pfP9 zQL+S4il2BsQYvd+0PXgcO+ix2PecOTWn0bQnz9rDT+N/a0SZSbvuiM8qvvSN9SjeBwB oPCyzFnd4G8Ql6ZAtqNEdStO5F8F1Dbu1JgGMFsdwlEkd6bisHJWgocVUTggKUS6lhpy jXTA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=02zXo2ctoT8+sQAKPB8KvlF9Fw6d8ah80xmmO237Orc=; b=dbDLdmcplXXMu4eSoX+GNtiKfyOuLvGNVkDNF12avNjbThydlEp9d7rbfmU+Gv3nP5 o8ygcZJagi8wzgnsMSCeGLUwBLOSK1A2DocFO+e+IzYn+Z7SAH7wssFBymk/E71zUHnH lglUZTHzB2ZB/oC7Y06v0ivFYoTxrCbI9cp+Xm9r3xsO5d6XzyJGg9MAPSP1gXdwEnWH +28tY3SWdebxPJ13T/fuQ2A2MFYaAIrUMmCTrOHlu0GbFB3GwWUmMrsE686FbyCX1Aoj 6M4hpN3DuqUv3frurhZQsio7rKPxUbdz+wUrEytubN1VZBU56BzzRWj3s5gRoJwTMCHL IVFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="LVG7h+R/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k204si103372oih.261.2020.03.03.09.52.02; Tue, 03 Mar 2020 09:52:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="LVG7h+R/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731955AbgCCRvM (ORCPT + 99 others); Tue, 3 Mar 2020 12:51:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:59108 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731945AbgCCRvI (ORCPT ); Tue, 3 Mar 2020 12:51:08 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8E9BA206D5; Tue, 3 Mar 2020 17:51:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583257868; bh=dw5guOOn+gkkfTtyZ94+LanBzo9k9WiOrWQ7DTpDNwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LVG7h+R/D8g6T0hoYwxEekQjqKy3GxKDjETa560ig38v429QlrzJfNH1+UCQSKZFp ArPJp+ucDS4wyBJsUuL8ITDBAsM2vyl59G20XyovJMQ5O1q+LZ/zd0IgMLudhBkp5J Jy2J/lPerH0cZ4bEQkF7o1QpAYovk7haGptTASO0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.5 159/176] KVM: x86: Remove spurious clearing of async #PF MSR Date: Tue, 3 Mar 2020 18:43:43 +0100 Message-Id: <20200303174322.757276478@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200303174304.593872177@linuxfoundation.org> References: <20200303174304.593872177@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Christopherson commit 208050dac5ef4de5cb83ffcafa78499c94d0b5ad upstream. Remove a bogus clearing of apf.msr_val from kvm_arch_vcpu_destroy(). apf.msr_val is only set to a non-zero value by kvm_pv_enable_async_pf(), which is only reachable by kvm_set_msr_common(), i.e. by writing MSR_KVM_ASYNC_PF_EN. KVM does not autonomously write said MSR, i.e. can only be written via KVM_SET_MSRS or KVM_RUN. Since KVM_SET_MSRS and KVM_RUN are vcpu ioctls, they require a valid vcpu file descriptor. kvm_arch_vcpu_destroy() is only called if KVM_CREATE_VCPU fails, and KVM declares KVM_CREATE_VCPU successful once the vcpu fd is installed and thus visible to userspace. Ergo, apf.msr_val cannot be non-zero when kvm_arch_vcpu_destroy() is called. Fixes: 344d9588a9df0 ("KVM: Add PV MSR to enable asynchronous page faults delivery.") Signed-off-by: Sean Christopherson Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/x86.c | 2 -- 1 file changed, 2 deletions(-) --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -9227,8 +9227,6 @@ void kvm_arch_vcpu_postcreate(struct kvm void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) { - vcpu->arch.apf.msr_val = 0; - kvm_arch_vcpu_free(vcpu); }