public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Haiwei Li <lihaiwei.kernel@gmail.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, 04 Sep 2020 14:01:12 +0200	[thread overview]
Message-ID: <87imctoinr.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <f3031602-db3b-c4fe-b719-d402663b0a2b@gmail.com>

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>

-- 
Vitaly


  reply	other threads:[~2020-09-04 12:01 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 [this message]
2020-09-04 12:44   ` Haiwei Li
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=87imctoinr.fsf@vitty.brq.redhat.com \
    --to=vkuznets@redhat.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=lihaiwei.kernel@gmail.com \
    --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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox