All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Don Zickus <dzickus@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	jason.wessel@windriver.com, gorcunov@gmail.com,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86, perf, nmi:  Disable perf if counters are not accessable
Date: Tue, 23 Nov 2010 11:46:06 +0100	[thread overview]
Message-ID: <1290509166.2072.384.camel@laptop> (raw)
In-Reply-To: <1290462923-30734-1-git-send-email-dzickus@redhat.com>

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!

  reply	other threads:[~2010-11-23 10:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-22 21:55 [PATCH] x86, perf, nmi: Disable perf if counters are not accessable Don Zickus
2010-11-23 10:46 ` Peter Zijlstra [this message]
2010-11-23 14:13   ` Don Zickus
2010-11-26 15:01 ` [tip:perf/core] x86, perf, nmi: Disable perf if counters are not accessible tip-bot for Don Zickus
  -- strict thread matches above, loose matches on Subject: below --
2010-11-23 15:15 [PATCH] x86, perf, nmi: Disable perf if counters are not accessable Sedat Dilek
2010-11-23 15:19 ` Peter Zijlstra
2010-11-23 16:56 ` Don Zickus
2010-11-23 18:21   ` Sedat Dilek
2010-11-23 18:27     ` Peter Zijlstra
2010-11-23 18:29       ` Sedat Dilek
2010-11-23 18:37         ` Sedat Dilek
2010-11-23 19:04       ` Cyrill Gorcunov
2010-11-23 19:07         ` Peter Zijlstra
2010-11-23 19:18 Cyrill Gorcunov

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=1290509166.2072.384.camel@laptop \
    --to=peterz@infradead.org \
    --cc=dzickus@redhat.com \
    --cc=gorcunov@gmail.com \
    --cc=jason.wessel@windriver.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.