Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 61929785 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'perf-fixes-for-linus' of...

Merge branch 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (30 commits)
  trace, filters: Initialize the match variable in process_ops() properly
  trace, documentation: Fix branch profiling location in debugfs
  oprofile, s390: Cleanups
  oprofile, s390: Remove hwsampler_files.c and merge it into init.c
  perf: Fix tear-down of inherited group events
  perf: Reorder & optimize perf_event_context to remove alignment padding on 64 bit builds
  perf: Handle stopped state with tracepoints
  perf: Fix the software events state check
  perf, powerpc: Handle events that raise an exception without overflowing
  perf, x86: Use INTEL_*_CONSTRAINT() for all PEBS event constraints
  perf, x86: Clean up SandyBridge PEBS events
  perf lock: Fix sorting by wait_min
  perf tools: Version incorrect with some versions of grep
  perf evlist: New command to list the names of events present in a perf.data file
  perf script: Add support for H/W and S/W events
  perf script: Add support for dumping symbols
  perf script: Support custom field selection for output
  perf script: Move printing of 'common' data from print_event and rename
  perf tracing: Remove print_graph_cpu and print_graph_proc from trace-event-parse
  perf script: Change process_event prototype
  ...
parents e16b396c 1ef1d1c2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -892,6 +892,7 @@
#define PV_970		0x0039
#define PV_POWER5	0x003A
#define PV_POWER5p	0x003B
#define PV_POWER7	0x003F
#define PV_970FX	0x003C
#define PV_630		0x0040
#define PV_630p	0x0041
+23 −1
Original line number Diff line number Diff line
@@ -1269,6 +1269,28 @@ unsigned long perf_instruction_pointer(struct pt_regs *regs)
	return ip;
}

static bool pmc_overflow(unsigned long val)
{
	if ((int)val < 0)
		return true;

	/*
	 * Events on POWER7 can roll back if a speculative event doesn't
	 * eventually complete. Unfortunately in some rare cases they will
	 * raise a performance monitor exception. We need to catch this to
	 * ensure we reset the PMC. In all cases the PMC will be 256 or less
	 * cycles from overflow.
	 *
	 * We only do this if the first pass fails to find any overflowing
	 * PMCs because a user might set a period of less than 256 and we
	 * don't want to mistakenly reset them.
	 */
	if (__is_processor(PV_POWER7) && ((0x80000000 - val) <= 256))
		return true;

	return false;
}

/*
 * Performance monitor interrupt stuff
 */
@@ -1316,7 +1338,7 @@ static void perf_event_interrupt(struct pt_regs *regs)
			if (is_limited_pmc(i + 1))
				continue;
			val = read_pmc(i + 1);
			if ((int)val < 0)
			if (pmc_overflow(val))
				write_pmc(i + 1, 0);
		}
	}
+1 −1
Original line number Diff line number Diff line
@@ -6,4 +6,4 @@ DRIVER_OBJS = $(addprefix ../../../drivers/oprofile/, \
		oprofilefs.o oprofile_stats.o  \
		timer_int.o )

oprofile-y				:= $(DRIVER_OBJS) init.o backtrace.o
oprofile-y :=	$(DRIVER_OBJS) init.o backtrace.o hwsampler.o
+1256 −0

File added.

Preview size limit exceeded, changes collapsed.

+113 −0
Original line number Diff line number Diff line
/*
 * CPUMF HW sampler functions and internal structures
 *
 *    Copyright IBM Corp. 2010
 *    Author(s): Heinz Graalfs <graalfs@de.ibm.com>
 */

#ifndef HWSAMPLER_H_
#define HWSAMPLER_H_

#include <linux/workqueue.h>

struct hws_qsi_info_block          /* QUERY SAMPLING information block  */
{ /* Bit(s) */
	unsigned int b0_13:14;      /* 0-13: zeros                       */
	unsigned int as:1;          /* 14: sampling authorisation control*/
	unsigned int b15_21:7;      /* 15-21: zeros                      */
	unsigned int es:1;          /* 22: sampling enable control       */
	unsigned int b23_29:7;      /* 23-29: zeros                      */
	unsigned int cs:1;          /* 30: sampling activation control   */
	unsigned int:1;             /* 31: reserved                      */
	unsigned int bsdes:16;      /* 4-5: size of sampling entry       */
	unsigned int:16;            /* 6-7: reserved                     */
	unsigned long min_sampl_rate; /* 8-15: minimum sampling interval */
	unsigned long max_sampl_rate; /* 16-23: maximum sampling interval*/
	unsigned long tear;         /* 24-31: TEAR contents              */
	unsigned long dear;         /* 32-39: DEAR contents              */
	unsigned int rsvrd0;        /* 40-43: reserved                   */
	unsigned int cpu_speed;     /* 44-47: CPU speed                  */
	unsigned long long rsvrd1;  /* 48-55: reserved                   */
	unsigned long long rsvrd2;  /* 56-63: reserved                   */
};

