public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	joerg.roedel@amd.com, mingo@elte.hu, a.p.zijlstra@chello.nl
Subject: Re: [PATCH 8/9] KVM, VMX: Add support for guest/host-only profiling
Date: Tue, 4 Oct 2011 14:12:47 +0200	[thread overview]
Message-ID: <20111004121247.GH30105@redhat.com> (raw)
In-Reply-To: <4E8AECE2.7090206@redhat.com>

On Tue, Oct 04, 2011 at 01:24:18PM +0200, Avi Kivity wrote:
> On 10/04/2011 01:17 PM, Gleb Natapov wrote:
> >>
> >>  I mean, CONFIG_KVM&&  !CONFIG_PERF_EVENTS is an unlikely
> >>  combination.  If you're using kvm, you usually want PERF_EVENTS.
> >>
> >Who knows. Think about someone building appliance with embedded KVM and
> >trying to achieve minimal code footprint.
> 
> Saving a few dozen bytes, then launching a 1GB guest?
> 
> >It is much easier to add ifdefs
> >at the development stage then trying to figure out later what can be
> >ifdeffed. If we will do:
> >  if (!(cnt = perf_guest_get_msrs_count())
> >	return;
> >
> >at the beginning of atomic_switch_perf_msrs() then compiler can
> >eliminate dead code in case of !CONFIG_PERF_EVENTS since
> >perf_guest_get_msrs_count() will become 0, but this will add two
> >function calls on vmentry in CONFIG_PERF_EVENTS case.
> >
> 
> Then move it to the beginning:
> 
>    nr_msrs = perf_get_guest_msrs(&msr_buffer);
>    for (i = 0; i < nr_msrs; ++i)
>           add_atomic_switch_msr((*msr_buffer)[i], nr);
> 
> the compiler will kill the loop if nr_msrs is statically 0.
> 
Good idea. Just get rid of perf_guest_get_msrs_count().

--
			Gleb.

  reply	other threads:[~2011-10-04 12:13 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-03 13:49 [PATCH 0/9] perf support for x86 guest/host-only bits Gleb Natapov
2011-10-03 13:49 ` [PATCH 1/9] perf, core: Introduce attrs to count in either host or guest mode Gleb Natapov
2011-10-03 13:49 ` [PATCH 2/9] perf, amd: Use GO/HO bits in perf-ctr Gleb Natapov
2011-10-03 13:49 ` [PATCH 3/9] perf, tools: Add support for guest/host-only profiling Gleb Natapov
2011-10-03 13:49 ` [PATCH 4/9] perf, tools: Fix copy&paste error in perf-kvm option description Gleb Natapov
2011-10-03 13:49 ` [PATCH 5/9] perf, tools: Do guest-only counting in perf-kvm by default Gleb Natapov
2011-10-03 13:49 ` [PATCH 6/9] perf, intel: Use GO/HO bits in perf-ctr Gleb Natapov
2011-10-03 15:06   ` Avi Kivity
2011-10-03 15:41     ` Gleb Natapov
2011-10-04  9:21       ` Avi Kivity
2011-10-03 13:49 ` [PATCH 7/9] KVM, VMX: add support for switching of PERF_GLOBAL_CTRL Gleb Natapov
2011-10-04  9:32   ` Avi Kivity
2011-10-04  9:57     ` Gleb Natapov
2011-10-03 13:49 ` [PATCH 8/9] KVM, VMX: Add support for guest/host-only profiling Gleb Natapov
2011-10-03 15:00   ` Avi Kivity
2011-10-03 15:36     ` Gleb Natapov
2011-10-04  9:28       ` Avi Kivity
2011-10-04  9:56         ` Gleb Natapov
2011-10-04 11:10           ` Avi Kivity
2011-10-04 11:17             ` Gleb Natapov
2011-10-04 11:24               ` Avi Kivity
2011-10-04 12:12                 ` Gleb Natapov [this message]
2011-10-03 13:49 ` [PATCH 9/9] KVM, VMX: Check for automatic switch msr table overflow Gleb Natapov

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=20111004121247.GH30105@redhat.com \
    --to=gleb@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=avi@redhat.com \
    --cc=joerg.roedel@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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