mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Cc: Avi Kivity <avi@redhat.com>, LKML <linux-kernel@vger.kernel.org>,
	KVM <kvm@vger.kernel.org>
Subject: Re: [PATCH] KVM: trace the events of mmu_notifier
Date: Thu, 23 Aug 2012 06:24:05 -0300	[thread overview]
Message-ID: <20120823092405.GB32710@amt.cnet> (raw)
In-Reply-To: <50335A27.2070306@linux.vnet.ibm.com>

On Tue, Aug 21, 2012 at 05:51:35PM +0800, Xiao Guangrong wrote:
> mmu_notifier is the interface to broadcast the mm events to KVM, the
> tracepoints introduced in this patch can trace all these events, it is
> very helpful for us to notice and fix the bug caused by mm
> 
> Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
> ---
>  include/trace/events/kvm.h |  121 ++++++++++++++++++++++++++++++++++++++++++++
>  virt/kvm/kvm_main.c        |   19 +++++++
>  2 files changed, 140 insertions(+), 0 deletions(-)
> 
> diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h
> index 7ef9e75..a855ff9 100644
> --- a/include/trace/events/kvm.h
> +++ b/include/trace/events/kvm.h
> @@ -309,6 +309,127 @@ TRACE_EVENT(
> 
>  #endif
> 
> +#if defined(CONFIG_MMU_NOTIFIER) && defined(KVM_ARCH_WANT_MMU_NOTIFIER)
> +DECLARE_EVENT_CLASS(mmu_notifier_address_class,
> +
> +	TP_PROTO(struct kvm *kvm, unsigned long address),
> +
> +	TP_ARGS(kvm, address),
> +
> +	TP_STRUCT__entry(
> +		__field(struct kvm *, kvm)
> +		__field(unsigned long, address)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->kvm = kvm;
> +		__entry->address = address;
> +	),
> +
> +	TP_printk("kvm %p address %lx", __entry->kvm, __entry->address)


Perhaps the pointer was useful for debugging, but otherwise, i don't
think it should be printed.

> +	TP_ARGS(kvm, address, pte),
> +
> +	TP_STRUCT__entry(
> +		__field(struct kvm *, kvm)
> +		__field(unsigned long, address)
> +		__field(unsigned long, pte)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->kvm = kvm;
> +		__entry->address = address;
> +		__entry->pte = pte.pte;
> +	),
> +
> +	TP_printk("kvm %p address %lx pte %lx", __entry->kvm, __entry->address,
> +		  __entry->pte)

The pte bits can be spelled out? (see __print_symbolic).

>  	spin_lock(&kvm->mmu_lock);
> 
> +	trace_kvm_mmu_notifier_clear_flush_young(kvm, address);
> +
>  	young = kvm_age_hva(kvm, address);
>  	if (young)
>  		kvm_flush_remote_tlbs(kvm);
> @@ -394,6 +407,9 @@ static int kvm_mmu_notifier_test_young(struct mmu_notifier *mn,
> 
>  	idx = srcu_read_lock(&kvm->srcu);
>  	spin_lock(&kvm->mmu_lock);
> +
> +	trace_kvm_mmu_notifier_test_young(kvm, address);
> +

can print young information?

>  	young = kvm_test_age_hva(kvm, address);
>  	spin_unlock(&kvm->mmu_lock);
>  	srcu_read_unlock(&kvm->srcu, idx);
> @@ -408,6 +424,9 @@ static void kvm_mmu_notifier_release(struct mmu_notifier *mn,
>  	int idx;
> 
>  	idx = srcu_read_lock(&kvm->srcu);
> +
> +	trace_kvm_mmu_notifier_release(kvm);
> +
>  	kvm_arch_flush_shadow(kvm);
>  	srcu_read_unlock(&kvm->srcu, idx);
>  }



  reply	other threads:[~2012-08-23 12:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-21  9:51 Xiao Guangrong
2012-08-23  9:24 ` Marcelo Tosatti [this message]
2012-08-23 12:30   ` Xiao Guangrong
2012-08-23 13:08     ` Marcelo Tosatti
2012-08-24  1:36       ` Xiao Guangrong

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=20120823092405.GB32710@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xiaoguangrong@linux.vnet.ibm.com \
    /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

all inboxes | Powered by JetHome®