struct hws_ssctl_request_block     /* SET SAMPLING CONTROLS req block   */
{ /* bytes 0 - 7  Bit(s) */
	unsigned int s:1;           /* 0: maximum buffer indicator       */
	unsigned int h:1;           /* 1: part. level reserved for VM use*/
	unsigned long b2_53:52;     /* 2-53: zeros                       */
	unsigned int es:1;          /* 54: sampling enable control       */
	unsigned int b55_61:7;      /* 55-61: - zeros                    */
	unsigned int cs:1;          /* 62: sampling activation control   */
	unsigned int b63:1;         /* 63: zero                          */
	unsigned long interval;     /* 8-15: sampling interval           */
	unsigned long tear;         /* 16-23: TEAR contents              */
	unsigned long dear;         /* 24-31: DEAR contents              */
	/* 32-63:                                                        */
	unsigned long rsvrd1;       /* reserved                          */
	unsigned long rsvrd2;       /* reserved                          */
	unsigned long rsvrd3;       /* reserved                          */
	unsigned long rsvrd4;       /* reserved                          */
};

struct hws_cpu_buffer {
	unsigned long first_sdbt;       /* @ of 1st SDB-Table for this CP*/
	unsigned long worker_entry;
	unsigned long sample_overflow;  /* taken from SDB ...            */
	struct hws_qsi_info_block qsi;
	struct hws_ssctl_request_block ssctl;
	struct work_struct worker;
	atomic_t ext_params;
	unsigned long req_alert;
	unsigned long loss_of_sample_data;
	unsigned long invalid_entry_address;
	unsigned long incorrect_sdbt_entry;
	unsigned long sample_auth_change_alert;
	unsigned int finish:1;
	unsigned int oom:1;
	unsigned int stop_mode:1;
};

struct hws_data_entry {
	unsigned int def:16;        /* 0-15  Data Entry Format           */
	unsigned int R:4;           /* 16-19 reserved                    */
	unsigned int U:4;           /* 20-23 Number of unique instruct.  */
	unsigned int z:2;           /* zeros                             */
	unsigned int T:1;           /* 26 PSW DAT mode                   */
	unsigned int W:1;           /* 27 PSW wait state                 */
	unsigned int P:1;           /* 28 PSW Problem state              */
	unsigned int AS:2;          /* 29-30 PSW address-space control   */
	unsigned int I:1;           /* 31 entry valid or invalid         */
	unsigned int:16;
	unsigned int prim_asn:16;   /* primary ASN                       */
	unsigned long long ia;      /* Instruction Address               */
	unsigned long long lpp;     /* Logical-Partition Program Param.  */
	unsigned long long vpp;     /* Virtual-Machine Program Param.    */
};

struct hws_trailer_entry {
	unsigned int f:1;           /* 0 - Block Full Indicator          */
	unsigned int a:1;           /* 1 - Alert request control         */
	unsigned long:62;           /* 2 - 63: Reserved                  */
	unsigned long overflow;     /* 64 - sample Overflow count        */
	unsigned long timestamp;    /* 16 - time-stamp                   */
	unsigned long timestamp1;   /*                                   */
	unsigned long reserved1;    /* 32 -Reserved                      */
	unsigned long reserved2;    /*                                   */
	unsigned long progusage1;   /* 48 - reserved for programming use */
	unsigned long progusage2;   /*                                   */
};

int hwsampler_setup(void);
int hwsampler_shutdown(void);
int hwsampler_allocate(unsigned long sdbt, unsigned long sdb);
int hwsampler_deallocate(void);
long hwsampler_query_min_interval(void);
long hwsampler_query_max_interval(void);
int hwsampler_start_all(unsigned long interval);
int hwsampler_stop_all(void);
int hwsampler_deactivate(unsigned int cpu);
int hwsampler_activate(unsigned int cpu);
unsigned long hwsampler_get_sample_overflow_count(unsigned int cpu);

#endif /*HWSAMPLER_H_*/
Loading