From: Like Xu <like.xu@linux.intel.com>
To: "Jin, Yao" <yao.jin@linux.intel.com>,
Peter Zijlstra <peterz@infradead.org>
Cc: mingo@redhat.com, oleg@redhat.com, acme@kernel.org,
jolsa@kernel.org, Linux-kernel@vger.kernel.org,
ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com,
alexander.shishkin@linux.intel.com, mark.rutland@arm.com
Subject: Re: [PATCH v1 2/2] perf/core: Fake regs for leaked kernel samples
Date: Wed, 12 Aug 2020 15:25:03 +0800 [thread overview]
Message-ID: <aa38dc24-4496-2d26-071e-26e9fbc3dbd4@linux.intel.com> (raw)
In-Reply-To: <8bedaac0-2db1-b59c-581f-62f6d7a31c48@linux.intel.com>
On 2020/8/12 11:52, Jin, Yao wrote:
> Hi Peter,
>
> On 8/11/2020 4:45 PM, Peter Zijlstra wrote:
>> On Tue, Aug 11, 2020 at 04:31:10PM +0800, Jin, Yao wrote:
>>> Hi Peter,
>>>
>>> On 8/11/2020 3:59 PM, Peter Zijlstra wrote:
>>>> On Tue, Aug 11, 2020 at 03:50:43PM +0800, Jin, Yao wrote:
>>>>> Could I post v2 which basically refers to your patch but removes some
>>>>> conditions since I see some issues in test if we use these conditions.
>>>>>
>>>>> 1. Remove '!event->attr.exclude_hv || !event->attr.exclude_host ||
>>>>> !event->attr.exclude_guest' at the entry of sanitize_sample_regs().
>>>>>
>>>>> 2. Remove '!attr.exclude_hv || !attr.exclude_host ||
>>>>> !attr.exclude_guest'
>>>>> at the perf_event_open syscall entry.
>>>>
>>>> exclude_host, maybe -- due to the dodgy semantics of it, but the others
>>>> should definitely be there.
>>>>
>>>
>>> exclude_guest and exclude_hv are tricky too.
>>>
>>> If we do 'perf record -e cycles:u' in both host and guest, we can see:
>>>
>>> event->attr.exclude_guest = 0
>>>
>>> thus sanitize_sample_regs() returns regs directly even if exclude_kernel
>>> = 1.
>>>
>>> And in guest, exclude_hv = 0, it's out of my expectation too.
>>
>> I'm confused, how can 'perf record -e cycles:u' _ever_ have
>> exclude_guest=0, exclude_hv=0 ? That simply makes no sense and is utterly
>> broken.
>>
>> You explicitly ask for userspace-only, reporting hypervisor or guest
>> events is a straight up bug.
Guest events = guest user-space events + guest kernel-space events.
Some perf users on the host may only want to count guest user space events.
>>
>
> If we run 'perf record -e cycles:u',
>
> 1. On host, exclude_guest = 0 and exclude_hv = 1
>
> perf tool doesn't specially set 'exclude_guest' when it parses the 'u'
> modifier. I agree that can be improved. I will post a perf tool patch to
> fix that.
>
> 2. On guest, exclude_guest = 0 and exclude_hv = 0.
>
> For exclude_hv = 0, it looks like a bug but x86 doesn't use exclude_hv. But
> yes, we should fix that.
>
> CC Like Xu <like.xu@linux.intel.com>.
>
> Thanks
> Jin Yao
next prev parent reply other threads:[~2020-08-12 7:25 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-31 2:56 [PATCH v1 1/2] Missing instruction_pointer_set() instances Jin Yao
2020-07-31 2:56 ` [PATCH v1 2/2] perf/core: Fake regs for leaked kernel samples Jin Yao
2020-08-04 11:49 ` peterz
2020-08-05 2:15 ` Jin, Yao
2020-08-05 12:44 ` peterz
2020-08-05 12:57 ` peterz
2020-08-06 2:26 ` Jin, Yao
2020-08-06 9:18 ` peterz
2020-08-06 9:24 ` peterz
2020-08-07 5:32 ` Jin, Yao
2020-08-06 11:00 ` peterz
2020-08-07 6:24 ` Jin, Yao
2020-08-07 9:02 ` peterz
2020-08-10 2:03 ` Jin, Yao
2020-08-07 5:23 ` Jin, Yao
2020-08-11 7:50 ` Jin, Yao
2020-08-11 7:59 ` Peter Zijlstra
2020-08-11 8:31 ` Jin, Yao
2020-08-11 8:45 ` Peter Zijlstra
2020-08-12 3:52 ` Jin, Yao
2020-08-12 7:25 ` Like Xu [this message]
2020-08-04 11:31 ` [PATCH v1 1/2] Missing instruction_pointer_set() instances peterz
2020-08-05 0:26 ` Jin, Yao
2020-08-04 21:31 ` Max Filippov
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=aa38dc24-4496-2d26-071e-26e9fbc3dbd4@linux.intel.com \
--to=like.xu@linux.intel.com \
--cc=Linux-kernel@vger.kernel.org \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@intel.com \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=yao.jin@intel.com \
--cc=yao.jin@linux.intel.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