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=-5.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 5B2B1C43464 for ; Mon, 21 Sep 2020 09:27:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 04D2420BED for ; Mon, 21 Sep 2020 09:27:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="E/4hG1Ro" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726475AbgIUJ1E (ORCPT ); Mon, 21 Sep 2020 05:27:04 -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 > >