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=ham 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 9B267C3F2C6 for ; Tue, 3 Mar 2020 18:02:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6C42120836 for ; Tue, 3 Mar 2020 18:02:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583258522; bh=rICYxqChW/X52ERvK8ouqHguAYvz1NAQu0tJWYUktrU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=wXDi5OO8AlEoDtAmdPzlEftg/L1WaJ++cpg0j2om4EbM4OKMePUNBmSv8/mBSF7L1 GgwzxB+h9VRB+460N/A/bTWunmFPCcIvv4w7QPDdrqXwYGouMY3lb4hJmzlWdDA9xh NgQilosCFniQgsHpFYZHicP7/Ydx0cY7fuBNcutA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388115AbgCCSCB (ORCPT ); Tue, 3 Mar 2020 13:02:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:46456 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388100AbgCCSCA (ORCPT ); Tue, 3 Mar 2020 13:02:00 -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 A48BC215A4; Tue, 3 Mar 2020 18:01:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583258520; bh=rICYxqChW/X52ERvK8ouqHguAYvz1NAQu0tJWYUktrU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jLufLLOB3olpOiPLvcPHXtOZbacxpOSbnjLD8IinqkCEmknOJHsXWQ2cife8BqmMv moI/fhIJ7JGyXu/6vlzDSZznEzpDo5Up80bKP0h9XKlLdn7KrGqEDnS4I0u1FUbRrU M+PBhI97qOJr9AOAqci1+Jd2yoT5/7alQJ7ClTXY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini Subject: [PATCH 4.19 81/87] KVM: x86: Remove spurious clearing of async #PF MSR Date: Tue, 3 Mar 2020 18:44:12 +0100 Message-Id: <20200303174357.559615558@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200303174349.075101355@linuxfoundation.org> References: <20200303174349.075101355@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 @@ -8693,8 +8693,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); }