Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753945AbZFYKjb (ORCPT ); Thu, 25 Jun 2009 06:39:31 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750775AbZFYKjW (ORCPT ); Thu, 25 Jun 2009 06:39:22 -0400 Received: from mail-bw0-f213.google.com ([209.85.218.213]:39357 "EHLO mail-bw0-f213.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750731AbZFYKjW convert rfc822-to-8bit (ORCPT ); Thu, 25 Jun 2009 06:39:22 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:content-transfer-encoding; b=vu6bEsK1ap+Xv7XCxr2cBkNBYbweMEYD1RdmR1rSJzs0QkSegUbCwzdSyyAnyhwv7a Q+bC0Lz0214ejIjwCjAPVT1jyD3OSKn5i+cks8709mQGJKujKZmWBqPbnS4iJtWu/pBc QFs+jUdYqK1t7kqe7Sk7CZsrVnqnhjFAbnU4U= MIME-Version: 1.0 Reply-To: eranian@gmail.com In-Reply-To: <20090624085222.GC18713@elte.hu> References: <7c86c4470906221326j6edbf9f3g5d65e96d86aaf7ab@mail.gmail.com> <9F0C1DB20AFA954FA1DA05309350433D7B2584D1@pdsmsx503.ccr.corp.intel.com> <7c86c4470906230045k578bc146wa0e09e4094d937a5@mail.gmail.com> <20090623075959.GA23534@ywang-moblin2.bj.intel.com> <7c86c4470906230127g4f574b61p24f109c7a94c6e39@mail.gmail.com> <7c86c4470906230140p35ce043fw24e0c20651568f31@mail.gmail.com> <20090623085321.GC23534@ywang-moblin2.bj.intel.com> <20090623094717.GA30634@elte.hu> <20090624021944.GA2808@ywang-moblin2.bj.intel.com> <20090624085222.GC18713@elte.hu> Date: Thu, 25 Jun 2009 12:39:23 +0200 Message-ID: <7c86c4470906250339k4a168611vfe206c599d098489@mail.gmail.com> Subject: Re: perf_counter Atom patch From: stephane eranian To: Ingo Molnar Cc: Yong Wang , "Wang, Yong Y" , Peter Zijlstra , LKML , Paul Mackerras , Andi Kleen Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3018 Lines: 72 On Wed, Jun 24, 2009 at 10:52 AM, Ingo Molnar wrote: > > * Yong Wang wrote: > >> On Tue, Jun 23, 2009 at 11:47:17AM +0200, Ingo Molnar wrote: >> > >> > * Yong Wang wrote: >> > >> > > On Tue, Jun 23, 2009 at 10:40:45AM +0200, stephane eranian wrote: >> > > > Yong, >> > > > >> > > > On Tue, Jun 23, 2009 at 10:27 AM, stephane >> > > > eranian wrote: >> > > > > Hi, >> > > > > >> > > > > On Tue, Jun 23, 2009 at 9:59 AM, Yong Wang wrote: >> > > > >> On Tue, Jun 23, 2009 at 09:45:03AM +0200, stephane eranian wrote: >> > > > >>> >> > > > >>> Unfortunately, I don't have a N270 to compare with your results. >> > > > >>> We need to verify whether or not N270 implements the fixed counters. >> > > > >>> Does it report architected perfmon v3 or v1? >> > > > >>> >> > > > >> >> > > > >> All Atom processors report perfmon v3 as specified in SDM. N270 is no >> > > > >> exception. >> > > > >> >> > > > > V3 does not set a minimal number of fixed counters, could be zero. But >> > > > > that seems >> > > > > odd. Let me ask around. >> > > > > >> > > > Second thought on this: >> > > >        x86_pmu.num_counters_fixed      = >> > > > max((int)edx.split.num_counters_fixed, 3); >> > > > >> > > >         rdmsrl(MSR_CORE_PERF_GLOBAL_CTRL, x86_pmu.intel_ctrl); >> > > > >> > > > >> > > > Forcing num_counter_fixed is not enough, you need to make sure >> > > > they are actually activated in GLOBAL_CTRL, i.e., make sure bits >> > > > 32-34 are set in intel_ctrl. Depending on which machine you're >> > > > on, the power on value for GLOBAL_CTRL changes. The correct >> > > > value for it should be that ONLY generic counters are on by >> > > > default. >> > > > >> > > >> > > Oh, this might be why fixed counter do not work on my Atom box. I >> > > will look into it. [...] >> > >> > Thanks - having a different bootup default for the global ctrl >> > indeed sounds like a good and plausible explanation - please send a >> > patch for that if you've tested it, removing that quirk and adding >> > the global-enable ctrl logic. >> > >> >> The root cause of fixed counters not working on Atom is indeed >> related to global counter control MSR. The power-on value on Atom >> is 0x3 which means only general purpose counters are enabled by >> default. The power-on value on Core2 is 0xffffffffffffffff which I >> believe is also the case for Nehalem. That's why Core2 and Nehalem >> do not have the problem. > > I suspect it can also be firmware/BIOS and microcode version > dependent - it's better to not rely on bootup state like that > indeed. I would recommend you ignore boot up values and setup GLOBAL_CTRL* the way you need. So I agree. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/