Re: [PATCH v2] x86/microcode: Handle negative microcode revisions

2018-10-25 Thread Andi Kleen
On Sat, Oct 20, 2018 at 07:41:36PM +0200, Borislav Petkov wrote: > Dropping stable. > > On Sat, Oct 20, 2018 at 07:41:58AM -0700, Andi Kleen wrote: > > From: Andi Kleen > > > > The Intel microcode revision space is unsigned. Inside Intel there are > >

[PATCH v4 2/2] perf/x86/kvm: Avoid unnecessary work in guest filtering

2018-10-25 Thread Andi Kleen
From: Andi Kleen KVM added a workaround for PEBS events leaking into guests with 26a4f3c08de4 ("perf/x86: disable PEBS on a guest entry.") This uses the VT entry/exit list to add an extra disable of the PEBS_ENABLE MSR. Intel also added a fix for this issue to microcode updates

[PATCH v4 1/2] x86/cpufeature: Add facility to match microcode revisions

2018-10-25 Thread Andi Kleen
From: Andi Kleen For bug workarounds or checks it is useful to check for specific microcode revisionss. Add a new table format to check for steppings with min microcode revisions. This does not change the existing x86_cpu_id because it's an ABI shared with modutils, and also has quite different

[PATCH v4 2/2] perf/x86/kvm: Avoid unnecessary work in guest filtering

2018-10-25 Thread Andi Kleen
From: Andi Kleen KVM added a workaround for PEBS events leaking into guests with 26a4f3c08de4 ("perf/x86: disable PEBS on a guest entry.") This uses the VT entry/exit list to add an extra disable of the PEBS_ENABLE MSR. Intel also added a fix for this issue to microcode updates

[PATCH v4 1/2] x86/cpufeature: Add facility to match microcode revisions

2018-10-25 Thread Andi Kleen
From: Andi Kleen For bug workarounds or checks it is useful to check for specific microcode revisionss. Add a new table format to check for steppings with min microcode revisions. This does not change the existing x86_cpu_id because it's an ABI shared with modutils, and also has quite different

Re: [PATCH v2 1/2] x86/cpufeature: Add facility to match microcode revisions

2018-10-25 Thread Andi Kleen
On Sun, Oct 21, 2018 at 12:20:47PM +0200, Thomas Gleixner wrote: > Andi, > > On Sat, 20 Oct 2018, Andi Kleen wrote: > > On Sat, Oct 20, 2018 at 10:19:37AM +0200, Thomas Gleixner wrote: > > > On Fri, 19 Oct 2018, Andi Kleen wrote: > > > There is no point t

Re: [PATCH v2 1/2] x86/cpufeature: Add facility to match microcode revisions

2018-10-25 Thread Andi Kleen
On Sun, Oct 21, 2018 at 12:20:47PM +0200, Thomas Gleixner wrote: > Andi, > > On Sat, 20 Oct 2018, Andi Kleen wrote: > > On Sat, Oct 20, 2018 at 10:19:37AM +0200, Thomas Gleixner wrote: > > > On Fri, 19 Oct 2018, Andi Kleen wrote: > > > There is no point t

Re: [v3 03/12] x86/fsgsbase/64: Add intrinsics/macros for FSGSBASE instructions

2018-10-24 Thread Andi Kleen
On Wed, Oct 24, 2018 at 11:53:54AM -0700, Andy Lutomirski wrote: > On Tue, Oct 23, 2018 at 11:43 AM Chang S. Bae > wrote: > > > > From: Andi Kleen > > > > Add C intrinsics and assembler macros for the new FSBASE and GSBASE > > instructions. > > &

Re: [v3 03/12] x86/fsgsbase/64: Add intrinsics/macros for FSGSBASE instructions

2018-10-24 Thread Andi Kleen
On Wed, Oct 24, 2018 at 11:53:54AM -0700, Andy Lutomirski wrote: > On Tue, Oct 23, 2018 at 11:43 AM Chang S. Bae > wrote: > > > > From: Andi Kleen > > > > Add C intrinsics and assembler macros for the new FSBASE and GSBASE > > instructions. > > &

Re: [PATCH 1/2] perf: Add munmap callback

2018-10-24 Thread Andi Kleen
> > void perf_event_mmap(struct vm_area_struct *vma) > > { > > struct perf_mmap_event mmap_event; > > > > if (!atomic_read(_mmap_events)) > > return; > > > > } > > > > Thanks. I'll add the nr_mmap_events check in V2. No, that's the wrong check here. The PEBS

Re: [PATCH 1/2] perf: Add munmap callback

2018-10-24 Thread Andi Kleen
> > void perf_event_mmap(struct vm_area_struct *vma) > > { > > struct perf_mmap_event mmap_event; > > > > if (!atomic_read(_mmap_events)) > > return; > > > > } > > > > Thanks. I'll add the nr_mmap_events check in V2. No, that's the wrong check here. The PEBS

Re: [PATCH 1/2] perf: Add munmap callback

