From: Ganapatrao Kulkarni <gpkulkarni@gmail.com>
To: Will Deacon <will.deacon@arm.com>, Ingo Molnar <mingo@redhat.com>,
acme@kernel.org, alexander.shishkin@linux.intel.com,
peterz@infradead.org
Cc: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Marc Zyngier <marc.zyngier@arm.com>,
jnair@caviumnetworks.com
Subject: Re: [PATCH] arm64: perf: Count EL2 events if either of kernel and hyp are not excluded
Date: Wed, 5 Apr 2017 15:18:17 +0530 [thread overview]
Message-ID: <CAFpQJXXi8BZAjooUtk9F1Xgzns6EBFOCB9AS8yVm3hGv5Ah93Q@mail.gmail.com> (raw)
In-Reply-To: <20170405083155.GA18287@arm.com>
[Adding maintainers]
On Wed, Apr 5, 2017 at 2:01 PM, Will Deacon <will.deacon@arm.com> wrote:
> On Wed, Apr 05, 2017 at 09:29:32AM +0530, Ganapatrao Kulkarni wrote:
>> On Tue, Apr 4, 2017 at 5:56 PM, Will Deacon <will.deacon@arm.com> wrote:
>> > On Tue, Apr 04, 2017 at 05:37:10PM +0530, Ganapatrao Kulkarni wrote:
>> >> On Tue, Apr 4, 2017 at 4:48 PM, Will Deacon <will.deacon@arm.com> wrote:
>> >> > On Tue, Apr 04, 2017 at 04:10:55PM +0530, Ganapatrao Kulkarni wrote:
>> >> >> commit d98ecda (arm64: perf: Count EL2 events if the kernel is running in HYP)
>> >> >> is returning error for perf syscall with mixed attribute set for exclude_kernel
>> >> >> and exlude_hv.
>> >> >>
>> >> >> This change is breaking some applications (observed with hhvm) when
>> >> >> ran with VHE enabled. Adding change to enable EL2 event counting,
>> >> >> if either of or both of exclude_kernel and exlude_hv are not set.
>> >> >>
>> >> >> Signed-off-by: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
>> >> >> ---
>> >> >> arch/arm64/kernel/perf_event.c | 19 ++++++++++++-------
>> >> >> 1 file changed, 12 insertions(+), 7 deletions(-)
>> >> >
>> >> > Hmm. When we have VHE, we can't distinguish between hypervisor and kernel,
>> >> > so this patch doesn't seem right to me. The code currently requires
>> >> > both exclude_kernel and exclude_hv to be clear before we enable profiling
>> >> > EL2, otherwise we're failing to exclude samples that were asked to be
>> >> > excluded.
>> >>
>> >> The application cant differentiate that kernel is running in EL2/VHE or in EL1
>> >> when VHE=1, is it makes sense to enable EL2 event counting when there
>> >> is request from application to either include kernel or hypervisor
>> >> event count, since both are same.
>> >
>> > You can make exactly the same argument against your proposal by saying that
>> > it makes sense to disable EL2 event counting when there is a request from
>> > an application to either exclude kernel or hypervisor event counting.
>>
>> yes, the argument is equally valid on either side.
>>
>> >
>> >> IMO, it is not appropriate to have different application behaviour
>> >> when kernel booted with VHE=0/1
>> >
>> > Then find another solution to that. How about a mechanism to advertise
>> > that exclude_hv is effectively always set if the kernel is running at EL2?
>>
>> I am not sure, how we can advertise to user that kernel is running at EL2.
>> we may add a note to man page of perf_event_open?
>> "exclude_hv is always set, if host kernel and hypervisor are running
>> at same privilege level",
>
> I was thinking of putting something into sysfs, alongside the other things
> we have in there. For example, a file that describes whether any of the
> perf_event_attr behave as though they are fixed to a certain value. We
> should involve the perf maintainers (and perf tool developers) in this,
> but perhaps something like an attr directory, where we could have a file
> called exclude_hv that contains the value 1.
>
> Will
prev parent reply other threads:[~2017-04-05 9:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-04 10:40 [PATCH] arm64: perf: Count EL2 events if either of kernel and hyp are not excluded Ganapatrao Kulkarni
2017-04-04 11:18 ` Will Deacon
2017-04-04 12:07 ` Ganapatrao Kulkarni
2017-04-04 12:26 ` Will Deacon
2017-04-05 3:59 ` Ganapatrao Kulkarni
2017-04-05 8:31 ` Will Deacon
2017-04-05 9:46 ` Ganapatrao Kulkarni
2017-04-05 9:48 ` Ganapatrao Kulkarni [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=CAFpQJXXi8BZAjooUtk9F1Xgzns6EBFOCB9AS8yVm3hGv5Ah93Q@mail.gmail.com \
--to=gpkulkarni@gmail.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=catalin.marinas@arm.com \
--cc=ganapatrao.kulkarni@cavium.com \
--cc=jnair@caviumnetworks.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=will.deacon@arm.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;
as well as URLs for NNTP newsgroup(s).