[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101123141305.GA17346@redhat.com>
Date: Tue, 23 Nov 2010 09:13:05 -0500
From: Don Zickus <dzickus@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Ingo Molnar <mingo@...e.hu>, jason.wessel@...driver.com,
gorcunov@...il.com, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] x86, perf, nmi: Disable perf if counters are not
accessable
On Tue, Nov 23, 2010 at 11:46:06AM +0100, Peter Zijlstra wrote:
> On Mon, 2010-11-22 at 16:55 -0500, Don Zickus wrote:
> > +static bool check_hw_exists(void)
> > +{
> > + u64 val, val_new;
> > +
> > + val = 0xabcdUL;
> > + (void) checking_wrmsrl(x86_pmu.perfctr, val);
> > + rdmsrl_safe(x86_pmu.perfctr, &val_new);
> > + if (val != val_new)
> > + return false;
> > +
> > + return true;
> > +}
>
> If I can make any sense of the implementation of native_read_msr_safe()
> then I think it doesn't actually sets val_new in case it faults, it just
> returns -EIO.
>
> So I changed it to:
>
> static bool check_hw_exists(void)
> {
> u64 val, val_new = 0;
> int ret = 0;
>
> val = 0xabcdUL;
> ret |= checking_wrmsrl(x86_pmu.perfctr, val);
> ret |= rdmsrl_safe(x86_pmu.perfctr, &val_new);
> if (ret || val != val_new)
> return false;
>
> return true;
> }
>
> And have applied the patch,
Looks good to me. Thanks!
Cheers,
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