Re: [PATCH] mm, soft offline: split thp at the beginning of soft_offline_page()

2012-11-27 Thread Andi Kleen
Naoya Horiguchi writes: > When we try to soft-offline a thp tail page, put_page() is called on the > tail page unthinkingly and VM_BUG_ON is triggered in put_compound_page(). > This patch splits thp before going into the main body of soft-offlining. Looks good. > > The interface of soft-offlini

Re: [PATCH v3 04/19] perf, core: Add a concept of a weightened sample

2012-11-28 Thread Andi Kleen
> > @@ -198,8 +200,9 @@ enum perf_event_read_format { > > PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1, > > PERF_FORMAT_ID = 1U << 2, > > PERF_FORMAT_GROUP = 1U << 3, > > + PERF_FORMAT_WEIGHT = 1U << 4, > > what

Re: [PATCH 31/32] perf, tools: Default to cpu// for events v3

2012-11-28 Thread Andi Kleen
> > +static void str_append(char **s, int *len, const char *a) > > +{ > > + int olen = *s ? strlen(*s) : 0; > > + int nlen = olen + strlen(a) + 1; > > + if (*len < nlen) { > > + *len = *len * 2; > > + if (*len < nlen) > > + *len = nlen; > > + *s

Re: [PATCH 25/32] tools, perf: Add a precise event qualifier

2012-11-28 Thread Andi Kleen
> Should we test for >3? > > * precise_ip: > * > * 0 - SAMPLE_IP can have arbitrary skid > * 1 - SAMPLE_IP must have constant skid > * 2 - SAMPLE_IP requested to have 0 skid > * 3 - SAMPLE_IP must have 0 skid > > Maybe it's not implemented in hw yet, but in

Re: [PATCH 22/25] Generic dynamic per cpu refcounting

2012-11-29 Thread Andi Kleen
Kent Overstreet writes: > This implements a refcount with similar semantics to > atomic_get()/atomic_dec_and_test(), that starts out as just an atomic_t > but dynamically switches to per cpu refcounting when the rate of > gets/puts becomes too high. This will only work if you put on the same CPU

Re: [PATCH 22/25] Generic dynamic per cpu refcounting

2012-11-29 Thread Andi Kleen
On Thu, Nov 29, 2012 at 10:57:20AM -0800, Kent Overstreet wrote: > On Thu, Nov 29, 2012 at 10:45:04AM -0800, Andi Kleen wrote: > > Kent Overstreet writes: > > > > > This implements a refcount with similar semantics to > > > atomic_get()/atomic_dec_and_test(), th

Re: [RFC, PATCH 00/19] Numa aware LRU lists and shrinkers

2012-11-29 Thread Andi Kleen
Dave Chinner writes: > > Comments, thoughts and flames all welcome. Doing the reclaim per CPU sounds like a big change in the VM balance. Doesn't this invalidate some zone reclaim mode settings? How did you validate all this? -Andi -- a...@linux.intel.com -- Speaking for myself only -- To uns

Re: vmalloc_sync_all(), 64bit kernel, patches 9c48f1c629ecfa114850c03f875c6691003214de, a79e53d85683c6dd9f99c90511028adc2043031f

2012-11-29 Thread Andi Kleen
Prasad Koya writes: > Hi > > Before going into crashkernel, nmi_shootdown_cpus() calls > register_die_notifier(), which calls vmalloc_sync_all(). I'm seeing > lockup in sync_global_pgds() (init_64.c). From 3.2 and up, > register_die_notifier() is replaced with register_nmi_handler() (patch > 9c48

Re: [PATCH 22/25] Generic dynamic per cpu refcounting

2012-11-29 Thread Andi Kleen
> The trick is that we don't watch for the refcount hitting 0 until we're > shutting down - so this only works if you keep track of your initial > refcount. As long as we're not shutting down, we know the refcount can't > hit 0 because we haven't released the initial refcount. This seems dangerous

Re: [PATCH 5/8] sched, numa, mm: Add adaptive NUMA affinity support

2012-11-29 Thread Andi Kleen
Peter Zijlstra writes: > + > + down_write(&mm->mmap_sem); > + for (vma = mm->mmap; vma; vma = vma->vm_next) { > + if (!vma_migratable(vma)) > + continue; > + change_protection(vma, vma->vm_start, vma->vm_e

Re: [PATCH] lib/raid6: Add AVX2 optimized recovery functions

2012-11-29 Thread Andi Kleen
Jim Kukunas writes: > + > + /* ymm0 = x0f[16] */ > + asm volatile("vpbroadcastb %0, %%ymm7" : : "m" (x0f)); > + > + while (bytes) { > +#ifdef CONFIG_X86_64 > + asm volatile("vmovdqa %0, %%ymm1" : : "m" (q[0])); > + asm volatile("vmovdqa %0, %%ymm9" : : "m" (q[32

Re: Binutils test suite freezes kernel

2012-11-29 Thread Andi Kleen
Joseph Parmelee writes: > Greetings: > > The gas test suite in recent binutils snapshots from > ftp://sourceware.org/pub/binutils/snapshots/ consistently freezes my i386 > custom-built kernels. This may be a kernel configuration problem but if so > it has manifested only recently. I have been b

Re: [PATCH 22/25] Generic dynamic per cpu refcounting

2012-11-29 Thread Andi Kleen
Kent Overstreet writes: > On Thu, Nov 29, 2012 at 02:34:52PM -0500, Benjamin LaHaise wrote: >> On Thu, Nov 29, 2012 at 11:29:25AM -0800, Kent Overstreet wrote: >> > There's some kind of symmetry going on here, and if I'd been awake more >> > in college I could probably say exactly why it works, b

Re: [PATCH 22/25] Generic dynamic per cpu refcounting

2012-11-29 Thread Andi Kleen
> > The regular atomic_t is limited in ways that you are not. > > See my original mail. > > I don't follow, can you explain? For most cases the reference count is tied to some object, which are naturally limited by memory size or other physical resources. But in the assymetric CPU case with your

Re: [PATCH] lib/raid6: Add AVX2 optimized recovery functions

2012-11-29 Thread Andi Kleen
> The code is compiled so that the xmm/ymm registers are not available to > the compiler. Do you have any known examples of asm volatiles being > reordered *with respect to each other*? My understandings of gcc is > that volatile operations are ordered with respect to each other (not > necessaril

Basic perf PMU support for Haswell v4

2013-02-04 Thread Andi Kleen
This is based on v7 of the full Haswell PMU support, but ported to the latest perf/core and stripped down to the extreme "perf for dummies" edition as requested. I removed some more patches, these will come later. I moved parts of an later patch (counter constraints for qualifiers) into an ear

[PATCH 3/5] perf, x86: Basic Haswell PEBS support v4

2013-02-04 Thread Andi Kleen
From: Andi Kleen Add basic PEBS support for Haswell. The constraints are similar to SandyBridge with a few new events. v2: Readd missing pebs_aliases v3: Readd missing hunk. Fix some constraints. v4: Fix typo in PEBS event table (Stephane Eranian) Reviewed-by: Stephane Eranian Signed-off-by

[PATCH 4/5] perf, x86: Support full width counting

2013-02-04 Thread Andi Kleen
From: Andi Kleen Recent Intel CPUs have a new alternative MSR range for perfctrs that allows writing the full counter width. Enable this range if the hardware reports it using a new capability bit. This lowers overhead of perf stat slightly because it has to do less interrupts to accumulate the

[PATCH 1/5] perf, x86: Add PEBSv2 record support v2

2013-02-04 Thread Andi Kleen
From: Andi Kleen Add support for the v2 PEBS format. It has a superset of the v1 PEBS fields, but has a longer record so we need to adjust the code paths. The main advantage is the new "EventingRip" support which directly gives the instruction, not off-by-one instruction. So with pr

[PATCH 2/5] perf, x86: Basic Haswell PMU support v4

2013-02-04 Thread Andi Kleen
From: Andi Kleen Add basic Haswell PMU support. Similar to SandyBridge, but has a few new events and two new counter bits. There are some new counter flags that need to be prevented from being set on fixed counters, and allowed to be set for generic counters. Also we add support for the

[PATCH 5/5] perf, x86: Move NMI clearing to end of PMI handler after the counter registers are reset

2013-02-04 Thread Andi Kleen
From: Andi Kleen This avoids some problems with spurious PMIs on Haswell. Haswell seems to behave more like P4 in this regard. Do the same thing as the P4 perf handler by unmasking the NMI only at the end. Shouldn't make any difference for earlier non P4 cores. Signed-off-by: Andi

Re: [PATCH 4/5] perf, x86: Support full width counting

2013-02-05 Thread Andi Kleen
On Tue, Feb 05, 2013 at 04:15:26PM +0100, Stephane Eranian wrote: > > --- a/arch/x86/kernel/cpu/perf_event_intel.c > > +++ b/arch/x86/kernel/cpu/perf_event_intel.c > > @@ -2228,5 +2228,11 @@ __init int intel_pmu_init(void) > > } > > } > > > > + /* Support full width co

Re: [PATCH 4/5] perf, x86: Support full width counting

2013-02-05 Thread Andi Kleen
v2: Print the feature at boot Signed-off-by: Andi Kleen diff --git a/arch/x86/include/uapi/asm/msr-index.h b/arch/x86/include/uapi/asm/msr-index.h index 433a59f..af41a77 100644 --- a/arch/x86/include/uapi/asm/msr-index.h +++ b/arch/x86/include/uapi/asm/msr-index.h @@ -163,6 +163,9 @

Basic perf PMU support for Haswell v5

2013-02-07 Thread Andi Kleen
This is based on v7 of the full Haswell PMU support, but ported to the latest perf/core and stripped down to the bare bones Only for very extremly basic usage. Most interesting new features are not in this patchkit (full version is git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc.git

[PATCH 5/5] perf, x86: Move NMI clearing to end of PMI handler after the counter registers are reset

2013-02-07 Thread Andi Kleen
From: Andi Kleen This avoids some problems with spurious PMIs on Haswell. Haswell seems to behave more like P4 in this regard. Do the same thing as the P4 perf handler by unmasking the NMI only at the end. Shouldn't make any difference for earlier non P4 cores. Signed-off-by: Andi

[PATCH 1/5] perf, x86: Add PEBSv2 record support v2

2013-02-07 Thread Andi Kleen
From: Andi Kleen Add support for the v2 PEBS format. It has a superset of the v1 PEBS fields, but has a longer record so we need to adjust the code paths. The main advantage is the new "EventingRip" support which directly gives the instruction, not off-by-one instruction. So with pr

[PATCH 3/5] perf, x86: Basic Haswell PEBS support v4

2013-02-07 Thread Andi Kleen
From: Andi Kleen Add basic PEBS support for Haswell. The constraints are similar to SandyBridge with a few new events. v2: Readd missing pebs_aliases v3: Readd missing hunk. Fix some constraints. v4: Fix typo in PEBS event table (Stephane Eranian) Reviewed-by: Stephane Eranian Signed-off-by

[PATCH 2/5] perf, x86: Basic Haswell PMU support v4

2013-02-07 Thread Andi Kleen
From: Andi Kleen Add basic Haswell PMU support. Similar to SandyBridge, but has a few new events and two new counter bits. There are some new counter flags that need to be prevented from being set on fixed counters, and allowed to be set for generic counters. Also we add support for the

[PATCH 4/5] perf, x86: Support full width counting v2

2013-02-07 Thread Andi Kleen
From: Andi Kleen Recent Intel CPUs like Haswell and IvyBridge have a new alternative MSR range for perfctrs that allows writing the full counter width. Enable this range if the hardware reports it using a new capability bit. This lowers the overhead of perf stat slightly because it has to do

[PATCH] Kbuild: Disable var tracking with CONFIG_DEBUG_INFO_REDUCED

2013-02-07 Thread Andi Kleen
From: Andi Kleen Newer gcc enables the var-tracking pass with -g to keep track which registers contain which variables. This is one of the slower passes in gcc. With reduced debug info (aimed at objdump -S, but not using a full debugger) we don't need this fine grained tracking. But i

Re: [PATCH][WIP] dio rewrite

2013-02-11 Thread Andi Kleen
On Mon, Feb 11, 2013 at 04:53:26PM -0800, Kent Overstreet wrote: > I finally started hacking on the dio code, and it's far from done but > it's turning out better than I expected so I thought I'd show off what > I've got so far. The critical metric for some of the highend workloads is the number

Re: [PATCH 5/5] perf, x86: Move NMI clearing to end of PMI handler after the counter registers are reset

2013-02-12 Thread Andi Kleen
On Tue, Feb 12, 2013 at 09:43:46AM +0100, Ingo Molnar wrote: > Was this stress-tested on all affected main CPU types, or only > on Haswell? I tested it on Haswell and Ivy Bridge. I can also try Westmere and a Saltwell(Atom), but for the majority of other family 6 systems I'll need to rely on the

Re: [PATCH 0/2] perf stat: add per-core count aggregation

2013-02-12 Thread Andi Kleen
On Tue, Feb 12, 2013 at 03:09:26PM +0100, Stephane Eranian wrote: > This patch series contains improvement to the aggregation support > in perf stat. > > First, the aggregation code is refactored and a aggr_mode enum > is defined. There is also an important bug fix for the existing > per-socket ag

Re: [PATCH 1/2] perf stat: refactor aggregation code

2013-02-12 Thread Andi Kleen
takes in printf are common. Better to duplicate the sprintf. The rest looks good to me. Reviewed-by: Andi Kleen -Andi -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

Re: [PATCH 0/2] perf stat: add per-core count aggregation

2013-02-12 Thread Andi Kleen
> > > The idea itself is useful. > > > Yes, it is. BTW it would be even more useful if it could print some of the statistics turbostat does (in particular frequency and C0 residency) Often you only care about cycles not idle, and the frequency tells you how fast the cycles happen. I think Cx cou

[PATCH 1/5] perf, x86: Add Haswell PEBS record support v3

2013-02-12 Thread Andi Kleen
From: Andi Kleen Add support for the Haswell extended (fmt2) PEBS format. It has a superset of the nhm (fmt1) PEBS fields, but has a longer record so we need to adjust the code paths. The main advantage is the new "EventingRip" support which directly gives the instruction, not

[PATCH 5/5] perf, x86: Move NMI clearing to end of PMI handler after the counter registers are reset

2013-02-12 Thread Andi Kleen
From: Andi Kleen This avoids some problems with spurious PMIs on Haswell. Haswell seems to behave more like P4 in this regard. Do the same thing as the P4 perf handler by unmasking the NMI only at the end. Shouldn't make any difference for earlier family 6 cores. Tested on Haswell, IvyB

Basic perf PMU support for Haswell v6

2013-02-12 Thread Andi Kleen
This is based on v7 of the full Haswell PMU support, but ported to the latest perf/core and stripped down to the bare bones Only for very extremly basic usage. Most interesting new features are not in this patchkit (full version is git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc.git

[PATCH 2/5] perf, x86: Basic Haswell PMU support v4

2013-02-12 Thread Andi Kleen
From: Andi Kleen Add basic Haswell PMU support. Similar to SandyBridge, but has a few new events and two new counter bits. There are some new counter flags that need to be prevented from being set on fixed counters, and allowed to be set for generic counters. Also we add support for the

[PATCH 4/5] perf, x86: Support full width counting v3

2013-02-12 Thread Andi Kleen
From: Andi Kleen Recent Intel CPUs like Haswell and IvyBridge have a new alternative MSR range for perfctrs that allows writing the full counter width. Enable this range if the hardware reports it using a new capability bit. This lowers the overhead of perf stat slightly because it has to do

[PATCH 3/5] perf, x86: Basic Haswell PEBS support v4

2013-02-12 Thread Andi Kleen
From: Andi Kleen Add basic PEBS support for Haswell. The constraints are similar to SandyBridge with a few new events. v2: Readd missing pebs_aliases v3: Readd missing hunk. Fix some constraints. v4: Fix typo in PEBS event table (Stephane Eranian) Reviewed-by: Stephane Eranian Signed-off-by

Re: [PATCH 05/12] perf, x86: Support Haswell v4 LBR format

2013-01-28 Thread Andi Kleen
> > - if (lbr_format == LBR_FORMAT_EIP_FLAGS) { > > + if (lbr_format == LBR_FORMAT_EIP_FLAGS || > > + lbr_format == LBR_FORMAT_EIP_FLAGS2) { > > mis = !!(from & LBR_FROM_FLAG_MISPRED); > > pred = !mis; > >

Re: [PATCH 07/12] perf, x86: Avoid checkpointed counters causing excessive TSX aborts v3

2013-01-28 Thread Andi Kleen
> I don't buy really this workaround. You are assuming you're always > measuring INTC_CHECKPOINTED > event by itself. There's no such assumption. > So what if you get into the handler because of an PMI > due to an overflow > of another counter which is active at the same time as counter2? > You'

Re: [PATCH 07/12] perf, x86: Avoid checkpointed counters causing excessive TSX aborts v3

2013-01-28 Thread Andi Kleen
On Tue, Jan 29, 2013 at 01:30:19AM +0100, Stephane Eranian wrote: > >> The counter is reinstated to its state before the critical section but > >> the PMI cannot be > >> cancelled and there is no state left behind to tell what to do with it. > > > > The PMI is effectively spurious, but we use it to

Re: [PATCH 07/12] perf, x86: Avoid checkpointed counters causing excessive TSX aborts v3

2013-01-30 Thread Andi Kleen
> That's a very low sampling rate, yet I think it would be rejected by your > code. You mean allowed? > But if I come in with frequency 0x7fff+1, then that's a very high > frequency, thus > small period, I would pass the test. So I think you need to reinforce the test > for freq=1. I'm awa

Re: Basic perf PMU support for Haswell v1

2013-01-31 Thread Andi Kleen
On Thu, Jan 31, 2013 at 06:19:01PM +0100, Stephane Eranian wrote: > Andi, > > Are you going to post a new version based on my feedback or do you stay > with what you posted on 1/25? I'm posting a new version today, already added all changes. -Andi -- To unsubscribe from this list: send the line

[PATCH 01/12] perf, x86: Add PEBSv2 record support

2013-01-31 Thread Andi Kleen
From: Andi Kleen Add support for the v2 PEBS format. It has a superset of the v1 PEBS fields, but has a longer record so we need to adjust the code paths. The main advantage is the new "EventingRip" support which directly gives the instruction, not off-by-one instruction. So with pr

[PATCH 04/12] perf, x86: Support the TSX intx/intx_cp qualifiers v3

2013-01-31 Thread Andi Kleen
From: Andi Kleen Implement the TSX transaction and checkpointed transaction qualifiers for Haswell. This allows e.g. to profile the number of cycles in transactions. The checkpointed qualifier requires forcing the event to counter 2, implement this with a custom constraint for Haswell. Also

[PATCH 06/12] perf, x86: Support full width counting

2013-01-31 Thread Andi Kleen
From: Andi Kleen Recent Intel CPUs have a new alternative MSR range for perfctrs that allows writing the full counter width. Enable this range if the hardware reports it using a new capability bit. This lowers overhead of perf stat slightly because it has to do less interrupts to accumulate the

Basic perf PMU support for Haswell v2

2013-01-31 Thread Andi Kleen
This is based on v7 of the full Haswell PMU support, but ported to the latest perf/core and stripped down to the "basic support" as requested. I consider all of this basic support for Haswell usage. although it's a bit more than what you need if you never use -e cpu// or -b options. I decided to

[PATCH 03/12] perf, x86: Basic Haswell PEBS support v4

2013-01-31 Thread Andi Kleen
From: Andi Kleen Add basic PEBS support for Haswell. The constraints are similar to SandyBridge with a few new events. v2: Readd missing pebs_aliases v3: Readd missing hunk. Fix some constraints. v4: Fix typo in PEBS event table (Stephane Eranian) Signed-off-by: Andi Kleen --- arch/x86/kernel

[PATCH 05/12] perf, x86: Support Haswell v4 LBR format

2013-01-31 Thread Andi Kleen
From: Andi Kleen Haswell has two additional LBR from flags for TSX: intx and abort, implemented as a new v4 version of the LBR format. Handle those in and adjust the sign extension code to still correctly extend. The flags are exported similarly in the LBR record to the existing misprediction

[PATCH 09/12] perf, x86: Disable LBR recording for unknown LBR_FMT

2013-01-31 Thread Andi Kleen
From: Andi Kleen When the LBR format is unknown disable LBR recording. This prevents crashes when the LBR address is misdecoded and mis-sign extended. Signed-off-by: Andi Kleen --- arch/x86/kernel/cpu/perf_event_intel_lbr.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff

[PATCH 12/12] perf, tools: Add abort_tx,no_tx,in_tx branch filter options to perf record -j v3

2013-01-31 Thread Andi Kleen
From: Andi Kleen Make perf record -j aware of the new in_tx,no_tx,abort_tx branch qualifiers. v2: ABORT -> ABORTTX v3: Add more _ Signed-off-by: Andi Kleen --- tools/perf/Documentation/perf-record.txt |3 +++ tools/perf/builtin-record.c |3 +++ 2 files changed

[PATCH 10/12] perf, x86: Support LBR filtering by INTX/NOTX/ABORT v3

2013-01-31 Thread Andi Kleen
From: Andi Kleen Add LBR filtering for branch in transaction, branch not in transaction or transaction abort. This is exposed as new sample types. v2: Rename ABORT to ABORTTX v3: Use table instead of if Signed-off-by: Andi Kleen --- arch/x86/kernel/cpu/perf_event_intel_lbr.c | 58

[PATCH 08/12] perf, x86: Move NMI clearing to end of PMI handler after the counter registers are reset

2013-01-31 Thread Andi Kleen
From: Andi Kleen This avoids some problems with spurious PMIs on Haswell. Haswell seems to behave more like P4 in this regard. Do the same thing as the P4 perf handler by unmasking the NMI only at the end. Shouldn't make any difference for earlier non P4 cores. Signed-off-by: Andi

[PATCH 02/12] perf, x86: Basic Haswell PMU support v3

2013-01-31 Thread Andi Kleen
From: Andi Kleen Add basic Haswell PMU support. Similar to SandyBridge, but has a few new events. Further differences are handled in followon patches. There are some new counter flags that need to be prevented from being set on fixed counters. Contains fixes from Stephane Eranian v2: Folded

[PATCH 07/12] perf, x86: Avoid checkpointed counters causing excessive TSX aborts v4

2013-01-31 Thread Andi Kleen
From: Andi Kleen With checkpointed counters there can be a situation where the counter is overflowing, aborts the transaction, is set back to a non overflowing checkpoint, causes interupt. The interrupt doesn't see the overflow because it has been checkpointed. This is then a spuriou

[PATCH 11/12] perf, tools: Support sorting by intx, abort branch flags v2

2013-01-31 Thread Andi Kleen
From: Andi Kleen Extend the perf branch sorting code to support sorting by intx or abort qualifiers. Also print out those qualifiers. This also fixes up some of the existing sort key documentation. We do not support notx here, because it's simply not showing the intx flag. v2: Readd fla

Re: [PATCH 04/12] perf, x86: Support the TSX intx/intx_cp qualifiers v3

2013-02-01 Thread Andi Kleen
> > As requested before, please keep those in a completely separate > series so that minimal support can be merged upstream. This is Hi Ingo, The goal is not to merge "minimal support" but full support. All of these features have users. But I subsetted it to make reviewing easier. I think the

Re: [PATCH 0/2] perf: add new uncore command

2013-02-01 Thread Andi Kleen
> And there's a patchset [1] from Jiri to support some kind of formula - > yeah, now I've written the correct spelling. :) - that might fit to this > purpose if you provide suitable formula file IMHO. So I guess we don't > need to have another command and can reuse perf stat, no? Yes with a prope

[PATCH 5/5] perf, x86: Move NMI clearing to end of PMI handler after the counter registers are reset

2013-02-01 Thread Andi Kleen
From: Andi Kleen This avoids some problems with spurious PMIs on Haswell. Haswell seems to behave more like P4 in this regard. Do the same thing as the P4 perf handler by unmasking the NMI only at the end. Shouldn't make any difference for earlier non P4 cores. Signed-off-by: Andi

Basic perf PMU support for Haswell v3

2013-02-01 Thread Andi Kleen
This is based on v7 of the full Haswell PMU support, but ported to the latest perf/core and stripped down to the extreme "perf for dummies" edition as requested. I removed some more patches, these will come soon later. I moved parts of an later patch (counter constraints for qualifiers) into a

[PATCH 2/5] perf, x86: Basic Haswell PMU support v4

2013-02-01 Thread Andi Kleen
From: Andi Kleen Add basic Haswell PMU support. Similar to SandyBridge, but has a few new events and two new counter bits. There are some new counter flags that need to be prevented from being set on fixed counters, and allowed to be set for generic counters. Also we add support for the

[PATCH 3/5] perf, x86: Basic Haswell PEBS support v4

2013-02-01 Thread Andi Kleen
From: Andi Kleen Add basic PEBS support for Haswell. The constraints are similar to SandyBridge with a few new events. v2: Readd missing pebs_aliases v3: Readd missing hunk. Fix some constraints. v4: Fix typo in PEBS event table (Stephane Eranian) Reviewed-by: Stephane Eranian Signed-off-by

[PATCH 4/5] perf, x86: Support full width counting

2013-02-01 Thread Andi Kleen
From: Andi Kleen Recent Intel CPUs have a new alternative MSR range for perfctrs that allows writing the full counter width. Enable this range if the hardware reports it using a new capability bit. This lowers overhead of perf stat slightly because it has to do less interrupts to accumulate the

[PATCH 1/5] perf, x86: Add PEBSv2 record support

2013-02-01 Thread Andi Kleen
From: Andi Kleen Add support for the v2 PEBS format. It has a superset of the v1 PEBS fields, but has a longer record so we need to adjust the code paths. The main advantage is the new "EventingRip" support which directly gives the instruction, not off-by-one instruction. So with pr

[PATCH 02/12] perf, x86: Basic Haswell PMU support v2

2013-01-25 Thread Andi Kleen
From: Andi Kleen Add basic Haswell PMU support. Similar to SandyBridge, but has a few new events. Further differences are handled in followon patches. There are some new counter flags that need to be prevented from being set on fixed counters. Contains fixes from Stephane Eranian v2: Folded

[PATCH 05/12] perf, x86: Support Haswell v4 LBR format

2013-01-25 Thread Andi Kleen
From: Andi Kleen Haswell has two additional LBR from flags for TSX: intx and abort, implemented as a new v4 version of the LBR format. Handle those in and adjust the sign extension code to still correctly extend. The flags are exported similarly in the LBR record to the existing misprediction

[PATCH 11/12] perf, tools: Support sorting by intx, abort branch flags v2

2013-01-25 Thread Andi Kleen
From: Andi Kleen Extend the perf branch sorting code to support sorting by intx or abort qualifiers. Also print out those qualifiers. This also fixes up some of the existing sort key documentation. We do not support notx here, because it's simply not showing the intx flag. v2: Readd fla

Basic perf PMU support for Haswell v1

2013-01-25 Thread Andi Kleen
This is based on v7 of the full Haswell PMU support, but ported to the latest perf/core and stripped down to the "basic support" as requested. I decided to include LBRs in the basic support. These are 4 patches self contained at the end, so could be also handled as a separate unit if that is pre

[PATCH 06/12] perf, x86: Support full width counting

2013-01-25 Thread Andi Kleen
From: Andi Kleen Recent Intel CPUs have a new alternative MSR range for perfctrs that allows writing the full counter width. Enable this range if the hardware reports it using a new capability bit. This lowers overhead of perf stat slightly because it has to do less interrupts to accumulate the

[PATCH 12/12] perf, tools: Add abort_tx,no_tx,in_tx branch filter options to perf record -j v3

2013-01-25 Thread Andi Kleen
From: Andi Kleen Make perf record -j aware of the new in_tx,no_tx,abort_tx branch qualifiers. v2: ABORT -> ABORTTX v3: Add more _ Signed-off-by: Andi Kleen --- tools/perf/Documentation/perf-record.txt |3 +++ tools/perf/builtin-record.c |3 +++ 2 files changed

[PATCH 08/12] perf, x86: Move NMI clearing to end of PMI handler after the counter registers are reset

2013-01-25 Thread Andi Kleen
From: Andi Kleen This avoids some problems with spurious PMIs on Haswell. Haswell seems to behave more like P4 in this regard. Do the same thing as the P4 perf handler by unmasking the NMI only at the end. Shouldn't make any difference for earlier non P4 cores. Signed-off-by: Andi

[PATCH 09/12] perf, x86: Disable LBR recording for unknown LBR_FMT

2013-01-25 Thread Andi Kleen
From: Andi Kleen When the LBR format is unknown disable LBR recording. This prevents crashes when the LBR address is misdecoded and mis-sign extended. Signed-off-by: Andi Kleen --- arch/x86/kernel/cpu/perf_event_intel_lbr.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff

[PATCH 07/12] perf, x86: Avoid checkpointed counters causing excessive TSX aborts v3

2013-01-25 Thread Andi Kleen
From: Andi Kleen With checkpointed counters there can be a situation where the counter is overflowing, aborts the transaction, is set back to a non overflowing checkpoint, causes interupt. The interrupt doesn't see the overflow because it has been checkpointed. This is then a spuriou

[PATCH 01/12] perf, x86: Add PEBSv2 record support

2013-01-25 Thread Andi Kleen
From: Andi Kleen Add support for the v2 PEBS format. It has a superset of the v1 PEBS fields, but has a longer record so we need to adjust the code paths. The main advantage is the new "EventingRip" support which directly gives the instruction, not off-by-one instruction. So with pr

[PATCH 03/12] perf, x86: Basic Haswell PEBS support v3

2013-01-25 Thread Andi Kleen
From: Andi Kleen Add basic PEBS support for Haswell. The constraints are similar to SandyBridge with a few new events. v2: Readd missing pebs_aliases v3: Readd missing hunk. Fix some constraints. Signed-off-by: Andi Kleen --- arch/x86/kernel/cpu/perf_event.h |2 ++ arch/x86

[PATCH 04/12] perf, x86: Support the TSX intx/intx_cp qualifiers v2

2013-01-25 Thread Andi Kleen
From: Andi Kleen Implement the TSX transaction and checkpointed transaction qualifiers for Haswell. This allows e.g. to profile the number of cycles in transactions. The checkpointed qualifier requires forcing the event to counter 2, implement this with a custom constraint for Haswell. Also

[PATCH 10/12] perf, x86: Support LBR filtering by INTX/NOTX/ABORT v2

2013-01-25 Thread Andi Kleen
From: Andi Kleen Add LBR filtering for branch in transaction, branch not in transaction or transaction abort. This is exposed as new sample types. v2: Rename ABORT to ABORTTX Signed-off-by: Andi Kleen --- arch/x86/kernel/cpu/perf_event_intel_lbr.c | 31 +-- include

[PATCH 04/18] perf, core: Add a concept of a weightened sample v2

2013-01-25 Thread Andi Kleen
From: Andi Kleen For some events it's useful to weight sample with a hardware provided number. This expresses how expensive the action the sample represent was. This allows the profiler to scale the samples to be more informative to the programmer. There is already the period which is

[PATCH 14/18] perf, x86: Add Haswell TSX event aliases v2

2013-01-25 Thread Andi Kleen
From: Andi Kleen Add infrastructure to generate event aliases in /sys/devices/cpu/events/ And use this to set up user friendly aliases for the common TSX events. TSX tuning relies heavily on the PMU, so it's important to be user friendly. This replaces the generic transaction events

[PATCH 11/18] tools, perf: Add a precise event qualifier v2

2013-01-25 Thread Andi Kleen
From: Andi Kleen Add a precise qualifier, like cpu/event=0x3c,precise=1/ This is needed so that the kernel can request enabling PEBS for TSX events. The parser bails out on any sysfs parse errors, so this is needed in any case to handle any event on the TSX perf kernel. v2: Allow 3 as value

[PATCH 16/18] perf, x86: Add a Haswell precise instructions event v2

2013-01-25 Thread Andi Kleen
From: Andi Kleen Add a instructions-p event alias that uses the PDIR randomized instruction retirement event. This is useful to avoid some systematic sampling shadow problems. Normally PEBS sampling has a systematic shadow. With PDIR enabled the hardware adds some randomization that

[PATCH 13/18] perf, x86: Support CPU specific sysfs events

2013-01-25 Thread Andi Kleen
From: Andi Kleen Add a way for the CPU initialization code to register additional events, and merge them into the events attribute directory. Used in the next patch. Signed-off-by: Andi Kleen --- arch/x86/kernel/cpu/perf_event.c | 29 + arch/x86/kernel/cpu

[PATCH 17/18] perf, tools: Default to cpu// for events v5

2013-01-25 Thread Andi Kleen
From: Andi Kleen When an event fails to parse and it's not in a new style format, try to parse it again as a cpu event. This allows to use sysfs exported events directly without //, so I can use perf record -e tx-aborts ... instead of perf record -e cpu/tx-aborts/ v2: Handle multiple e

[PATCH 06/18] perf, tools: Add support for weight v8

2013-01-25 Thread Andi Kleen
From: Andi Kleen perf record has a new option -W that enables weightened sampling. Add sorting support in top/report for the average weight per sample and the total weight sum. This allows to both compare relative cost per event and the total cost over the measurement period. Add the necessary

[PATCH 12/18] perf, x86: improve sysfs event mapping with event string

2013-01-25 Thread Andi Kleen
Make events_sysfs_show unstatic again to fix compilation] Signed-off-by: Stephane Eranian Signed-off-by: Andi Kleen --- arch/x86/kernel/cpu/perf_event.c | 28 +--- arch/x86/kernel/cpu/perf_event.h | 26 ++ 2 files changed, 39 insertions(+), 15 dele

[PATCH 10/18] perf, tools: Add browser support for transaction flags v6

2013-01-25 Thread Andi Kleen
From: Andi Kleen Add histogram support for the transaction flags. Each flags instance becomes a separate histogram. Support sorting and displaying the flags in report and top. The patch is fairly large, but it's really mostly just plumbing to pass the flags around. v2: Increase column

[PATCH 18/18] perf, tools: List kernel supplied event aliases in perf list v3

2013-01-25 Thread Andi Kleen
From: Andi Kleen List the kernel supplied pmu event aliases in perf list It's better when the users can actually see them. v2: Fix pattern matching v3: perf_pmu__alias -> perf_pmu_alias Signed-off-by: Andi Kleen --- tools/perf/Documentation/perf-list.txt |4 +- tools/perf/builti

[PATCH 01/18] perf, tools: Support sorting by intx, abort branch flags v2

2013-01-25 Thread Andi Kleen
From: Andi Kleen Extend the perf branch sorting code to support sorting by intx or abort qualifiers. Also print out those qualifiers. This also fixes up some of the existing sort key documentation. We do not support notx here, because it's simply not showing the intx flag. v2: Readd fla

[PATCH 08/18] perf, x86: Add Haswell specific transaction flag reporting

2013-01-25 Thread Andi Kleen
From: Andi Kleen In the PEBS handler report the transaction flags using the new generic transaction flags facility. Most of them come from the "tsx_tuning" field in PEBSv2, but the abort code is derived from the RAX register reported in the PEBS record. Signed-off-by: Andi Kleen ---

[PATCH 05/18] perf, x86: Support weight samples for PEBS

2013-01-25 Thread Andi Kleen
From: Andi Kleen When a weighted sample is requested, first try to report the TSX abort cost on Haswell. If that is not available report the memory latency. This allows profiling both by abort cost and by memory latencies. Memory latencies requires enabling a different PEBS mode (LL). When both

[PATCH 09/18] perf, tools: Add support for record transaction flags v3

2013-01-25 Thread Andi Kleen
From: Andi Kleen Add the glue in the user tools to record transaction flags with --transaction (-T was already taken) and dump them. Followon patches will use them. v2: Fix manpage v3: Move transaction to the end Signed-off-by: Andi Kleen --- tools/perf/Documentation/perf-record.txt |4

[PATCH 07/18] perf, core: Add generic transaction flags v3

2013-01-25 Thread Andi Kleen
From: Andi Kleen Add a generic qualifier for transaction events, as a new sample type that returns a flag word. This is particularly useful for qualifying aborts: to distinguish aborts which happen due to asynchronous events (like conflicts caused by another CPU) versus instructions that lead to

[PATCH 03/18] perf, x86: Support PERF_SAMPLE_ADDR on Haswell

2013-01-25 Thread Andi Kleen
From: Andi Kleen Haswell supplies the address for every PEBS memory event, so always fill it in when the user requested it. It will be 0 when not useful (no memory access) Signed-off-by: Andi Kleen --- arch/x86/kernel/cpu/perf_event_intel_ds.c |4 1 files changed, 4 insertions(+), 0

[PATCH 15/18] perf, tools: Add perf stat --transaction v3

2013-01-25 Thread Andi Kleen
From: Andi Kleen Add support to perf stat to print the basic transactional execution statistics: Total cycles, Cycles in Transaction, Cycles in aborted transsactions using the intx and intx_checkpoint qualifiers. Transaction Starts and Elision Starts, to compute the average transaction length

perf PMU support for Haswell: Extended functionality v1

2013-01-25 Thread Andi Kleen
This is based on v7 of the earlier combined Haswell PMU patchkit. The basic functionality has moved into a separate patchkit. These patches implement more advanced functionality. Most of the functionality is related to TSX. This applies on top of the basic hsw/pmu4-basics patchkit posted separatel

[PATCH 02/18] perf, kvm: Support the intx/intx_cp modifiers in KVM arch perfmon emulation v5

2013-01-25 Thread Andi Kleen
From: Andi Kleen This is not arch perfmon, but older CPUs will just ignore it. This makes it possible to do at least some TSX measurements from a KVM guest Cc: g...@redhat.com v2: Various fixes to address review feedback v3: Ignore the bits when no CPUID. No #GP. Force raw events with TSX bits

Re: [PATCH 04/12] perf, x86: Support the TSX intx/intx_cp qualifiers v2

2013-01-26 Thread Andi Kleen
On Sat, Jan 26, 2013 at 12:54:02PM +0100, Ingo Molnar wrote: > > * Andi Kleen wrote: > > > From: Andi Kleen > > > > Implement the TSX transaction and checkpointed transaction > > qualifiers for Haswell. This allows e.g. to profile the number > > of cyc

  1   2   3   4   5   6   7   8   9   10   >