[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101122142212.GS18100@redhat.com>
Date: Mon, 22 Nov 2010 09:22:12 -0500
From: Don Zickus <dzickus@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Jason Wessel <jason.wessel@...driver.com>,
Ingo Molnar <mingo@...e.hu>,
Robert Richter <robert.richter@....com>, ying.huang@...el.com,
Andi Kleen <andi@...stfloor.org>,
LKML <linux-kernel@...r.kernel.org>,
Frederic Weisbecker <fweisbec@...il.com>
Subject: Re: [V2 PATCH 0/6] x86, NMI: give NMI handler a face-lift
On Sat, Nov 20, 2010 at 12:09:39AM +0100, Peter Zijlstra wrote:
> On Fri, 2010-11-19 at 17:59 -0500, Don Zickus wrote:
> > +++ b/arch/x86/kernel/cpu/perf_event.c
> > @@ -381,6 +381,19 @@ static void release_pmc_hardware(void) {}
> >
> > #endif
> >
> > +static bool check_hw_exists(void)
> > +{
> > + u64 val, val_new;
> > +
> > + val = 0xabcdUL;
> > + (void) checking_wrmsrl(x86_pmu.perfctr, val);
> > + rdmsrl(x86_pmu.perfctr, val_new);
>
>
> Yeah, this looks about right, although for extreme prudence I'd also use
> a checking_rdmsrl().
I didn't realize such a function existed, I'll look into it.
>
>
> > + if (val != val_new)
> > + return false;
> > +
> > + return true;
> > +}
> > +
> > static void reserve_ds_buffers(void);
> > static void release_ds_buffers(void);
> >
> > @@ -1371,6 +1385,12 @@ void __init init_hw_perf_events(void)
> >
> > pmu_check_apic();
> >
> > + /* sanity check that the hardware exists or is emulated */
> > + if (!check_hw_exists()) {
> > + pr_cont("no PMU driver, software events only.\n");
> > + return;
> > + }
>
> Maybe report something like this:
> "Broken PMU hardware detected, software events only."
>
> Because this is really not something that's supposed to happen.
Ok. Thanks. I'll respin a cleaner patch today.
Thanks,
Don
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists