From: "Liang, Kan" <kan.liang@linux.intel.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: tglx@linutronix.de, mingo@redhat.com, acme@kernel.org,
linux-kernel@vger.kernel.org, bp@alien8.de, ak@linux.intel.com,
eranian@google.com
Subject: Re: [PATCH 1/2] perf: Add munmap callback
Date: Thu, 25 Oct 2018 10:00:07 -0400 [thread overview]
Message-ID: <0083c5c2-8a53-3aca-543b-16bd764e31ab@linux.intel.com> (raw)
In-Reply-To: <20181025002943.GT3109@worktop.c.hoisthospitality.com>
On 10/24/2018 8:29 PM, Peter Zijlstra wrote:
> On Wed, Oct 24, 2018 at 08:11:15AM -0700, kan.liang@linux.intel.com wrote:
>> +void perf_event_munmap(void)
>> +{
>> + struct perf_cpu_context *cpuctx;
>> + unsigned long flags;
>> + struct pmu *pmu;
>> +
>> + local_irq_save(flags);
>
> It is impossible to get here with IRQs already disabled.
I don't think so. Based on my test, IRQs are still enabled here. I once
observed dead lock with my stress test. So I have to explicitly disable
the IRQs here.
>
>> + list_for_each_entry(cpuctx, this_cpu_ptr(&sched_cb_list), sched_cb_entry) {
>> + pmu = cpuctx->ctx.pmu;
>> +
>> + if (!pmu->munmap)
>> + continue;
>> +
>> + perf_ctx_lock(cpuctx, cpuctx->task_ctx);
>> + perf_pmu_disable(pmu);
>> +
>> + pmu->munmap();
>> +
>> + perf_pmu_enable(pmu);
>> +
>> + perf_ctx_unlock(cpuctx, cpuctx->task_ctx);
>> + }
>> + local_irq_restore(flags);
>> +}
>> +
>> static void perf_event_switch(struct task_struct *task,
>> struct task_struct *next_prev, bool sched_in);
>>
>> diff --git a/mm/mmap.c b/mm/mmap.c
>> index 5f2b2b184c60..61978ad8c480 100644
>> --- a/mm/mmap.c
>> +++ b/mm/mmap.c
>> @@ -2777,6 +2777,7 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len,
>> /*
>> * Remove the vma's, and unmap the actual pages
>> */
>> + perf_event_munmap();
>
> I think that if you add the munmap hook, you should do it right and at
> least do it such that we can solve the other munmap problem.
>
Is this patch you mentioned?
https://lkml.org/lkml/2017/1/27/452
I will take a look and find a right place for both problems.
Thanks,
Kan
>> detach_vmas_to_be_unmapped(mm, vma, prev, end);
>> unmap_region(mm, vma, prev, start, end);
>>
>> --
>> 2.17.1
>>
next prev parent reply other threads:[~2018-10-25 14:00 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-24 15:11 [PATCH 1/2] perf: Add munmap callback kan.liang
2018-10-24 15:11 ` [PATCH 2/2] perf/x86/intel: Fix missing physical address in large PEBS kan.liang
2018-10-24 16:23 ` [PATCH 1/2] perf: Add munmap callback Andi Kleen
2018-10-24 16:32 ` Arnaldo Carvalho de Melo
2018-10-24 18:12 ` Liang, Kan
2018-10-24 18:28 ` Andi Kleen
2018-10-25 0:31 ` Peter Zijlstra
2018-10-24 19:15 ` Arnaldo Carvalho de Melo
2018-10-24 19:30 ` Stephane Eranian
2018-10-25 0:23 ` Peter Zijlstra
2018-10-25 0:25 ` Stephane Eranian
2018-10-25 0:34 ` Peter Zijlstra
2018-10-25 0:44 ` Stephane Eranian
2018-11-01 14:09 ` Liang, Kan
2018-11-05 10:59 ` Stephane Eranian
2018-11-05 15:43 ` Liang, Kan
2018-11-06 15:00 ` Stephane Eranian
2018-11-06 16:47 ` Liang, Kan
2018-10-25 0:29 ` Peter Zijlstra
2018-10-25 14:00 ` Liang, Kan [this message]
2018-10-30 12:51 ` Peter Zijlstra
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=0083c5c2-8a53-3aca-543b-16bd764e31ab@linux.intel.com \
--to=kan.liang@linux.intel.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=bp@alien8.de \
--cc=eranian@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--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).