Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2995010pxk; Mon, 21 Sep 2020 02:30:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlgEtAjpEd5/cGlNGhaS9PYDnCG1Cz0vKDbF7EXO2hrXgCPwtj74XqP/X6ladJ5WJG4va9 X-Received: by 2002:a05:6402:1254:: with SMTP id l20mr51210306edw.312.1600680640289; Mon, 21 Sep 2020 02:30:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600680640; cv=none; d=google.com; s=arc-20160816; b=ShFRlV+KJZ+blgJU6MwNDPNDPUI+tus93P1/z9t5HmX0kIMNZzByjh8rI9RqvsG/1m BfWaa30D7Wf4pIovkYX0y90y8PhsWiuzar0ZxKzffw/mGrvPhBp9IPQE3R7FACRi6IL1 GnADuU7Ykg9T91uvroJmGFdLOCvf7VFKiQ7Edqm/dOY6HCInHWDx3OjDyUr65SNK9txG 4q5k1kbLDJ1MMpH5f8/nQyvP7D7ezYeWDAChLwF+ygfg9e0qD+eeV+xidpu3uGadaUJz Z4cg6R8PxoQFcANDBELPHGRA2VT2BsNq8OW/Ox5OiXvqWCJfCfqIugg22BN1/181JvcZ S2qg== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=R/mWcb3lVK8Gq7w/NdqwWlKh9+OIwDSzQsY/Vm1E6nM=; b=V34g6Lqw+7tpck+4Y6oEaMwX4s1ZhIIjARZ2vH9qZoLLJ7aZs/Zssxn34RnyZMPr4Q KS6gNitxgqJv5baIHPwca1Et0ns1ULWvyN2wl3JbccVj8XSc3HdLK/T7/jUgi1ZbxA0V X6wdlMjdWc3CAZUNW1mgmnIKEWB+27ImqZDYsfucZBXpY9njJRtrcgd40jJyusFg/6o8 MRJ8H3hDl/cOQxV/juNPThySAabBPJ4xve12kSSqD7D73gToDjtIPqcOBYHCjKGQG2Y/ RxtaMLPllMWAw/dQAJDVNz0WZiyjprgJuWRoguWu5MOUI4CihmzzC7cjcoPJdY3zobnG tSzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="E/4hG1Ro"; 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 l23si9340815ejb.172.2020.09.21.02.30.16; Mon, 21 Sep 2020 02:30:40 -0700 (PDT) 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="E/4hG1Ro"; 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 S1726326AbgIUJ1D (ORCPT + 99 others); Mon, 21 Sep 2020 05:27:03 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:42617 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726347AbgIUJ1D (ORCPT ); Mon, 21 Sep 2020 05:27:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600680422; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R/mWcb3lVK8Gq7w/NdqwWlKh9+OIwDSzQsY/Vm1E6nM=; b=E/4hG1RofRhA4crNSTNGy4j3N6+EhNFjhLfSq72SC3IgmKuxjD7C/H3JZDJBE6q47zvdy7 oq107/50Y/sT+7pxHNM0EgyCGNRfu5IDH8oPb+TKgU+JbdndMYyDZkyIIpBSbAhtnIHxOU ZE3JpyLcod+FcayaVxNjihmQhQS89hM= 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-70-bXlEz8G5OUCmDZnu3Rr_vw-1; Mon, 21 Sep 2020 05:27:00 -0400 X-MC-Unique: bXlEz8G5OUCmDZnu3Rr_vw-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 8CEF2186A56B; Mon, 21 Sep 2020 09:26:58 +0000 (UTC) Received: from starship (unknown [10.35.206.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id DDE2A73684; Mon, 21 Sep 2020 09:26:53 +0000 (UTC) Message-ID: <6310fbe66e89b9f82ac88f7f080ea2eff2dad74e.camel@redhat.com> Subject: Re: [PATCH 1/1] KVM: x86: fix MSR_IA32_TSC read for nested migration From: Maxim Levitsky To: Sean Christopherson Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Jim Mattson , Borislav Petkov , Joerg Roedel , "H. Peter Anvin" , Paolo Bonzini , Wanpeng Li , Ingo Molnar , Thomas Gleixner , Vitaly Kuznetsov Date: Mon, 21 Sep 2020 12:26:52 +0300 In-Reply-To: <20200917161450.GD13522@sjchrist-ice> References: <20200917110723.820666-1-mlevitsk@redhat.com> <20200917110723.820666-2-mlevitsk@redhat.com> <20200917161450.GD13522@sjchrist-ice> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.3 (3.36.3-1.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2020-09-17 at 09:14 -0700, Sean Christopherson wrote: > On Thu, Sep 17, 2020 at 02:07:23PM +0300, Maxim Levitsky wrote: > > + * Intel PRM states that MSR_IA32_TSC read adds the TSC offset > > One more nit, "Intel SDM" would be preferred as that's most commonly used in > KVM changelogs, and there are multiple PRM acronyms in Intel's dictionary > these days. Fixed. Best regards, Maxim Levitsky > > > + * even when not intercepted. AMD manual doesn't define this > > + * but appears to behave the same > > + * > > + * However when userspace wants to read this MSR, return its > > + * real L1 value so that its restore will be correct > > + * > > + */ > > + if (msr_info->host_initiated) > > + msr_info->data = kvm_read_l1_tsc(vcpu, rdtsc()); > > + else > > + msr_info->data = kvm_read_l2_tsc(vcpu, rdtsc()); > > break; > > case MSR_MTRRcap: > > case 0x200 ... 0x2ff: > > -- > > 2.26.2 > >