linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vince Weaver <vincent.weaver@maine.edu>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Vince Weaver <vincent.weaver@maine.edu>,
	Dave Jones <davej@redhat.com>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@redhat.com>, Paul Mackerras <paulus@samba.org>
Subject: Re: x86_pmu_start WARN_ON.
Date: Wed, 12 Feb 2014 16:04:30 -0500 (EST)	[thread overview]
Message-ID: <alpine.DEB.2.10.1402121559350.20738@vincent-weaver-1.um.maine.edu> (raw)
In-Reply-To: <20140211132956.GY9987@twins.programming.kicks-ass.net>

On Tue, 11 Feb 2014, Peter Zijlstra wrote:
> 
> I'll see if I can run through the reproduction case by hand.

I've come up with an even simpler test case with all of the extraneous 
settings removed.  Included below.

It is triggered in this case when you have:

  An event group of breakpoint, cycles, branches
  An event of instructions with precise=1
  A tracepoint

and then you close the tracepoint.

---


/* log_to_code output from ./warning29.log */
/* by Vince Weaver <vincent.weaver _at_ maine.edu */

#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <sys/syscall.h>
#include <linux/hw_breakpoint.h>
#include <linux/perf_event.h>

static int fd[1024];
static struct perf_event_attr pe[1024];

int perf_event_open(struct perf_event_attr *hw_event_uptr,
	pid_t pid, int cpu, int group_fd, unsigned long flags) {

	return syscall(__NR_perf_event_open,hw_event_uptr, pid, cpu,
		group_fd, flags);
}

int main(int argc, char **argv) {

/* Random Seed was 1392048997 */
/* /proc/sys/kernel/perf_event_max_sample_rate was 100000 */


	memset(&pe[3],0,sizeof(struct perf_event_attr));
	pe[3].type=PERF_TYPE_BREAKPOINT;
	pe[3].size=72;
	pe[3].bp_type=HW_BREAKPOINT_R|HW_BREAKPOINT_W; /*3*/
	pe[3].bp_len=0x8;

	fd[3]=perf_event_open(&pe[3],
				0, /* current thread */
				-1, /* all cpus */
				-1, /* group leader */
				0);

	memset(&pe[23],0,sizeof(struct perf_event_attr));
	pe[23].type=PERF_TYPE_HARDWARE;
	pe[23].config=PERF_COUNT_HW_INSTRUCTIONS;
	pe[23].precise_ip=1; /* this needs to be set to trigger? */

	fd[23]=perf_event_open(&pe[23],
				0, /* current thread */
				-1, /* all cpus */
				-1, /* group leader */
				0 /*0*/ );

	memset(&pe[4],0,sizeof(struct perf_event_attr));
	pe[4].type=PERF_TYPE_HARDWARE;
	pe[4].config=PERF_COUNT_HW_CPU_CYCLES;

	fd[4]=perf_event_open(&pe[4],
				0, /* current thread */
				-1, /* all cpus */
				fd[3], /* 3 is group leader */
				0 /*0*/ );


	memset(&pe[5],0,sizeof(struct perf_event_attr));
	pe[5].type=PERF_TYPE_TRACEPOINT;
	pe[5].config=0x1d;
				/* 29 irq_vectors/error_apic_entry */
				/* Config of tracepoint doesn't seem to matter */

	fd[5]=perf_event_open(&pe[5],
				0, /* current thread */
				-1, /* all cpus */
				-1, /* New Group Leader */
				0 /*0*/ );

	memset(&pe[15],0,sizeof(struct perf_event_attr));
	pe[15].type=PERF_TYPE_HARDWARE;
	pe[15].config=PERF_COUNT_HW_BRANCH_INSTRUCTIONS;

	fd[15]=perf_event_open(&pe[15],
				0, /* current thread */
				-1, /* all cpus */
				fd[3], /* 3 is group leader */
				0 /*0*/ );
	close(fd[5]);

	return 0;
}

  reply	other threads:[~2014-02-12 21:02 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-30 19:02 x86_pmu_start WARN_ON Dave Jones
2014-02-10 21:26 ` Vince Weaver
2014-02-11 13:29   ` Peter Zijlstra
2014-02-12 21:04     ` Vince Weaver [this message]
2014-02-13 14:11       ` Vince Weaver
2014-02-13 17:35         ` Vince Weaver
2014-02-13 22:13           ` Vince Weaver
2014-02-17 15:28             ` Peter Zijlstra
2014-02-18 18:30               ` Vince Weaver
2014-02-18 22:20                 ` Vince Weaver
2014-02-19 10:19                   ` Peter Zijlstra
2014-02-19 22:34                     ` Vince Weaver
2014-02-20 10:08                       ` Peter Zijlstra
2014-02-20 15:47                         ` Andi Kleen
2014-02-20 15:54                           ` Peter Zijlstra
2014-02-20 17:31                             ` Andi Kleen
2014-02-20 18:15                               ` Peter Zijlstra
2014-02-20 18:23                                 ` Andi Kleen
2014-02-20 19:04                                 ` Steven Rostedt
2014-02-20 16:26                         ` Steven Rostedt
2014-02-20 17:00                           ` Peter Zijlstra
2014-02-20 17:43                             ` Steven Rostedt
2014-02-20 17:46                               ` Steven Rostedt
2014-02-20 18:18                                 ` Peter Zijlstra
2014-02-20 18:03                         ` Vince Weaver
2014-02-20 18:23                           ` Peter Zijlstra
2014-02-20 18:54                             ` Vince Weaver
2014-02-20 19:21                               ` Vince Weaver
2014-02-20 19:46                                 ` Vince Weaver
2014-02-21 14:37                                   ` Vince Weaver
2014-02-21 15:03                             ` Peter Zijlstra
2014-02-21 20:18                               ` Vince Weaver
2014-02-24 11:28                                 ` Peter Zijlstra
2014-02-26  5:59                                   ` Vince Weaver
2014-02-27 13:32                               ` [tip:perf/core] perf/x86: Fix event scheduling tip-bot for Peter Zijlstra

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.10.1402121559350.20738@vincent-weaver-1.um.maine.edu \
    --to=vincent.weaver@maine.edu \
    --cc=davej@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.org \
    --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;
as well as URLs for NNTP newsgroup(s).