Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp5113601ybf; Wed, 4 Mar 2020 17:37:02 -0800 (PST) X-Google-Smtp-Source: ADFU+vsvO4G6bBKlonVye5QKCVQJ5eo190jvMRPY0fpNyKbCfU9FR7fkPG7Rrug9DPWW9AYRZe8l X-Received: by 2002:a9d:7e8c:: with SMTP id m12mr4697146otp.5.1583372221965; Wed, 04 Mar 2020 17:37:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583372221; cv=none; d=google.com; s=arc-20160816; b=NARpB0vVvZT6QxmMq3NQcO2xwktf4rrfyeLpS0/Rla/HoSAHDcD0EPBuDPjQQ++HNt GRAMZxu4HovhklrtxA58f5bnTEWSWcxnM3ZzRf68qZA8lkX96hl/7SZ7oZ9Dj3nfjDsc PITi+NoDh57Z12bxj/5LIxip1nYmmlWIzaeiSMfeeaIULjKTJoYJ1zB3N1whzv6bBP2H RVlOhGROAo8MReQZN9qYtR4pcbxAJQZXFJnBFMjmYBAx/ntaoejBgl/qqObIR6ll1ceQ uIMMdB4zyRKWQoKUwCCtG9Db8GUBGB9suCDIcMEJjOcgzjdwEBH+Q91WkPasapNzkEry yTpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=WpyVIIjIutAWIxeogWZ3JWhxwkRnYI9PGowGinJi+us=; b=vGafB+ED/t5ocHkki3ngVJGHV+9E/tfzTZQTx1cbvoKKrsM9AaLyo1ZAuXxD/zz7GK Mx1r9cwX1gpkEktpTUQ/x6UXhxy3u9ZT81wxSALTTEnirCqS7qOX/6Roof9Sjx4R4LQB h/d/CDMrJWnLapvvyYyj/biEPsX160Muq4g9rggizBseDOu9PF2QIEDLiOTnssZ/QXct Z+Teq5MT+5ZpQUzavOR+28INb6Nsfkgu7qsvEslUu10JTslD+upcPaB5gZ+HhFh0oH5D UCFb4RBo+dCxAR4/6PEO3snYsdY6mtsstVWPhz+7npAsmw97+QTyHgYTrRj21W7nC8rT WdGg== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p12si2468199otk.173.2020.03.04.17.36.50; Wed, 04 Mar 2020 17:37:01 -0800 (PST) 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726094AbgCEBem (ORCPT + 99 others); Wed, 4 Mar 2020 20:34:42 -0500 Received: from mga03.intel.com ([134.134.136.65]:31855 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725818AbgCEBek (ORCPT ); Wed, 4 Mar 2020 20:34:40 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Mar 2020 17:34:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,516,1574150400"; d="scan'208";a="234301743" Received: from sjchrist-coffee.jf.intel.com ([10.54.74.202]) by fmsmga008.fm.intel.com with ESMTP; 04 Mar 2020 17:34:38 -0800 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, Pu Wen Subject: [PATCH v2 1/7] KVM: x86: Trace the original requested CPUID function in kvm_cpuid() Date: Wed, 4 Mar 2020 17:34:31 -0800 Message-Id: <20200305013437.8578-2-sean.j.christopherson@intel.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200305013437.8578-1-sean.j.christopherson@intel.com> References: <20200305013437.8578-1-sean.j.christopherson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jan Kiszka Trace the requested CPUID function instead of the effective function, e.g. if the requested function is out-of-range and KVM is emulating an Intel CPU, as the intent of the tracepoint is to show if the output came from the actual leaf as opposed to the max basic leaf via redirection. Similarly, leave "found" as is, i.e. report that an entry was found if and only if the requested entry was found. Fixes: 43561123ab37 ("kvm: x86: Improve emulation of CPUID leaves 0BH and 1FH") Signed-off-by: Jan Kiszka [Sean: Drop "found" semantic change, reword changelong accordingly ] Signed-off-by: Sean Christopherson --- arch/x86/kvm/cpuid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index b1c469446b07..b4beb3707d1b 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -1000,7 +1000,7 @@ static bool cpuid_function_in_range(struct kvm_vcpu *vcpu, u32 function) bool kvm_cpuid(struct kvm_vcpu *vcpu, u32 *eax, u32 *ebx, u32 *ecx, u32 *edx, bool check_limit) { - u32 function = *eax, index = *ecx; + u32 orig_function = *eax, function = *eax, index = *ecx; struct kvm_cpuid_entry2 *entry; struct kvm_cpuid_entry2 *max; bool found; @@ -1049,7 +1049,7 @@ bool kvm_cpuid(struct kvm_vcpu *vcpu, u32 *eax, u32 *ebx, } } } - trace_kvm_cpuid(function, *eax, *ebx, *ecx, *edx, found); + trace_kvm_cpuid(orig_function, *eax, *ebx, *ecx, *edx, found); return found; } EXPORT_SYMBOL_GPL(kvm_cpuid); -- 2.24.1