linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: wang.yi59@zte.com.cn
Cc: pbonzini@redhat.com, rkrcmar@redhat.com, tglx@linutronix.de,
	mingo@redhat.com, bp@alien8.de, hpa@zytor.com, x86@kernel.org,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] [next] KVM: lapic: allow set apic debug dynamically
Date: Fri, 10 May 2019 10:49:00 -0700	[thread overview]
Message-ID: <20190510174900.GB16852@linux.intel.com> (raw)
In-Reply-To: <201905101254211413423@zte.com.cn>

On Fri, May 10, 2019 at 12:54:21PM +0800, wang.yi59@zte.com.cn wrote:
> I grep "debug" in arch/x86/kvm, and find these *_debug:
> ioapic_debug
> apic_debug
> 
> and dbg in mmu.c, which is better to be renamed to mmu_debug as you said.
> 
> and vcpu_debug, which uses kvm_debug macro.
> 
> kvm_debug macro uses pr_debug which can be dynamically set during running
> time, so, how about change all *_debug in kvm to pr_debug like vcpu_debug?

It's still the same end result, we're bloating and slowing KVM with code
and conditionals that aren't useful in normal operation.  grep vcpu_debug
a bit further and you'll see that the only uses in x86 are when the guest
has crashed, is being reset, or is accessing an unhandled MSR and KVM is
injecting a #GP in response.  In other words, the existing uses are only
in code that isn't remotely performance critical.

  hyperv.c: vcpu_debug(vcpu, "hv crash (0x%llx 0x%llx 0x%llx 0x%llx 0x%llx)\n",
  hyperv.c: vcpu_debug(vcpu, "hyper-v reset requested\n");
  x86.c:    vcpu_debug_ratelimited(vcpu, "unhandled wrmsr: 0x%x data 0x%llx\n",
  x86.c:    vcpu_debug_ratelimited(vcpu, "unhandled rdmsr: 0x%x\n",

pr_debug does have more direct uses, notably in nested VMX and KVM TSC
handling.  Similar to the above vcpu_debug case, the nVMX uses are all
failing paths and not performance critical.  The TSC code does have one
path that may affect performance (get_kvmclock_ns()->kvm_get_time_scale()),
but I don't think that should be considered as setting the precedent.  In
fact, it may make sense to convert the TSC pr_debugs to be gated by
CONFIG_DEBUG_KVM as well.

Paolo, do you have any thoughts?

      parent reply	other threads:[~2019-05-10 17:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-09 10:47 [PATCH v2] [next] KVM: lapic: allow set apic debug dynamically Yi Wang
2019-05-09 20:20 ` Sean Christopherson
     [not found]   ` <201905101254211413423@zte.com.cn>
2019-05-10 17:49     ` Sean Christopherson [this message]

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=20190510174900.GB16852@linux.intel.com \
    --to=sean.j.christopherson@intel.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=wang.yi59@zte.com.cn \
    --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).