Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp946666imm; Thu, 13 Sep 2018 10:06:26 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaJ89z08Js2W61U7WBqTFg5TFAhMWVbil+xqcHoGQn3v+duNSpL2mTj6OX5NGeqIrpJraWD X-Received: by 2002:a63:1245:: with SMTP id 5-v6mr7876899pgs.299.1536858386780; Thu, 13 Sep 2018 10:06:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536858386; cv=none; d=google.com; s=arc-20160816; b=P+dWVX0D67Kuu9FeHDPG7WhYGxZcdjl6sA9SxcQ4M3hOLMNYnWnLTqfdKBz8NZVOUH Zk0s2xQxihvRxYdgWjZlgfzOy7Xo4DKQ2qsPXh/2zSjNmts6jVjP8+s/Xjo99aLojxFm vV2utN2MpxtA/GQQ+P6g4N+Jy8bsLNQp4038EbICwC7EU86BgOS7rlpGS8g3Mnb1CRBt pTjaPHDEa6+f2lQf0bTF58dDS8sVAPMiR4CkGbK0pPXGrh+q1WdyX7ZRRW0MsiAMLa/R wIBIrfrwwwh01AGj2ew28oPqmptrW5Z0y4cpwFt3c6jfdasbBETqhwg3q8yy7/3dS6F8 sJfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=nlnLeK3z/RPzNi5hq/c6Q2jaY+CrHsZUwi8RuTwTKZA=; b=mHJopASlOy/rVE5Iu6sY7PxQofX98wOx+Io3bkM3mTZXjYcRZU115PXH5aRGqRlwkl +YnEMSp1WkXtxn5/pHl4w7txynHFYGEebv8ZkMrW2RyDYqjMIDttyhTfk5Ksaam7JVYj fQLhUhDP5o3Gi2VwpgeMSGGDExWhE4vOWQmzLZWepwP38JYabXUic0Tlwwf4zMFhY6+m KKtak4vBYtr9rGsA9cfDQ1t/muj9oglPfxWR1nuUH2amjes7OAjTHCK5hFZ6zMkgBKjj VTFJFE8wiJDkkAeqloruwPm6HlblNiL6QBTFSZfnmgVPvfyhfieB3v5D9XtRAGzLxfXd 90nw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1-v6si4480101plr.326.2018.09.13.10.06.11; Thu, 13 Sep 2018 10:06:26 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728451AbeIMWQI (ORCPT + 99 others); Thu, 13 Sep 2018 18:16:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47112 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727082AbeIMWQH (ORCPT ); Thu, 13 Sep 2018 18:16:07 -0400 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 mx1.redhat.com (Postfix) with ESMTPS id 7FA543082B71; Thu, 13 Sep 2018 17:05:45 +0000 (UTC) Received: from vitty.brq.redhat.com (unknown [10.43.2.155]) by smtp.corp.redhat.com (Postfix) with ESMTP id 26AA0608E0; Thu, 13 Sep 2018 17:05:42 +0000 (UTC) From: Vitaly Kuznetsov To: kvm@vger.kernel.org Cc: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Roman Kagan , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , "Michael Kelley (EOSG)" , Jim Mattson , Liran Alon , linux-kernel@vger.kernel.org Subject: [PATCH v5 07/12] x86/kvm/hyperv: don't clear VP assist pages on init Date: Thu, 13 Sep 2018 19:05:17 +0200 Message-Id: <20180913170522.24876-8-vkuznets@redhat.com> In-Reply-To: <20180913170522.24876-1-vkuznets@redhat.com> References: <20180913170522.24876-1-vkuznets@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Thu, 13 Sep 2018 17:05:45 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org VP assist pages may hold valuable data which needs to be preserved across migration. Clean PV EOI portion of the data on init, the guest is responsible for making sure there's no garbage in the rest. This will be used for nVMX migration, eVMCS address needs to be preserved. Signed-off-by: Vitaly Kuznetsov --- arch/x86/kvm/hyperv.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c index b1655d01c368..ae3e2e0de680 100644 --- a/arch/x86/kvm/hyperv.c +++ b/arch/x86/kvm/hyperv.c @@ -1080,7 +1080,13 @@ static int kvm_hv_set_msr(struct kvm_vcpu *vcpu, u32 msr, u64 data, bool host) addr = kvm_vcpu_gfn_to_hva(vcpu, gfn); if (kvm_is_error_hva(addr)) return 1; - if (__clear_user((void __user *)addr, PAGE_SIZE)) + + /* + * Clear apic_assist portion of f(struct hv_vp_assist_page + * only, there can be valuable data in the rest which needs + * to be preserved e.g. on migration. + */ + if (__clear_user((void __user *)addr, sizeof(u32))) return 1; hv->hv_vapic = data; kvm_vcpu_mark_page_dirty(vcpu, gfn); -- 2.14.4