linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andi Kleen <ak@linux.intel.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: kan.liang@linux.intel.com, acme@kernel.org, tglx@linutronix.de,
	mingo@redhat.com, linux-kernel@vger.kernel.org,
	eranian@google.com, jolsa@redhat.com, namhyung@kernel.org,
	Andy Lutomirski <luto@amacapital.net>
Subject: Re: [PATCH V3 01/13] perf/core, x86: Add PERF_SAMPLE_DATA_PAGE_SIZE
Date: Thu, 31 Jan 2019 05:10:20 -0800	[thread overview]
Message-ID: <20190131131020.GX6118@tassilo.jf.intel.com> (raw)
In-Reply-To: <20190131123725.GB31516@hirez.programming.kicks-ass.net>

> 
> Aside from all the missin {}, I'm fairly sure this is broken since this
> happens from NMI context. This can interrupt switch_mm() and things like
> use_temporary_mm().

So the concern is that the sample is from before the switch, and then
looks it up in the wrong page tables if the PMI happens after the switch
due to sampling skid?

First this can happen only with PEBS, which doesn't have that
bad worst case skid (perhaps tens of cycles)

I doubt it is very likely because this problem could only happen
for user addresses because kernel page tables don't change. 

But we would be in the middle of the context 
switch (or use_temporary_mm) here, and there should be no
user space accesses within a tens of cycle window 
(except perhaps for the rseq address, but that's not a very
interesting case)

I assume the use_temporary_mm() cases are similar.

I suppose we could enforce flushing the PMU on such context switches,
but I would suspect while it's a valid theoretical problem, 
it's unlikely to be a real problem in practice.

Likely it means that large buffer PEBS cannot be ever used
with this option, but I guess that's ok.

-Andi


  parent reply	other threads:[~2019-01-31 13:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-30 14:23 [PATCH V3 01/13] perf/core, x86: Add PERF_SAMPLE_DATA_PAGE_SIZE kan.liang
2019-01-30 14:23 ` [PATCH V3 02/13] perf tools: Support new sample type for data page size kan.liang
2019-01-30 14:23 ` [PATCH V3 03/13] perf script: Support " kan.liang
2019-01-30 14:23 ` [PATCH V3 04/13] perf sort: Add sort option for " kan.liang
2019-01-30 14:23 ` [PATCH V3 05/13] perf mem: Factor out a function to generate sort order kan.liang
2019-01-30 14:23 ` [PATCH V3 06/13] perf mem: Clean up output format kan.liang
2019-01-30 14:23 ` [PATCH V3 07/13] perf mem: Support data page size kan.liang
2019-01-30 14:23 ` [PATCH V3 08/13] perf test: Add test case for PERF_SAMPLE_DATA_PAGE_SIZE kan.liang
2019-01-30 14:23 ` [PATCH V3 09/13] perf/core, x86: Add support for PERF_SAMPLE_CODE_PAGE_SIZE kan.liang
2019-01-30 14:23 ` [PATCH V3 10/13] perf tools: " kan.liang
2019-01-30 14:23 ` [PATCH V3 11/13] perf script: " kan.liang
2019-01-30 14:23 ` [PATCH V3 12/13] perf report: " kan.liang
2019-01-30 14:23 ` [PATCH V3 13/13] perf test: Add test case " kan.liang
2019-01-31 12:37 ` [PATCH V3 01/13] perf/core, x86: Add PERF_SAMPLE_DATA_PAGE_SIZE Peter Zijlstra
2019-01-31 12:59   ` Peter Zijlstra
2019-01-31 13:10   ` Andi Kleen [this message]
2019-01-31 14:58   ` Liang, Kan
2019-02-08 10:39     ` Thomas Gleixner
2019-02-08 13:35       ` Liang, Kan
2019-02-01  5:02   ` Will Deacon

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=20190131131020.GX6118@tassilo.jf.intel.com \
    --to=ak@linux.intel.com \
    --cc=acme@kernel.org \
    --cc=eranian@google.com \
    --cc=jolsa@redhat.com \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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).