From: Frederic Weisbecker <fweisbec@gmail.com>
To: Stephane Eranian <eranian@google.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
mingo@elte.hu, paulus@samba.org, davem@davemloft.net,
perfmon2-devel@lists.sf.net, eranian@gmail.com,
robert.richter@amd.com, markus.t.metzger@intel.com
Subject: Re: [PATCH] perf_events: improve DS/BTS/PEBS buffer allocation
Date: Mon, 13 Sep 2010 17:09:17 +0200 [thread overview]
Message-ID: <20100913150914.GA6155@nowhere> (raw)
In-Reply-To: <4c8e3c0c.12d1d80a.73d9.ffffcf21@mx.google.com>
On Mon, Sep 13, 2010 at 04:55:01PM +0200, Stephane Eranian wrote:
> The DS, BTS, and PEBS memory regions were allocated using kzalloc(), i.e.,
> requesting contiguous physical memory. There is no such restriction on
> DS, PEBS and BTS buffers. Using kzalloc() could lead to error in case
> no contiguous physical memory is available. BTS is requesting 64KB,
> thus it can cause issues. PEBS is currently only requesting one page.
> Both PEBS and BTS are static buffers allocated for each CPU at the
> first user. When the last user exists, the buffers are released.
>
> All buffers are only accessed on the CPU they are attached to.
> kzalloc() does not take into account NUMA, thus all allocations
> are taking place on the NUMA node where the perf_event_open() is
> made.
>
> This patch switches allocation to vmalloc_node() to use non-contiguous
> physical memory and to allocate on the NUMA node corresponding to each
> CPU. We switched DS and PEBS although they do not cause problems today,
> to, at least, make the allocation on the correct NUMA node. In the future,
> the PEBS buffer size may increase. DS may also grow bigger than a page.
> This patch eliminates the memory allocation imbalance.
>
> vmalloc_node() returns page-aligned addresses which do conform with the
> restriction on PEBS buffer as documented by Intel in Vol3a section 16.9.4.2.
>
> Signed-off-by: Stephane Eranian <eranian@google.com>
> --
For now I think you can not do this. vmalloc'ed memory can't be safely
accessed from NMIs in x86 because that might fault. And faults from NMIs
are not supported. They cause very bad things: return from fault calls
iret which reenables NMI, so NMI can nest but in the meantime there is
only one NMI stack, so that gets quickly messed up.
next prev parent reply other threads:[~2010-09-13 15:09 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-13 14:55 [PATCH] perf_events: improve DS/BTS/PEBS buffer allocation Stephane Eranian
2010-09-13 15:08 ` Peter Zijlstra
2010-09-13 15:21 ` Stephane Eranian
2010-09-13 15:09 ` Frederic Weisbecker [this message]
2010-09-13 15:13 ` Stephane Eranian
2010-09-13 15:16 ` Peter Zijlstra
2010-09-13 15:20 ` Stephane Eranian
2010-09-13 15:24 ` Peter Zijlstra
2010-09-13 15:31 ` Stephane Eranian
2010-09-13 15:41 ` Peter Zijlstra
2010-09-13 15:51 ` Frederic Weisbecker
2010-09-13 15:55 ` Stephane Eranian
2010-09-13 17:35 ` Peter Zijlstra
2010-09-13 18:40 ` Stephane Eranian
2010-09-13 18:42 ` Peter Zijlstra
2010-09-13 18:49 ` Stephane Eranian
2010-09-13 18:57 ` Peter Zijlstra
2010-09-13 19:12 ` Stephane Eranian
2010-09-13 19:31 ` Mathieu Desnoyers
2010-09-13 19:34 ` Peter Zijlstra
2010-09-13 19:35 ` Peter Zijlstra
2010-09-13 19:42 ` Mathieu Desnoyers
2010-09-13 17:24 ` Stephane Eranian
2010-09-13 17:36 ` Peter Zijlstra
2010-09-13 19:35 ` Andi Kleen
2010-09-13 19:49 ` Peter Zijlstra
2010-09-13 20:51 ` Andi Kleen
2010-09-13 20:57 ` [perfmon2] " Luck, Tony
2010-09-13 20:34 ` H. Peter Anvin
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=20100913150914.GA6155@nowhere \
--to=fweisbec@gmail.com \
--cc=davem@davemloft.net \
--cc=eranian@gmail.com \
--cc=eranian@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=markus.t.metzger@intel.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=perfmon2-devel@lists.sf.net \
--cc=peterz@infradead.org \
--cc=robert.richter@amd.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