Re: [PATCH V8 1/4] perf/core: Add PERF_SAMPLE_DATA_PAGE_SIZE

2020-10-01 Thread Peter Zijlstra
On Thu, Oct 01, 2020 at 06:49:36AM -0700, Dave Hansen wrote: > On 9/30/20 10:30 AM, Peter Zijlstra wrote: > > In general though; I think using ->active_mm is a mistake though. That > > code should be doing something like: > > > > > > mm = current->mm; > > if (!mm) > > mm =

Re: [PATCH V8 1/4] perf/core: Add PERF_SAMPLE_DATA_PAGE_SIZE

2020-10-01 Thread Dave Hansen
On 9/30/20 10:30 AM, Peter Zijlstra wrote: > In general though; I think using ->active_mm is a mistake though. That > code should be doing something like: > > > mm = current->mm; > if (!mm) > mm = _mm; > I was hoping that using ->active_mm would give us the *actual*

Re: [PATCH V8 1/4] perf/core: Add PERF_SAMPLE_DATA_PAGE_SIZE

2020-10-01 Thread Liang, Kan
On 9/30/2020 6:45 PM, Stephane Eranian wrote: On Wed, Sep 30, 2020 at 10:30 AM Peter Zijlstra wrote: On Wed, Sep 30, 2020 at 07:48:48AM -0700, Dave Hansen wrote: On 9/30/20 7:42 AM, Liang, Kan wrote: When I tested on my kernel, it panicked because I suspect current->active_mm could be

Re: [PATCH V8 1/4] perf/core: Add PERF_SAMPLE_DATA_PAGE_SIZE

2020-09-30 Thread Stephane Eranian
On Wed, Sep 30, 2020 at 10:30 AM Peter Zijlstra wrote: > > On Wed, Sep 30, 2020 at 07:48:48AM -0700, Dave Hansen wrote: > > On 9/30/20 7:42 AM, Liang, Kan wrote: > > >> When I tested on my kernel, it panicked because I suspect > > >> current->active_mm could be NULL. Adding a check for NULL

Re: [PATCH V8 1/4] perf/core: Add PERF_SAMPLE_DATA_PAGE_SIZE

2020-09-30 Thread Peter Zijlstra
On Wed, Sep 30, 2020 at 07:48:48AM -0700, Dave Hansen wrote: > On 9/30/20 7:42 AM, Liang, Kan wrote: > >> When I tested on my kernel, it panicked because I suspect > >> current->active_mm could be NULL. Adding a check for NULL avoided the > >> problem. But I suspect this is not the correct

Re: [PATCH V8 1/4] perf/core: Add PERF_SAMPLE_DATA_PAGE_SIZE

2020-09-30 Thread Stephane Eranian
On Wed, Sep 30, 2020 at 7:48 AM Dave Hansen wrote: > > On 9/30/20 7:42 AM, Liang, Kan wrote: > >> When I tested on my kernel, it panicked because I suspect > >> current->active_mm could be NULL. Adding a check for NULL avoided the > >> problem. But I suspect this is not the correct solution. > >

Re: [PATCH V8 1/4] perf/core: Add PERF_SAMPLE_DATA_PAGE_SIZE

2020-09-30 Thread Dave Hansen
On 9/30/20 7:42 AM, Liang, Kan wrote: >> When I tested on my kernel, it panicked because I suspect >> current->active_mm could be NULL. Adding a check for NULL avoided the >> problem. But I suspect this is not the correct solution. > > I guess the NULL active_mm should be a rare case. If so, I

Re: [PATCH V8 1/4] perf/core: Add PERF_SAMPLE_DATA_PAGE_SIZE

2020-09-30 Thread Liang, Kan
On 9/30/2020 3:15 AM, Stephane Eranian wrote: +static u64 perf_get_page_size(unsigned long addr) +{ + unsigned long flags; + u64 size; + + if (!addr) + return 0; + + /* +* Software page-table walkers must disable IRQs, +* which prevents

Re: [PATCH V8 1/4] perf/core: Add PERF_SAMPLE_DATA_PAGE_SIZE

2020-09-30 Thread Dave Hansen
On 9/30/20 12:15 AM, Stephane Eranian wrote: >> + /* >> +* Software page-table walkers must disable IRQs, >> +* which prevents any tear down of the page tables. >> +*/ >> + local_irq_save(flags); >> + >> + size = __perf_get_page_size(current->active_mm,

Re: [PATCH V8 1/4] perf/core: Add PERF_SAMPLE_DATA_PAGE_SIZE

2020-09-30 Thread Stephane Eranian
On Mon, Sep 21, 2020 at 8:29 AM wrote: > > From: Kan Liang > > Current perf can report both virtual addresses and physical addresses, > but not the MMU page size. Without the MMU page size information of the > utilized page, users cannot decide whether to promote/demote large pages > to optimize