The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Stephane Eranian <eranian@google.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu, paulus@samba.org,
	davem@davemloft.net, fweisbec@gmail.com, robert.richter@amd.com,
	perfmon2-devel@lists.sf.net, eranian@gmail.com
Subject: Re: [PATCH] perf_events: fix bug in AMD per-cpu initialization
Date: Thu, 18 Mar 2010 01:33:15 +0100	[thread overview]
Message-ID: <bd4cb8901003171733k95fcf50mf6de78bf503d9a7b@mail.gmail.com> (raw)
In-Reply-To: <1268869631.9440.282.camel@laptop>

On Thu, Mar 18, 2010 at 12:47 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Wed, 2010-03-17 at 10:40 +0200, Stephane Eranian wrote:
>>       On AMD processors, we need to allocate a data structure per Northbridge
>>       to handle certain events.
>>
>>       On CPU initialization, we need to query the Northbridge id and check
>>       whether the structure is already allocated or not. We use the
>>       amd_get_nb_id() function to request the Northbridge identification.
>>
>>       The recent cleanup of the CPU online/offline initialization introduced
>>       a bug. AMD cpu initialization is invoked on CPU_UP_PREPARE callback.
>>       This is before the CPU Northbridge id is calculated. Therefore no
>>       processor had a Northbridge structure allocated except the boot
>>       processor. That was causing bogus NB event scheduling.
>>
>>       This patch uses the CPU_ONLINE callback to initialize the AMD
>>       Northbridge structure. This way amd_get_nb_id() returns valid
>>       information.
>>
>>       The x86_cpu_up() callback was added. Could not call it cpu_online
>>       because of existing macro.
>>
>>       Signed-off-by: Stephane Eranian <eranian@google.com>
>
>
> No, ONLINE is not exposed for a good reason, its always wrong.
>
> Use prepare to allocate data, and starting to initialize stuff on the
> cpu proper once its up. Online is after the cpu is up and running and we
> are already scheduling stuff on it so its too late to initialize things.
>
>
I can't because amd_get_nb_id() returns garbage for the CPU
when you call from CPU_STARTING. So looks like initialization
of cpu_llc_id needs to be moved way earlier. I don't want to have
to duplicate that code.

  reply	other threads:[~2010-03-18  0:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-17  8:40 [PATCH] perf_events: fix bug in AMD per-cpu initialization Stephane Eranian
2010-03-17 23:47 ` Peter Zijlstra
2010-03-18  0:33   ` Stephane Eranian [this message]
2010-03-23 14:11     ` Peter Zijlstra
2010-03-23 14:55       ` Stephane Eranian
2010-03-23 15:07         ` Peter Zijlstra
2010-03-23 15:12           ` Stephane Eranian
2010-03-23 15:18             ` Peter Zijlstra
2010-03-23 22:41               ` Stephane Eranian
2010-04-02 19:06       ` [tip:perf/core] x86: Move notify_cpu_starting() callback to a later stage tip-bot for Peter Zijlstra
2010-04-02 19:07       ` [tip:perf/core] perf, x86: Fix AMD hotplug & constraint initialization tip-bot for Peter Zijlstra
  -- strict thread matches above, loose matches on Subject: below --
2010-03-24 13:45 [PATCH] perf_events: fix bug in AMD per-cpu initialization Stephane Eranian

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=bd4cb8901003171733k95fcf50mf6de78bf503d9a7b@mail.gmail.com \
    --to=eranian@google.com \
    --cc=davem@davemloft.net \
    --cc=eranian@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --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