Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp685805pxk; Wed, 23 Sep 2020 13:18:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztRrrlydp2Sogar5GFp3foCWTHEBB9qANGBMJbQpEQSzdi+FkBl/nzrWaltTi2AWHC5eTu X-Received: by 2002:aa7:c347:: with SMTP id j7mr1116001edr.185.1600892321775; Wed, 23 Sep 2020 13:18:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600892321; cv=none; d=google.com; s=arc-20160816; b=0XsSWPH9rEZ/qEvO3rCNtDFVdDkNBI9yQOvnd7xXYA1+t+3OXYUX20he7yIRxjLJEu Hzub6qORoHw7l509745ferhBpEYoQBfp0dyfnGkuProVK2vWNrR/jZ+tdS26uHY3cFz/ slg/lvSyI5f+seXj2LN+xJYI9GgaV3Sk1AW2oA8du5c1Mm0PnS7Z1AD3hgaayKrIHTPI WUgqZo0OVgGY7Gi6ZCpnekv58EeUHFILraRZhmEuReQAYrWpgVP+Ph7cjYbmLuqyxkBA 9NarAAFFRRcXsl5tSMWVvOJqCcvWbrOyCBbt0bPmjugESYO5zJSnYKwAxtyF5MlCVES2 /9hg== 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 :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=UZGqzGhUtkib5ztMnLe+xoSKq3COeS5mt57ni6VTbaw=; b=YnqXQHDTb2GEdh206lsPUFclDxcR2X/95CSB8mT5sGzYa/Lbso8UjUk94BUlkW4LAy CZa2tmJ0kyGzXmQio6G/09oTvvZfrK1uR5Pr/B9KAgAWNVv798+XKx3PjpYH/lkHPBMX Z9PPFAzUssHUAes7qtcnjHnHhLl+a8iseeP/BkYal9Fc+xi0QTIqEvkYzyIuE9NxOG3i usVo3CEI86vF6th+HDRGT8VizVEofmpsTJELP61lEoqENH3oeey03EDhDnkXn5HM54gd oz6ut0Lz447c8bpM6sHcoQCRfbGdgE+ZTB6dB1KqS/+69UVVjaStML4zCkehYTlSSEsP vZ0Q== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ha18si691143ejb.543.2020.09.23.13.18.18; Wed, 23 Sep 2020 13:18:41 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726610AbgIWUNu (ORCPT + 99 others); Wed, 23 Sep 2020 16:13:50 -0400 Received: from mga12.intel.com ([192.55.52.136]:49295 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726381AbgIWUNu (ORCPT ); Wed, 23 Sep 2020 16:13:50 -0400 IronPort-SDR: wCdSiOs0vQx+K6ecUit0n5dkoIZWUio1IRk5CkYXWQeUe645YCqLRVc53YOq6Yae2BS853GBq3 1ubL57nGuteA== X-IronPort-AV: E=McAfee;i="6000,8403,9753"; a="140472231" X-IronPort-AV: E=Sophos;i="5.77,293,1596524400"; d="scan'208";a="140472231" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2020 13:13:50 -0700 IronPort-SDR: JfVoEbr6rZsBOcmB4MbTv8wPbPNLewwFXo5cbufAx/Tcpkxlz7F6ztJku6Df5R/rIAvnGXEJGg maqhCJcxx9Sg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,293,1596524400"; d="scan'208";a="349004933" Received: from sjchrist-coffee.jf.intel.com ([10.54.74.160]) by orsmga007.jf.intel.com with ESMTP; 23 Sep 2020 13:13:50 -0700 From: Sean Christopherson To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/7] KVM: x86: Tracepoint improvements and fixes Date: Wed, 23 Sep 2020 13:13:42 -0700 Message-Id: <20200923201349.16097-1-sean.j.christopherson@intel.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Various improvements and fixes for the kvm_entry, kvm_exit and kvm_nested_vmexit tracepoints. 1. Capture the guest's RIP during kvm_entry for obvious reasons. 2. Extend kvm_exit to report the same info as kvm_nested_vmexit, and macrofy its definition to reuse it verbatim for nested exits. 3. Stop passing in params to kvm_nested_vmexit, and instead use the same approach (and now code) as kvm_exit where the tracepoint uses a dedicated kvm_x86_ops hook to retrieve the info. 4. Stop reading GUEST_RIP, EXIT_QUAL, INTR_INFO, and ERROR_CODE on every VM-Exit from L2 (some of this comes in #3). This saves ~100 cycles (150+ with retpolines) on VM-Exits from L2 that are handled by L0, e.g. hardware interrupts. As noted by Vitaly, these changes break trace-cmd[*]. I hereby pinky swear that, if this series is merged, I will send patches to update trace-cmd. [*] git://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git v2: - Fixed some goofs in the changelogs. - Rebased to kvm/queue, commit e1ba1a15af73 ("KVM: SVM: Enable INVPCID feature on AMD"). Sean Christopherson (7): KVM: x86: Add RIP to the kvm_entry, i.e. VM-Enter, tracepoint KVM: x86: Read guest RIP from within the kvm_nested_vmexit tracepoint KVM: VMX: Add a helper to test for a valid error code given an intr info KVM: x86: Add intr/vectoring info and error code to kvm_exit tracepoint KVM: x86: Add macro wrapper for defining kvm_exit tracepoint KVM: x86: Use common definition for kvm_nested_vmexit tracepoint KVM: nVMX: Read EXIT_QUAL and INTR_INFO only when needed for nested exit arch/x86/include/asm/kvm_host.h | 7 ++- arch/x86/kvm/svm/svm.c | 16 ++--- arch/x86/kvm/trace.h | 107 +++++++++++++------------------- arch/x86/kvm/vmx/nested.c | 14 ++--- arch/x86/kvm/vmx/vmcs.h | 7 +++ arch/x86/kvm/vmx/vmx.c | 18 +++++- arch/x86/kvm/x86.c | 2 +- 7 files changed, 86 insertions(+), 85 deletions(-) -- 2.28.0