lkml.org 
[lkml]   [2010]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] x86, perf, nmi: Disable perf if counters are not accessable
From
Date
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,

Thanks Don!


\
 
 \ /
  Last update: 2010-11-23 11:49    [W:0.043 / U:1.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site