2018-10-24 Thread Andi Kleen
> +void perf_event_munmap(void) > +{ > + struct perf_cpu_context *cpuctx; > + unsigned long flags; > + struct pmu *pmu; > + > + local_irq_save(flags); > + list_for_each_entry(cpuctx, this_cpu_ptr(_cb_list), > sched_cb_entry) { Would be good have a fast path here that checks

Re: [PATCH 1/2] perf: Add munmap callback

2018-10-24 Thread Andi Kleen
> +void perf_event_munmap(void) > +{ > + struct perf_cpu_context *cpuctx; > + unsigned long flags; > + struct pmu *pmu; > + > + local_irq_save(flags); > + list_for_each_entry(cpuctx, this_cpu_ptr(_cb_list), > sched_cb_entry) { Would be good have a fast path here that checks

Re: Broken dwarf unwinding - wrong stack pointer register value?

2018-10-24 Thread Andi Kleen
> > Can someone at least confirm whether unwinding from a function prologue via > .eh_frame (but without .debug_frame) should actually be possible? Yes it should be possible. Asynchronous unwind tables should work from any instruction. -Andi

Re: Broken dwarf unwinding - wrong stack pointer register value?

2018-10-24 Thread Andi Kleen
> > Can someone at least confirm whether unwinding from a function prologue via > .eh_frame (but without .debug_frame) should actually be possible? Yes it should be possible. Asynchronous unwind tables should work from any instruction. -Andi

Re: Broken dwarf unwinding - wrong stack pointer register value?

2018-10-22 Thread Andi Kleen
> So what if my libm wasn't compiled with -fasynchronous-unwind-tables? We It's default (64bit since always and 32bit now too) Unless someone disabled it. However libm might be partially written in assembler and hand written assembler often has problems with unwind tables because the programmer

Re: Broken dwarf unwinding - wrong stack pointer register value?

2018-10-22 Thread Andi Kleen
> So what if my libm wasn't compiled with -fasynchronous-unwind-tables? We It's default (64bit since always and 32bit now too) Unless someone disabled it. However libm might be partially written in assembler and hand written assembler often has problems with unwind tables because the programmer

Re: Broken dwarf unwinding - wrong stack pointer register value?

2018-10-22 Thread Andi Kleen
Milian Wolff writes: > > After more digging, it turns out that I've apparently chased a red herring. > I'm running archlinux which isn't shipping debug symbols for libm. 64bit executables normally have unwind information even when stripped. Unless someone forcefully stripped those too. You can

Re: Broken dwarf unwinding - wrong stack pointer register value?

2018-10-22 Thread Andi Kleen
Milian Wolff writes: > > After more digging, it turns out that I've apparently chased a red herring. > I'm running archlinux which isn't shipping debug symbols for libm. 64bit executables normally have unwind information even when stripped. Unless someone forcefully stripped those too. You can

[PATCH v2] x86/microcode: Handle negative microcode revisions

2018-10-20 Thread Andi Kleen
From: Andi Kleen The Intel microcode revision space is unsigned. Inside Intel there are special microcodes that have the highest bit set, and they are considered to have a higher revision than any microcodes that don't have this bit set. The function comparing the microcode revision

[PATCH v2] x86/microcode: Handle negative microcode revisions

2018-10-20 Thread Andi Kleen
From: Andi Kleen The Intel microcode revision space is unsigned. Inside Intel there are special microcodes that have the highest bit set, and they are considered to have a higher revision than any microcodes that don't have this bit set. The function comparing the microcode revision

Re: [PATCH v2 1/2] x86/cpufeature: Add facility to match microcode revisions

2018-10-20 Thread Andi Kleen
On Sat, Oct 20, 2018 at 10:19:37AM +0200, Thomas Gleixner wrote: > On Fri, 19 Oct 2018, Andi Kleen wrote: > > > > > + u32 min_ucode; > > > > +}; > > > > + > > > > +const struct x86_ucode_id *x86_match_ucode(const struct x86_u

Re: [PATCH v2 1/2] x86/cpufeature: Add facility to match microcode revisions

2018-10-20 Thread Andi Kleen
On Sat, Oct 20, 2018 at 10:19:37AM +0200, Thomas Gleixner wrote: > On Fri, 19 Oct 2018, Andi Kleen wrote: > > > > > + u32 min_ucode; > > > > +}; > > > > + > > > > +const struct x86_ucode_id *x86_match_ucode(const struct x86_u

Re: [PATCH v1] x86/microcode: Handle negative microcode revisions

2018-10-20 Thread Andi Kleen
On Sat, Oct 20, 2018 at 03:42:05PM +0200, Thomas Gleixner wrote: > Andi, > > On Fri, 19 Oct 2018, Andi Kleen wrote: > > Change the comparison to unsigned. With that the loading works > > as expected. > > > > I assume that wants a fixes tag and needs to be backpo

Re: [PATCH v1] x86/microcode: Handle negative microcode revisions

2018-10-20 Thread Andi Kleen
On Sat, Oct 20, 2018 at 03:42:05PM +0200, Thomas Gleixner wrote: > Andi, > > On Fri, 19 Oct 2018, Andi Kleen wrote: > > Change the comparison to unsigned. With that the loading works > > as expected. > > > > I assume that wants a fixes tag and needs to be backpo

[PATCH v3 2/2] perf/x86/kvm: Avoid unnecessary work in guest filtering

2018-10-19 Thread Andi Kleen
From: Andi Kleen KVM added a workaround for PEBS events leaking into guests with 26a4f3c08de4 ("perf/x86: disable PEBS on a guest entry.") This uses the VT entry/exit list to add an extra disable of the PEBS_ENABLE MSR. Intel also added a fix for this issue to microcode updates

[PATCH v3 1/2] x86/cpufeature: Add facility to match microcode revisions

2018-10-19 Thread Andi Kleen
From: Andi Kleen For bug workarounds or checks it is useful to check for specific microcode revisionss. Add a new table format to check for steppings with min microcode revisions. This does not change the existing x86_cpu_id because it's an ABI shared with modutils, and also has quite different

[PATCH v3 2/2] perf/x86/kvm: Avoid unnecessary work in guest filtering

2018-10-19 Thread Andi Kleen
From: Andi Kleen KVM added a workaround for PEBS events leaking into guests with 26a4f3c08de4 ("perf/x86: disable PEBS on a guest entry.") This uses the VT entry/exit list to add an extra disable of the PEBS_ENABLE MSR. Intel also added a fix for this issue to microcode updates

[PATCH v3 1/2] x86/cpufeature: Add facility to match microcode revisions

2018-10-19 Thread Andi Kleen
From: Andi Kleen For bug workarounds or checks it is useful to check for specific microcode revisionss. Add a new table format to check for steppings with min microcode revisions. This does not change the existing x86_cpu_id because it's an ABI shared with modutils, and also has quite different

[PATCH v1] x86/microcode: Handle negative microcode revisions

2018-10-19 Thread Andi Kleen
From: Andi Kleen The Intel ucode revision space is unsigned. Inside Intel there are special microcodes that have the highest bit set, and they are considered to have a higher revision than any microcodes that don't have this bit set. The function comparing the microcodes in the Linux driver

[PATCH v1] x86/microcode: Handle negative microcode revisions

2018-10-19 Thread Andi Kleen
From: Andi Kleen The Intel ucode revision space is unsigned. Inside Intel there are special microcodes that have the highest bit set, and they are considered to have a higher revision than any microcodes that don't have this bit set. The function comparing the microcodes in the Linux driver

Re: [PATCH v2 1/2] x86/cpufeature: Add facility to match microcode revisions

2018-10-19 Thread Andi Kleen
> > + u32 min_ucode; > > +}; > > + > > +const struct x86_ucode_id *x86_match_ucode(const struct x86_ucode_id > > *match) > > What's the point of returning the struct pointer? Shouldn't it be enough to > make it return bool? Also the function name really should reflect that this > checks

Re: [PATCH v2 1/2] x86/cpufeature: Add facility to match microcode revisions

2018-10-19 Thread Andi Kleen
> > + u32 min_ucode; > > +}; > > + > > +const struct x86_ucode_id *x86_match_ucode(const struct x86_ucode_id > > *match) > > What's the point of returning the struct pointer? Shouldn't it be enough to > make it return bool? Also the function name really should reflect that this > checks

Re: l1tf: Kernel suggests I throw away third of my memory. I'd rather not

2018-10-17 Thread Andi Kleen
On Wed, Oct 17, 2018 at 12:56:10PM +0200, Pavel Machek wrote: > Hi! > > 6a012288 suggests I throw away 1GB on RAM. On 3GB system.. that is not > going to be pleasant. Just rebuild your kernel with PAE? I assume your CPU supports it. This will also give you NX, which if you're really worried

Re: l1tf: Kernel suggests I throw away third of my memory. I'd rather not

2018-10-17 Thread Andi Kleen
On Wed, Oct 17, 2018 at 12:56:10PM +0200, Pavel Machek wrote: > Hi! > > 6a012288 suggests I throw away 1GB on RAM. On 3GB system.. that is not > going to be pleasant. Just rebuild your kernel with PAE? I assume your CPU supports it. This will also give you NX, which if you're really worried

Re: [PATCH v1] KVM/x86/vPMU: Guest PMI Optimization

2018-10-12 Thread Andi Kleen
> 4. Results > - Without this optimization, the guest pmi handling time is > ~450 ns, and the max sampling rate is reduced to 250. > - With this optimization, the guest pmi handling time is ~9000 ns > (i.e. 1 / 500 of the non-optimization case), and the max sampling >

Re: [PATCH v1] KVM/x86/vPMU: Guest PMI Optimization

2018-10-12 Thread Andi Kleen
> 4. Results > - Without this optimization, the guest pmi handling time is > ~450 ns, and the max sampling rate is reduced to 250. > - With this optimization, the guest pmi handling time is ~9000 ns > (i.e. 1 / 500 of the non-optimization case), and the max sampling >

[PATCH v2 1/2] x86/cpufeature: Add facility to match microcode revisions

2018-10-10 Thread Andi Kleen
From: Andi Kleen For bug workarounds or checks it is useful to check for specific microcode versions. Add a new table format to check for steppings with min microcode revisions. This does not change the existing x86_cpu_id because it's an ABI shared with modutils, and also has quite difference

[PATCH v2 1/2] x86/cpufeature: Add facility to match microcode revisions

2018-10-10 Thread Andi Kleen
From: Andi Kleen For bug workarounds or checks it is useful to check for specific microcode versions. Add a new table format to check for steppings with min microcode revisions. This does not change the existing x86_cpu_id because it's an ABI shared with modutils, and also has quite difference

[PATCH v2 2/2] perf/x86/kvm: Avoid unnecessary work in guest filtering

2018-10-10 Thread Andi Kleen
From: Andi Kleen KVM added a workaround for PEBS events leaking into guests with 26a4f3c08de4 ("perf/x86: disable PEBS on a guest entry.") This uses the VT entry/exit list to add an extra disable of the PEBS_ENABLE MSR. Intel also added a fix for this issue to microcode updates

[PATCH v2 2/2] perf/x86/kvm: Avoid unnecessary work in guest filtering

2018-10-10 Thread Andi Kleen
From: Andi Kleen KVM added a workaround for PEBS events leaking into guests with 26a4f3c08de4 ("perf/x86: disable PEBS on a guest entry.") This uses the VT entry/exit list to add an extra disable of the PEBS_ENABLE MSR. Intel also added a fix for this issue to microcode updates

Re: [RFC] perf tools: Wrong filter_band* values in json calculation"

2018-10-09 Thread Andi Kleen
On Tue, Oct 09, 2018 at 12:01:44PM +0200, Jiri Olsa wrote: > On Wed, Oct 03, 2018 at 07:45:50AM -0700, Andi Kleen wrote: > > > note there's couple of changes that actually changed > > > the number completely, like: > > > > > > -"Filter": &

Re: [RFC] perf tools: Wrong filter_band* values in json calculation"

2018-10-09 Thread Andi Kleen
On Tue, Oct 09, 2018 at 12:01:44PM +0200, Jiri Olsa wrote: > On Wed, Oct 03, 2018 at 07:45:50AM -0700, Andi Kleen wrote: > > > note there's couple of changes that actually changed > > > the number completely, like: > > > > > > -"Filter": &

Re: [PATCH v6 1/5] tools, perf, script: Add --insn-trace for instruction decoding

2018-10-08 Thread Andi Kleen
> > +> git clone https://github.com/intelxed/mbuild.git mbuild > > > > +> git clone https://github.com/intelxed/xed > >

Re: [PATCH v6 1/5] tools, perf, script: Add --insn-trace for instruction decoding

2018-10-08 Thread Andi Kleen
> > +> git clone https://github.com/intelxed/mbuild.git mbuild > > > > +> git clone https://github.com/intelxed/xed > >

Re: [PATCH v1 1/2] x86/cpufeature: Add facility to match microcode revisions

2018-10-06 Thread Andi Kleen
On Sat, Oct 06, 2018 at 04:14:54PM +0200, Thomas Gleixner wrote: > On Fri, 5 Oct 2018, Andi Kleen wrote: > > +/* > > + * Match specific microcodes or steppings. > > What means microcodes or steppings? If you mean microcode revisions then > please spell it out and u

Re: [PATCH v1 1/2] x86/cpufeature: Add facility to match microcode revisions

2018-10-06 Thread Andi Kleen
On Sat, Oct 06, 2018 at 04:14:54PM +0200, Thomas Gleixner wrote: > On Fri, 5 Oct 2018, Andi Kleen wrote: > > +/* > > + * Match specific microcodes or steppings. > > What means microcodes or steppings? If you mean microcode revisions then > please spell it out and u

[PATCH v1 1/2] x86/cpufeature: Add facility to match microcode revisions

2018-10-05 Thread Andi Kleen
From: Andi Kleen For bug workarounds or checks it is useful to check for specific microcode versions. Add a new table format to check for steppings with min/max microcode revisions. This does not change the existing x86_cpu_id because it's an ABI shared with modutils, and also has quite

[PATCH v1 1/2] x86/cpufeature: Add facility to match microcode revisions

2018-10-05 Thread Andi Kleen
From: Andi Kleen For bug workarounds or checks it is useful to check for specific microcode versions. Add a new table format to check for steppings with min/max microcode revisions. This does not change the existing x86_cpu_id because it's an ABI shared with modutils, and also has quite

Re: [RFC] perf tools: Wrong filter_band* values in json calculation"

2018-10-03 Thread Andi Kleen
> note there's couple of changes that actually changed > the number completely, like: > > -"Filter": "edge=1,filter_band2=4000", > +"Filter": "edge=1,filter_band2=30", Thanks. Looks good. I'll fix the scripts to generate the uncore events. -Andi

Re: [RFC] perf tools: Wrong filter_band* values in json calculation"

2018-10-03 Thread Andi Kleen
> note there's couple of changes that actually changed > the number completely, like: > > -"Filter": "edge=1,filter_band2=4000", > +"Filter": "edge=1,filter_band2=30", Thanks. Looks good. I'll fix the scripts to generate the uncore events. -Andi

Re: [PATCH] perf/x86/intel: Add counter freezing quirk for Goldmont

2018-10-03 Thread Andi Kleen
> There is another variant of model/stepping micro code verification code in > intel_snb_pebs_broken(). Can we please make this table based and use a > common function? That's certainly not the last quirk we're going to have. I have a patch to add a table driven microcode matcher for another fix.

Re: [PATCH] perf/x86/intel: Add counter freezing quirk for Goldmont

2018-10-03 Thread Andi Kleen
> There is another variant of model/stepping micro code verification code in > intel_snb_pebs_broken(). Can we please make this table based and use a > common function? That's certainly not the last quirk we're going to have. I have a patch to add a table driven microcode matcher for another fix.

[tip:perf/core] perf/x86/intel: Add a separate Arch Perfmon v4 PMI handler

2018-10-02 Thread tip-bot for Andi Kleen
Commit-ID: af3bdb991a5cb57c189d34aadbd3aa88995e0d9f Gitweb: https://git.kernel.org/tip/af3bdb991a5cb57c189d34aadbd3aa88995e0d9f Author: Andi Kleen AuthorDate: Wed, 8 Aug 2018 00:12:07 -0700 Committer: Ingo Molnar CommitDate: Tue, 2 Oct 2018 10:14:31 +0200 perf/x86/intel: Add

[tip:perf/core] perf/x86/intel: Add a separate Arch Perfmon v4 PMI handler

2018-10-02 Thread tip-bot for Andi Kleen
Commit-ID: af3bdb991a5cb57c189d34aadbd3aa88995e0d9f Gitweb: https://git.kernel.org/tip/af3bdb991a5cb57c189d34aadbd3aa88995e0d9f Author: Andi Kleen AuthorDate: Wed, 8 Aug 2018 00:12:07 -0700 Committer: Ingo Molnar CommitDate: Tue, 2 Oct 2018 10:14:31 +0200 perf/x86/intel: Add

[PATCH v1 1/2] perf, tools: Move perf_evsel__reset_weak_group into evlist

2018-10-01 Thread Andi Kleen
From: Andi Kleen - Move the function from builtin-stat to evlist for reuse - Rename to evlist to match purpose better - Pass the evlist as first argument. - No functional changes Signed-off-by: Andi Kleen --- tools/perf/builtin-stat.c | 29 ++--- tools/perf/util

[PATCH v1 1/2] perf, tools: Move perf_evsel__reset_weak_group into evlist

2018-10-01 Thread Andi Kleen
From: Andi Kleen - Move the function from builtin-stat to evlist for reuse - Rename to evlist to match purpose better - Pass the evlist as first argument. - No functional changes Signed-off-by: Andi Kleen --- tools/perf/builtin-stat.c | 29 ++--- tools/perf/util

[PATCH v1 2/2] perf record: Support weak groups

2018-10-01 Thread Andi Kleen
From: Andi Kleen Implement a weak group fallback for perf record, similar to the existing perf stat support. This allows to use groups that might be longer than the available counters without failing. Before: $ perf record -e '{cycles,cache-misses,cache-references,cpu_clk_unhalted.thread

[PATCH v1 2/2] perf record: Support weak groups

2018-10-01 Thread Andi Kleen
From: Andi Kleen Implement a weak group fallback for perf record, similar to the existing perf stat support. This allows to use groups that might be longer than the available counters without failing. Before: $ perf record -e '{cycles,cache-misses,cache-references,cpu_clk_unhalted.thread

Re: [RFC 0/5] perf: Per PMU access controls (paranoid setting)

2018-09-28 Thread Andi Kleen
On Fri, Sep 28, 2018 at 11:22:37PM +0200, Jann Horn wrote: > On Fri, Sep 28, 2018 at 10:59 PM Andi Kleen wrote: > > > > This new file descriptor argument doesn't exist today so it would > > > > need to create a new system call with more arguments > > > &g

Re: [RFC 0/5] perf: Per PMU access controls (paranoid setting)

2018-09-28 Thread Andi Kleen
On Fri, Sep 28, 2018 at 11:22:37PM +0200, Jann Horn wrote: > On Fri, Sep 28, 2018 at 10:59 PM Andi Kleen wrote: > > > > This new file descriptor argument doesn't exist today so it would > > > > need to create a new system call with more arguments > > > &g

Re: [RFC 0/5] perf: Per PMU access controls (paranoid setting)

2018-09-28 Thread Andi Kleen
> > This new file descriptor argument doesn't exist today so it would > > need to create a new system call with more arguments > > Is that true? The first argument is a pointer to a struct that > contains its own size, so it can be expanded without an ABI break. I > don't see any reason why you

Re: [RFC 0/5] perf: Per PMU access controls (paranoid setting)

2018-09-28 Thread Andi Kleen
> > This new file descriptor argument doesn't exist today so it would > > need to create a new system call with more arguments > > Is that true? The first argument is a pointer to a struct that > contains its own size, so it can be expanded without an ABI break. I > don't see any reason why you

Re: [RFC 0/5] perf: Per PMU access controls (paranoid setting)

2018-09-28 Thread Andi Kleen
On Fri, Sep 28, 2018 at 06:40:17PM +0100, Mark Rutland wrote: > On Fri, Sep 28, 2018 at 10:23:40AM -0700, Andi Kleen wrote: > > > There's also been prior discussion on these feature in other contexts > > > (e.g. android expoits resulting from out-of-tree drivers). It would

Re: [RFC 0/5] perf: Per PMU access controls (paranoid setting)

2018-09-28 Thread Andi Kleen
On Fri, Sep 28, 2018 at 06:40:17PM +0100, Mark Rutland wrote: > On Fri, Sep 28, 2018 at 10:23:40AM -0700, Andi Kleen wrote: > > > There's also been prior discussion on these feature in other contexts > > > (e.g. android expoits resulting from out-of-tree drivers). It would

Re: [RFC 0/5] perf: Per PMU access controls (paranoid setting)

2018-09-28 Thread Andi Kleen
> Right now we have a single knob, which is poorly documented and that should > be fixed first. But some googling gives you the information that allowing > unprivilegded access is a security risk. So the security focussed sysadmin Ah only if google could simply answer all our questions! > will

Re: [RFC 0/5] perf: Per PMU access controls (paranoid setting)

2018-09-28 Thread Andi Kleen
> Right now we have a single knob, which is poorly documented and that should > be fixed first. But some googling gives you the information that allowing > unprivilegded access is a security risk. So the security focussed sysadmin Ah only if google could simply answer all our questions! > will

Re: [RFC 0/5] perf: Per PMU access controls (paranoid setting)

2018-09-28 Thread Andi Kleen
> There's also been prior discussion on these feature in other contexts > (e.g. android expoits resulting from out-of-tree drivers). It would be > nice to see those considered. > > IIRC The conclusion from prior discussions (e.g. [1]) was that we wanted > finer granularity of control such that we

Re: [RFC 0/5] perf: Per PMU access controls (paranoid setting)

2018-09-28 Thread Andi Kleen
> There's also been prior discussion on these feature in other contexts > (e.g. android expoits resulting from out-of-tree drivers). It would be > nice to see those considered. > > IIRC The conclusion from prior discussions (e.g. [1]) was that we wanted > finer granularity of control such that we

Re: [PATCH v6 3/5] tools, perf, script: Add --call-trace and --call-ret-trace

2018-09-28 Thread Andi Kleen
> Seems to me, these two features are _NOT_ only benefit for intel_pt, > other hardware tracing (e.g. Arm CoreSight) can enable these features > as well. This patch is to document only for intel_pt, later if we > enable this feature on Arm platform we need to change the doc; > alternatively we

Re: [PATCH v6 3/5] tools, perf, script: Add --call-trace and --call-ret-trace

2018-09-28 Thread Andi Kleen
> Seems to me, these two features are _NOT_ only benefit for intel_pt, > other hardware tracing (e.g. Arm CoreSight) can enable these features > as well. This patch is to document only for intel_pt, later if we > enable this feature on Arm platform we need to change the doc; > alternatively we

Re: [RFC 3/5] perf: Allow per PMU access control

2018-09-27 Thread Andi Kleen
> + mutex_lock(_lock); > + list_for_each_entry(pmu, , entry) > + pmu->perf_event_paranoid = sysctl_perf_event_paranoid; > + mutex_unlock(_lock); What happens to pmus that got added later? The rest looks good. Can you post a non RFC version? -Andi

Re: [RFC 3/5] perf: Allow per PMU access control

2018-09-27 Thread Andi Kleen
> + mutex_lock(_lock); > + list_for_each_entry(pmu, , entry) > + pmu->perf_event_paranoid = sysctl_perf_event_paranoid; > + mutex_unlock(_lock); What happens to pmus that got added later? The rest looks good. Can you post a non RFC version? -Andi

Re: perf segmentation fault from NULL dereference

2018-09-26 Thread Andi Kleen
> Please me let me know if a valid issue so we can get a fix in. If it crashes it must be a valid issue of course. But I'm not sure about your bisect. Hard to see how my patch could cause this. Sometimes bisects go wrong. You verified by just reverting the patch? First thing I would also try

Re: perf segmentation fault from NULL dereference

2018-09-26 Thread Andi Kleen
> Please me let me know if a valid issue so we can get a fix in. If it crashes it must be a valid issue of course. But I'm not sure about your bisect. Hard to see how my patch could cause this. Sometimes bisects go wrong. You verified by just reverting the patch? First thing I would also try

[tip:perf/core] perf script: Print DSO for callindent

2018-09-26 Thread tip-bot for Andi Kleen
Commit-ID: a78cdee6fbb136694334ade4cedb331a9d0b4d5e Gitweb: https://git.kernel.org/tip/a78cdee6fbb136694334ade4cedb331a9d0b4d5e Author: Andi Kleen AuthorDate: Tue, 18 Sep 2018 05:32:10 -0700 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 19 Sep 2018 15:25:51 -0300 perf script

[tip:perf/core] perf script: Print DSO for callindent

2018-09-26 Thread tip-bot for Andi Kleen
Commit-ID: a78cdee6fbb136694334ade4cedb331a9d0b4d5e Gitweb: https://git.kernel.org/tip/a78cdee6fbb136694334ade4cedb331a9d0b4d5e Author: Andi Kleen AuthorDate: Tue, 18 Sep 2018 05:32:10 -0700 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 19 Sep 2018 15:25:51 -0300 perf script

[tip:perf/core] tools lib subcmd: Support overwriting the pager

2018-09-26 Thread tip-bot for Andi Kleen
Commit-ID: 03a1f49f26482cf832e7f0157ae5da716d927701 Gitweb: https://git.kernel.org/tip/03a1f49f26482cf832e7f0157ae5da716d927701 Author: Andi Kleen AuthorDate: Tue, 18 Sep 2018 05:32:07 -0700 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 19 Sep 2018 15:16:19 -0300 tools lib

[tip:perf/core] tools lib subcmd: Support overwriting the pager

2018-09-26 Thread tip-bot for Andi Kleen
Commit-ID: 03a1f49f26482cf832e7f0157ae5da716d927701 Gitweb: https://git.kernel.org/tip/03a1f49f26482cf832e7f0157ae5da716d927701 Author: Andi Kleen AuthorDate: Tue, 18 Sep 2018 05:32:07 -0700 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 19 Sep 2018 15:16:19 -0300 tools lib

[tip:perf/core] perf script: Allow sym and dso without ip, addr

2018-09-26 Thread tip-bot for Andi Kleen
Commit-ID: 37fed3de555199733805a2d3e03aee7727c09ea4 Gitweb: https://git.kernel.org/tip/37fed3de555199733805a2d3e03aee7727c09ea4 Author: Andi Kleen AuthorDate: Tue, 18 Sep 2018 05:32:09 -0700 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 19 Sep 2018 15:20:03 -0300 perf script

[tip:perf/core] perf script: Allow sym and dso without ip, addr

2018-09-26 Thread tip-bot for Andi Kleen
Commit-ID: 37fed3de555199733805a2d3e03aee7727c09ea4 Gitweb: https://git.kernel.org/tip/37fed3de555199733805a2d3e03aee7727c09ea4 Author: Andi Kleen AuthorDate: Tue, 18 Sep 2018 05:32:09 -0700 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 19 Sep 2018 15:20:03 -0300 perf script

[tip:perf/core] perf tools: Report itrace options in help

2018-09-26 Thread tip-bot for Andi Kleen
Commit-ID: c12e039d1233f24ab2726945f883037f47b26f1d Gitweb: https://git.kernel.org/tip/c12e039d1233f24ab2726945f883037f47b26f1d Author: Andi Kleen AuthorDate: Thu, 13 Sep 2018 20:10:31 -0700 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 19 Sep 2018 15:06:59 -0300 perf tools

[tip:perf/core] perf tools: Report itrace options in help

2018-09-26 Thread tip-bot for Andi Kleen
Commit-ID: c12e039d1233f24ab2726945f883037f47b26f1d Gitweb: https://git.kernel.org/tip/c12e039d1233f24ab2726945f883037f47b26f1d Author: Andi Kleen AuthorDate: Thu, 13 Sep 2018 20:10:31 -0700 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 19 Sep 2018 15:06:59 -0300 perf tools

[PATCH v6 5/5] perf, tools, script: Support total cycles count

2018-09-24 Thread Andi Kleen
Signed-off-by: Andi Kleen --- v2: reflow line v3: Print cycles in correct column diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 6232658c6f31..dbb0a780225c 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -913,7 +913,7 @@ static int grab_bb

[PATCH v6 5/5] perf, tools, script: Support total cycles count

2018-09-24 Thread Andi Kleen
Signed-off-by: Andi Kleen --- v2: reflow line v3: Print cycles in correct column diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 6232658c6f31..dbb0a780225c 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -913,7 +913,7 @@ static int grab_bb

Re: [PATCH] perf tools: Do not zero sample_id_all for group members

2018-09-23 Thread Andi Kleen
group members. We can't do that, because it needs to be the > same over the whole event list. This patch keeps it untouched > again. > > Fixes: e9add8bac6c6 ("perf evsel: Disable write_backward for leader sampling > group events") > Reported-by: Andi Kleen > L

Re: [PATCH] perf tools: Do not zero sample_id_all for group members

2018-09-23 Thread Andi Kleen
group members. We can't do that, because it needs to be the > same over the whole event list. This patch keeps it untouched > again. > > Fixes: e9add8bac6c6 ("perf evsel: Disable write_backward for leader sampling > group events") > Reported-by: Andi Kleen > L

[PATCH v6 1/5] tools, perf, script: Add --insn-trace for instruction decoding

2018-09-20 Thread Andi Kleen
From: Andi Kleen Add a --insn-trace short hand option for decoding and disassembling instruction streams for intel_pt. This automatically pipes the output into the xed disassembler to generate disassembled instructions. This just makes this use model much nicer to use Before % perf record -e

[PATCH v6 1/5] tools, perf, script: Add --insn-trace for instruction decoding

2018-09-20 Thread Andi Kleen
From: Andi Kleen Add a --insn-trace short hand option for decoding and disassembling instruction streams for intel_pt. This automatically pipes the output into the xed disassembler to generate disassembled instructions. This just makes this use model much nicer to use Before % perf record -e

[PATCH v6 2/5] perf, tools, script: Make itrace script default to all calls

2018-09-20 Thread Andi Kleen
From: Andi Kleen By default perf script for itrace outputs sampled instructions or branches. In my experience this is confusing to users because it's hard to correlate with real program behavior. The sampling makes sense for tools like report that actually sample to reduce the run time, but run

[PATCH v6 2/5] perf, tools, script: Make itrace script default to all calls

2018-09-20 Thread Andi Kleen
From: Andi Kleen By default perf script for itrace outputs sampled instructions or branches. In my experience this is confusing to users because it's hard to correlate with real program behavior. The sampling makes sense for tools like report that actually sample to reduce the run time, but run

[PATCH v6 5/5] perf, tools, script: Support total cycles count

2018-09-20 Thread Andi Kleen
From: Andi Kleen For perf script brstackinsn also print a running cycles count. This makes it easier to calculate cycle deltas for code sections measured with LBRs. % perf record -b -a sleep 1 % perf script -F +brstackinsn ... _dl_sysdep_start+330: 7eff9f20583ainsn

[PATCH v6 5/5] perf, tools, script: Support total cycles count

2018-09-20 Thread Andi Kleen
From: Andi Kleen For perf script brstackinsn also print a running cycles count. This makes it easier to calculate cycle deltas for code sections measured with LBRs. % perf record -b -a sleep 1 % perf script -F +brstackinsn ... _dl_sysdep_start+330: 7eff9f20583ainsn

Make perf script easier to use for itrace

2018-09-20 Thread Andi Kleen
Implement a range of improvements to make it easier to look at itrace traces with perf script. Nothing here couldn't be done before with some additional scripting, but add simple high level options to make it easier to use. % perf record -e intel_pt//k -a sleep 1 Show function calls: % perf

[PATCH v6 4/5] tools, perf, script: Implement --graph-function

2018-09-20 Thread Andi Kleen
From: Andi Kleen Add a ftrace style --graph-function argument to perf script that allows to print itrace function calls only below a given function. This makes it easier to find the code of interest in a large trace. % perf record -e intel_pt//k -a sleep 1 % perf script --graph-function

Make perf script easier to use for itrace

2018-09-20 Thread Andi Kleen
Implement a range of improvements to make it easier to look at itrace traces with perf script. Nothing here couldn't be done before with some additional scripting, but add simple high level options to make it easier to use. % perf record -e intel_pt//k -a sleep 1 Show function calls: % perf

[PATCH v6 4/5] tools, perf, script: Implement --graph-function

2018-09-20 Thread Andi Kleen
From: Andi Kleen Add a ftrace style --graph-function argument to perf script that allows to print itrace function calls only below a given function. This makes it easier to find the code of interest in a large trace. % perf record -e intel_pt//k -a sleep 1 % perf script --graph-function

[PATCH v6 3/5] tools, perf, script: Add --call-trace and --call-ret-trace

2018-09-20 Thread Andi Kleen
From: Andi Kleen Add short cut options to print PT call trace and call-ret-trace, for calls and call and returns. Roughly corresponds to ftrace function tracer and function graph tracer. Just makes these common use cases nicer to use. % perf record -a -e intel_pt// sleep 1 % perf script --call

[PATCH v6 3/5] tools, perf, script: Add --call-trace and --call-ret-trace

2018-09-20 Thread Andi Kleen
From: Andi Kleen Add short cut options to print PT call trace and call-ret-trace, for calls and call and returns. Roughly corresponds to ftrace function tracer and function graph tracer. Just makes these common use cases nicer to use. % perf record -a -e intel_pt// sleep 1 % perf script --call

Re: [PATCH v3 4/5] KVM/x86/vPMU: Add APIs to support host save/restore the guest lbr stack

2018-09-20 Thread Andi Kleen
> +int intel_pmu_enable_save_guest_lbr(struct kvm_vcpu *vcpu) > +{ > + struct kvm_pmu *pmu = vcpu_to_pmu(vcpu); > + struct perf_event *event; > + struct perf_event_attr attr = { > + .type = PERF_TYPE_RAW, > + .size = sizeof(attr), > + .pinned = true,

<    3   4   5   6   7   8   9   10   11   12   >