[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87imctoinr.fsf@vitty.brq.redhat.com>
Date: Fri, 04 Sep 2020 14:01:12 +0200
From: Vitaly Kuznetsov <vkuznets@...hat.com>
To: Haiwei Li <lihaiwei.kernel@...il.com>
Cc: "hpa\@zytor.com" <hpa@...or.com>, "bp\@alien8.de" <bp@...en8.de>,
"mingo\@redhat.com" <mingo@...hat.com>,
"tglx\@linutronix.de" <tglx@...utronix.de>, joro@...tes.org,
"jmattson\@google.com" <jmattson@...gle.com>,
"wanpengli\@tencent.com" <wanpengli@...cent.com>,
sean.j.christopherson@...el.com,
"pbonzini\@redhat.com" <pbonzini@...hat.com>,
"linux-kernel\@vger.kernel.org" <linux-kernel@...r.kernel.org>,
"kvm\@vger.kernel.org" <kvm@...r.kernel.org>,
"x86\@kernel.org" <x86@...nel.org>
Subject: Re: [PATCH] KVM: SVM: Add tracepoint for cr_interception
Haiwei Li <lihaiwei.kernel@...il.com> writes:
> From: Haiwei Li <lihaiwei@...cent.com>
>
> Add trace_kvm_cr_write and trace_kvm_cr_read for svm.
>
> Signed-off-by: Haiwei Li <lihaiwei@...cent.com>
> ---
> arch/x86/kvm/svm/svm.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index 03dd7bac8034..2c6dea48ba62 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -2261,6 +2261,7 @@ static int cr_interception(struct vcpu_svm *svm)
There are two special cases when we go to emulate_on_interception() and
these won't be logged but I don't think this is a must.
> if (cr >= 16) { /* mov to cr */
> cr -= 16;
> val = kvm_register_read(&svm->vcpu, reg);
> + trace_kvm_cr_write(cr, val);
> switch (cr) {
> case 0:
> if (!check_selective_cr0_intercepted(svm, val))
> @@ -2306,6 +2307,7 @@ static int cr_interception(struct vcpu_svm *svm)
> return 1;
> }
> kvm_register_write(&svm->vcpu, reg, val);
> + trace_kvm_cr_read(cr, val);
The 'default:' case above does 'return 1;' so we won't get the trace but
I understand you put trace_kvm_cr_read() here so you can log the
returned 'val', #UD should be clearly visible.
> }
> return kvm_complete_insn_gp(&svm->vcpu, err);
> }
> --
> 2.18.4
>
Reviewed-by: Vitaly Kuznetsov <vkuznets@...hat.com>
--
Vitaly
Powered by blists - more mailing lists