kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Dave Hansen <dave@sr71.net>, linux-kernel@vger.kernel.org
Cc: dave.hansen@linux.intel.com, tglx@linutronix.de, x86@kernel.org,
	peterz@infradead.org, gleb@redhat.com, kvm@vger.kernel.org,
	pbonzini@redhat.com, rostedt@goodmis.org
Subject: Re: [PATCH] x86: fix page fault tracing when KVM guest support enabled
Date: Fri, 16 May 2014 13:53:58 -0700	[thread overview]
Message-ID: <53767AE6.5020202@zytor.com> (raw)
In-Reply-To: <20140516194515.D859CC11@viggo.jf.intel.com>

On 05/16/2014 12:45 PM, Dave Hansen wrote:
> From: Dave Hansen <dave.hansen@linux.intel.com>
> 
> I noticed on some of my systems that page fault tracing doesn't
> work:
> 
> 	cd /sys/kernel/debug/tracing
> 	echo 1 > events/exceptions/enable
> 	cat trace;
> 	# nothing shows up
> 
> I eventually traced it down to CONFIG_KVM_GUEST.  At least in a
> KVM VM, enabling that option breaks page fault tracing, and
> disabling fixes it.  I tried on some old kernels and this does
> not appear to be a regression: it never worked.
> 
> There are two page-fault entry functions today.  One when tracing
> is on and another when it is off.  The KVM code calls do_page_fault()
> directly instead of calling the traced version:
> 
>> dotraplinkage void __kprobes
>> do_async_page_fault(struct pt_regs *regs, unsigned long
>> error_code)
>> {
>>         enum ctx_state prev_state;
>>
>>         switch (kvm_read_and_reset_pf_reason()) {
>>         default:
>>                 do_page_fault(regs, error_code);
>>                 break;
>>         case KVM_PV_REASON_PAGE_NOT_PRESENT:
> 
> I'm also having problems with the page fault tracing on bare
> metal (same symptom of no trace output).  I'm unsure if it's
> related.
> 
> Steven had an alternative to this which has zero overhead when
> tracing is off where this includes the standard noops even when
> tracing is disabled.  I'm unconvinced that the extra complexity
> of his apporach:
> 
> 	http://lkml.kernel.org/r/20140508194508.561ed220@gandalf.local.home
> 
> is worth it, expecially considering that the KVM code is already
> making page fault entry slower here.  This solution is
> dirt-simple.
> 
> Gleb, please apply.
> 
> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: x86@kernel.org
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Gleb Natapov <gleb@redhat.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: kvm@vger.kernel.org
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>

Acked-by: H. Peter Anvin <hpa@linux.intel.com>

If Gleb and Paolo are okay with it, I am.

	-hpa

  parent reply	other threads:[~2014-05-16 20:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-16 19:45 [PATCH] x86: fix page fault tracing when KVM guest support enabled Dave Hansen
2014-05-16 20:49 ` Steven Rostedt
2014-05-16 20:53 ` H. Peter Anvin [this message]
2014-05-16 21:01   ` Paolo Bonzini
2014-05-16 21:11     ` Dave Hansen

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=53767AE6.5020202@zytor.com \
    --to=hpa@zytor.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dave@sr71.net \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --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;
as well as URLs for NNTP newsgroup(s).