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=-11.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT,USER_IN_DEF_DKIM_WL 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 3ECCCCA9EAE for ; Tue, 29 Oct 2019 21:06:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E4E062087E for ; Tue, 29 Oct 2019 21:06:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="JRcLNfKl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728121AbfJ2VGF (ORCPT ); Tue, 29 Oct 2019 17:06:05 -0400 Received: from mail-pg1-f202.google.com ([209.85.215.202]:46048 "EHLO mail-pg1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725840AbfJ2VGF (ORCPT ); Tue, 29 Oct 2019 17:06:05 -0400 Received: by mail-pg1-f202.google.com with SMTP id v10so12014900pge.12 for ; Tue, 29 Oct 2019 14:06:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=IOHjvz17CQBJcXRDm1CfUJG5TnoeR6CvrHThpcD2pHY=; b=JRcLNfKlLThQcDKj7JDVFoXkvmsLM+1ynya2CQz8HdtbzDj5Rm1qqOlualkmt6SvnC oKvHKoZqoxPExDrloXHW5NPwC1aMAVgKZD0GFsV+idgyrAjXpaAGdNw7u/xjCoOmL8ss e9uUVeBhBZFNbe3fGqdOZw7Ce0KDDo1dEycYsGAmoyHqMCc/FBjxLtGoPgN6YZhIRSIZ 0kl3JvAZpcu0OiYKB5N0i62I6bQjDD/LlNOCNMNIcSIpNikPf7Qyd7ecGHwKnqm6f3Ey 5xKUD1sC3PQ7ZI7pQHWak+EHsYf0VJP83IrRH1MzT0NBLFYpO4GPj4r3EBLHchDAhq5/ ULIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=IOHjvz17CQBJcXRDm1CfUJG5TnoeR6CvrHThpcD2pHY=; b=Yom1FnAmzIWzJ9bjea/+VTn94xIrZ8hY2Dl9gdpCncyfJqfWFGWOlu2fENUuJVEn9D 1+tm06s1j7aWtVHEB60uDtWKFhPZ8ya9UfmTQ3jIlflEoEPSxN3Y2P5RYe5Jz9Hk30E4 4N4uO4n/XrDYU1TxgtYNhwdLNruF9Af5sO+ciinBI12moelTNgbhZJvIfvFyybDedF/z 4pv553fX0WHohI6+SbZmbKxvXKQbK41ZxezV2SQwreMmKa55CrdlBcZsTRJxye/JpbZi MiYqbkhVmOSvjpGRCjTyK8fXvPMENpoYlxGPfQDixUGu45RUWSDP0v4DdjoZeWC5QYig Id8w== X-Gm-Message-State: APjAAAXEmGskkZcXfKEdvrkGG3yGJYXcmlrwUScMFdPHpoEoI6Sdxg65 4Ukmm3jjf6SnYcW+a9dQdskzgfS+3x6iiG4JyBVBWZ901/srwyPPTD1Qv6hUz7LPP9eUcgFZ0Ou CUMgoJWx+If74XXZmZ0dwpVuNVkPLCc5azTJuQQRoqpxU++GCq18cAlblBS9Y5csf2VSf X-Google-Smtp-Source: APXvYqwcUGFDYsfoEvI2ABJLun3RY+8ptJ/53Df4lFdCtQg8J67Cw1TZo+Nsul7/D/ELVh8NGhVFGgY1ZWugoy8D X-Received: by 2002:a63:1042:: with SMTP id 2mr16848851pgq.59.1572383164544; Tue, 29 Oct 2019 14:06:04 -0700 (PDT) Date: Tue, 29 Oct 2019 14:05:51 -0700 Message-Id: <20191029210555.138393-1-aaronlewis@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.24.0.rc0.303.g954a862665-goog Subject: [PATCH 0/4] Add support for capturing the highest observable L2 TSC From: Aaron Lewis To: kvm@vger.kernel.org Cc: Aaron Lewis Content-Type: text/plain; charset="UTF-8" Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The L1 hypervisor may include the IA32_TIME_STAMP_COUNTER MSR in the vmcs12 MSR VM-exit MSR-store area as a way of determining the highest TSC value that might have been observed by L2 prior to VM-exit. The current implementation does not capture a very tight bound on this value. To tighten the bound, add the IA32_TIME_STAMP_COUNTER MSR to the vmcs02 VM-exit MSR-store area whenever it appears in the vmcs12 VM-exit MSR-store area. When L0 processes the vmcs12 VM-exit MSR-store area during the emulation of an L2->L1 VM-exit, special-case the IA32_TIME_STAMP_COUNTER MSR, using the value stored in the vmcs02 VM-exit MSR-store area to derive the value to be stored in the vmcs12 VM-exit MSR-store area. Aaron Lewis (4): kvm: nested: Introduce read_and_check_msr_entry() kvm: vmx: Rename NR_AUTOLOAD_MSRS to NR_MSR_ENTRIES kvm: vmx: Rename function find_msr() to vmx_find_msr_index() KVM: nVMX: Add support for capturing highest observable L2 TSC arch/x86/kvm/vmx/nested.c | 126 ++++++++++++++++++++++++++++++++------ arch/x86/kvm/vmx/vmx.c | 14 ++--- arch/x86/kvm/vmx/vmx.h | 9 ++- 3 files changed, 121 insertions(+), 28 deletions(-) -- 2.24.0.rc0.303.g954a862665-goog