From: Haiwei Li <lihaiwei.kernel@gmail.com>
To: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: "hpa@zytor.com" <hpa@zytor.com>, "bp@alien8.de" <bp@alien8.de>,
"mingo@redhat.com" <mingo@redhat.com>,
"tglx@linutronix.de" <tglx@linutronix.de>,
joro@8bytes.org, "jmattson@google.com" <jmattson@google.com>,
"wanpengli@tencent.com" <wanpengli@tencent.com>,
sean.j.christopherson@intel.com,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"x86@kernel.org" <x86@kernel.org>
Subject: Re: [PATCH] KVM: SVM: Add tracepoint for cr_interception
Date: Fri, 4 Sep 2020 20:44:04 +0800 [thread overview]
Message-ID: <5b8d366f-db2d-489d-bb48-5c0287323ec6@gmail.com> (raw)
In-Reply-To: <87imctoinr.fsf@vitty.brq.redhat.com>
On 20/9/4 20:01, Vitaly Kuznetsov wrote:
> Haiwei Li <lihaiwei.kernel@gmail.com> writes:
>
>> From: Haiwei Li <lihaiwei@tencent.com>
>>
>> Add trace_kvm_cr_write and trace_kvm_cr_read for svm.
>>
>> Signed-off-by: Haiwei Li <lihaiwei@tencent.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@redhat.com>
Thanks a lot.
>
next prev parent reply other threads:[~2020-09-04 12:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-04 11:25 [PATCH] KVM: SVM: Add tracepoint for cr_interception Haiwei Li
2020-09-04 12:01 ` Vitaly Kuznetsov
2020-09-04 12:44 ` Haiwei Li [this message]
2020-09-23 6:24 ` Haiwei Li
2020-09-24 0:44 ` Wanpeng Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5b8d366f-db2d-489d-bb48-5c0287323ec6@gmail.com \
--to=lihaiwei.kernel@gmail.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=sean.j.christopherson@intel.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.