From: Robert Richter <robert.richter@amd.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: Maarten Lankhorst <m.b.lankhorst@gmail.com>,
Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Thomas Gleixner <tglx@linutronix.de>,
"x86@kernel.org" <x86@kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3] oprofile, x86: Convert memory allocation to static array
Date: Tue, 2 Aug 2011 00:16:25 +0200 [thread overview]
Message-ID: <20110801221625.GF11795@erda.amd.com> (raw)
In-Reply-To: <20110801214130.GF27083@one.firstfloor.org>
On 01.08.11 17:41:30, Andi Kleen wrote:
> On Mon, Aug 01, 2011 at 11:31:42PM +0200, Robert Richter wrote:
> > On 01.08.11 11:08:59, Maarten Lankhorst wrote:
> > > On -rt, allocators don't work from atomic context any more,
> > > and the maximum size of the array is known at compile time.
> > >
> > > Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
> >
> > Applied to oprofile/core. Thanks, Maarten.
>
> And what happens when the CPU reports more than 32 counters?
> You have a silent buffer overflow then.
>From the layout of IA32_PERF_GLOBAL_CTRL MSR it seems to be limited to
32. Anyway, if there might be cpus out soon with more than 32 counters
we can either extend the array to 256 or limit the counters used to 32.
> Besides I bet there are other cases like this all over the tree.
>
> And the whole thing is tasteless.
>
> Nacked-by: Andi Kleen <ak@linux.intel.com>
This dynamic allocation is causing trouble from the beginning. Using a
static array removes a lot of NULL pointer checks:
arch/x86/oprofile/op_model_ppro.c | 24 +-----------------------
The previous implementation silently dropped counters during setup on
failure. Also we have had many bugs caused by this dynamic allocation
(I counted 3 fixes). This all isn't it worth and you did not yet
explain the concerns you have (besides the potentially buffer overflow
which is fixable and probably of academic nature).
-Robert
--
Advanced Micro Devices, Inc.
Operating System Research Center
next prev parent reply other threads:[~2011-08-01 22:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-31 18:39 [PATCH v2] oprofile, x86: Move memory allocation for ppro out of per cpu Maarten Lankhorst
2011-08-01 7:07 ` Robert Richter
2011-08-01 12:37 ` Peter Zijlstra
2011-08-01 14:57 ` Maarten Lankhorst
2011-08-01 15:08 ` [PATCH v3] oprofile, x86: Convert memory allocation to static array Maarten Lankhorst
2011-08-01 16:20 ` Andi Kleen
2011-08-01 21:31 ` Robert Richter
2011-08-01 21:41 ` Andi Kleen
2011-08-01 22:16 ` Robert Richter [this message]
2011-08-16 22:11 ` [PATCH] oprofile, x86: Fix overflow and warning (commit 1d12d35) Robert Richter
2011-08-01 22:02 ` [PATCH v3] oprofile, x86: Convert memory allocation to static array 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=20110801221625.GF11795@erda.amd.com \
--to=robert.richter@amd.com \
--cc=a.p.zijlstra@chello.nl \
--cc=andi@firstfloor.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m.b.lankhorst@gmail.com \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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