Re: [PATCH V3 01/13] perf/core, x86: Add PERF_SAMPLE_DATA_PAGE_SIZE

2019-02-08 Thread Liang, Kan
On 2/8/2019 5:39 AM, Thomas Gleixner wrote: On Thu, 31 Jan 2019, Liang, Kan wrote: +u64 perf_get_page_size(u64 virt) +{ + unsigned long flags; + unsigned int level; + pte_t *pte; + + if (!virt) + return 0; + + /* +* Interrupts are disabled,

Re: [PATCH V3 01/13] perf/core, x86: Add PERF_SAMPLE_DATA_PAGE_SIZE

2019-02-08 Thread Thomas Gleixner
On Thu, 31 Jan 2019, Liang, Kan wrote: > > > +u64 perf_get_page_size(u64 virt) > > > +{ > > > + unsigned long flags; > > > + unsigned int level; > > > + pte_t *pte; > > > + > > > + if (!virt) > > > + return 0; > > > + > > > + /* > > > + * Interrupts are disabled, so it prevents any tear

Re: [PATCH V3 01/13] perf/core, x86: Add PERF_SAMPLE_DATA_PAGE_SIZE

2019-01-31 Thread Will Deacon
On Thu, Jan 31, 2019 at 01:37:25PM +0100, Peter Zijlstra wrote: > On Wed, Jan 30, 2019 at 06:23:42AM -0800, kan.li...@linux.intel.com wrote: > > +enum perf_page_size { > > + PERF_PAGE_SIZE_NONE, > > + PERF_PAGE_SIZE_4K, > > + PERF_PAGE_SIZE_8K, > > + PERF_PAGE_SIZE_16K, > > +

Re: [PATCH V3 01/13] perf/core, x86: Add PERF_SAMPLE_DATA_PAGE_SIZE

2019-01-31 Thread Liang, Kan
On 1/31/2019 7:37 AM, Peter Zijlstra wrote: On Wed, Jan 30, 2019 at 06:23:42AM -0800, kan.li...@linux.intel.com wrote: diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index 374a197..03bf45d 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -2578,3 +2578,45 @@

Re: [PATCH V3 01/13] perf/core, x86: Add PERF_SAMPLE_DATA_PAGE_SIZE

2019-01-31 Thread Andi Kleen
> > 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

Re: [PATCH V3 01/13] perf/core, x86: Add PERF_SAMPLE_DATA_PAGE_SIZE

2019-01-31 Thread Peter Zijlstra
On Thu, Jan 31, 2019 at 01:37:25PM +0100, Peter Zijlstra wrote: > On Wed, Jan 30, 2019 at 06:23:42AM -0800, kan.li...@linux.intel.com wrote: > > diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c > > index 374a197..03bf45d 100644 > > --- a/arch/x86/events/core.c > > +++

Re: [PATCH V3 01/13] perf/core, x86: Add PERF_SAMPLE_DATA_PAGE_SIZE

2019-01-31 Thread Peter Zijlstra
On Wed, Jan 30, 2019 at 06:23:42AM -0800, kan.li...@linux.intel.com wrote: > diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c > index 374a197..03bf45d 100644 > --- a/arch/x86/events/core.c > +++ b/arch/x86/events/core.c > @@ -2578,3 +2578,45 @@ void perf_get_x86_pmu_capability(struct

[PATCH V3 01/13] perf/core, x86: Add PERF_SAMPLE_DATA_PAGE_SIZE

2019-01-30 Thread kan . liang
From: Kan Liang Current perf can report both virtual address and physical address, but it doesn't report page size. Users have no idea how large the utilized page is. They cannot promote/demote large pages to optimize memory use. Add a new sample type for data page size. Current perf already