From patchwork Fri Sep 2 02:47:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hou Wenlong X-Patchwork-Id: 12963578 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD1B2ECAAD2 for ; Fri, 2 Sep 2022 02:47:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233222AbiIBCrK (ORCPT ); Thu, 1 Sep 2022 22:47:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231310AbiIBCrJ (ORCPT ); Thu, 1 Sep 2022 22:47:09 -0400 Received: from out0-148.mail.aliyun.com (out0-148.mail.aliyun.com [140.205.0.148]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D03D08A7DA; Thu, 1 Sep 2022 19:47:06 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047206;MF=houwenlong.hwl@antgroup.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---.P5lHg5l_1662086824; Received: from localhost(mailfrom:houwenlong.hwl@antgroup.com fp:SMTPD_---.P5lHg5l_1662086824) by smtp.aliyun-inc.com; Fri, 02 Sep 2022 10:47:04 +0800 From: "Hou Wenlong" To: kvm@vger.kernel.org Cc: Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] KVM: x86: Add missing trace points for RDMSR/WRMSR in emulator path Date: Fri, 02 Sep 2022 10:47:01 +0800 Message-Id: <39181a9f777a72d61a4d0bb9f6984ccbd1de2ea3.1661930557.git.houwenlong.hwl@antgroup.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Since the RDMSR/WRMSR emulation uses a sepearte emualtor interface, the trace points for RDMSR/WRMSR can be added in emulator path like normal path. Signed-off-by: Hou Wenlong --- arch/x86/kvm/x86.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 2596f5736743..1a224e575b0b 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -7927,9 +7927,12 @@ static int emulator_get_msr_with_filter(struct x86_emulate_ctxt *ctxt, if (kvm_msr_user_space(vcpu, msr_index, KVM_EXIT_X86_RDMSR, 0, complete_emulated_rdmsr, r)) return X86EMUL_IO_NEEDED; + + trace_kvm_msr_read_ex(msr_index); return X86EMUL_PROPAGATE_FAULT; } + trace_kvm_msr_read(msr_index, *pdata); return X86EMUL_CONTINUE; } @@ -7947,9 +7950,12 @@ static int emulator_set_msr_with_filter(struct x86_emulate_ctxt *ctxt, if (kvm_msr_user_space(vcpu, msr_index, KVM_EXIT_X86_WRMSR, data, complete_emulated_msr_access, r)) return X86EMUL_IO_NEEDED; + + trace_kvm_msr_write_ex(msr_index, data); return X86EMUL_PROPAGATE_FAULT; } + trace_kvm_msr_write(msr_index, data); return X86EMUL_CONTINUE; }