mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vince Weaver <vincent.weaver@maine.edu>
To: linux-kernel@vger.kernel.org
Cc: luto@amacapital.net, Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>
Subject: perf: race with automatic rdpmc() disabling
Date: Mon, 13 Mar 2017 09:58:00 -0400 (EDT)	[thread overview]
Message-ID: <alpine.DEB.2.20.1703130945120.12942@macbook-air> (raw)

Hello

I've been trying to track this issue down for a few days and haven't been 
able to isolate it.  So maybe someone who understands low-level perf mmap
reference counting can help here.

As you might recall, 7911d3f7af14a614617e38245fedf98a724e46a9
introduced automatic disabling of userspace rdpmc when no perf_events 
were running.

I've run into a problem with PAPI when using rdpmc.  If you have PAPI
measuring events in multiple pthread threads, sometimes (but not always)
the program will GPF because CR4/rdpmc gets turned off while events are 
still active.

I've been trying to put together a reproducible test case but haven't been 
able to manage.  I have a PAPI test that will show the problem about 
50% of the time but I can't seem to isolate the problem.

Any ideas?

If you really want to try to reproduce it, get the current git version of 
PAPI
	git clone https://bitbucket.org/icl/papi.git
edit src/components/perf_event/perf_event.c 
	so that #define PERF_USE_RDPMC 1
in src run ./configure , make
then run the ./ctests/zero_pthreads test a few times.  It will GPF and I'm
relatively (though not entirely) sure it's not a PAPI issue.  
The problem does go away if you set /sys/devices/cpu/rdpmc to 2

Vince

             reply	other threads:[~2017-03-13 13:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-13 13:58 Vince Weaver [this message]
2017-03-13 16:44 ` Andy Lutomirski
2017-03-13 16:55   ` Peter Zijlstra
2017-03-13 21:05     ` Andy Lutomirski
2017-03-14 15:58       ` Andy Lutomirski
2017-03-14 16:45         ` Vince Weaver
2017-03-15 20:16           ` Andy Lutomirski
2017-03-16  5:35             ` Vince Weaver

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=alpine.DEB.2.20.1703130945120.12942@macbook-air \
    --to=vincent.weaver@maine.edu \
    --cc=acme@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®