From mboxrd@z Thu Jan 1 00:00:00 1970 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 25897C3F2C6 for ; Tue, 3 Mar 2020 17:51:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E9A6D214DB for ; Tue, 3 Mar 2020 17:51:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583257877; bh=dw5guOOn+gkkfTtyZ94+LanBzo9k9WiOrWQ7DTpDNwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=KsrywhHWGizk+GNSzdx//k1hwNrBp1P7lj5CXRjw9KHD4MB6imL+Ygba30u7jKLgp IQhcBwpG8ERdlT7xzCE0UdAk9GknHMa9UUMNMzyJgZwPwzU24mYrUSvEERg2oj86bs PXBY8Zjs0xSzAN70Si2kotXeHQWK2OnTI41dho08= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731948AbgCCRvJ (ORCPT ); Tue, 3 Mar 2020 12:51:09 -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: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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); }