Re: [PATCH V2 2/3] perf/x86/intel/bm.c: Add Intel Branch Monitoring support

2018-04-04 Thread Megha Dey
On Wed, 2017-12-20 at 13:23 -0800, Megha Dey wrote: > On Wed, 2017-12-13 at 08:21 +0100, Peter Zijlstra wrote: > > On Tue, Dec 12, 2017 at 03:08:00PM -0800, Megha Dey wrote: > > > > > > > > There's work on the way to allow multiple HW PMUs. You'll either have to > > > > wait for that or help in

Re: [PATCH V2 2/3] perf/x86/intel/bm.c: Add Intel Branch Monitoring support

2018-04-04 Thread Megha Dey
On Wed, 2017-12-20 at 13:23 -0800, Megha Dey wrote: > On Wed, 2017-12-13 at 08:21 +0100, Peter Zijlstra wrote: > > On Tue, Dec 12, 2017 at 03:08:00PM -0800, Megha Dey wrote: > > > > > > > > There's work on the way to allow multiple HW PMUs. You'll either have to > > > > wait for that or help in

Re: [PATCH V2 2/3] perf/x86/intel/bm.c: Add Intel Branch Monitoring support

2017-12-20 Thread Megha Dey
On Wed, 2017-12-13 at 08:21 +0100, Peter Zijlstra wrote: > On Tue, Dec 12, 2017 at 03:08:00PM -0800, Megha Dey wrote: > > > > > > There's work on the way to allow multiple HW PMUs. You'll either have to > > > wait for that or help in making that happen. What you do not do is > > > silently hack

Re: [PATCH V2 2/3] perf/x86/intel/bm.c: Add Intel Branch Monitoring support

2017-12-20 Thread Megha Dey
On Wed, 2017-12-13 at 08:21 +0100, Peter Zijlstra wrote: > On Tue, Dec 12, 2017 at 03:08:00PM -0800, Megha Dey wrote: > > > > > > There's work on the way to allow multiple HW PMUs. You'll either have to > > > wait for that or help in making that happen. What you do not do is > > > silently hack

Re: [PATCH V2 2/3] perf/x86/intel/bm.c: Add Intel Branch Monitoring support

2017-12-12 Thread Peter Zijlstra
On Tue, Dec 12, 2017 at 03:08:00PM -0800, Megha Dey wrote: > > > > There's work on the way to allow multiple HW PMUs. You'll either have to > > wait for that or help in making that happen. What you do not do is > > silently hack around it. > > Could I get a pointer to the code implementing this?

Re: [PATCH V2 2/3] perf/x86/intel/bm.c: Add Intel Branch Monitoring support

2017-12-12 Thread Peter Zijlstra
On Tue, Dec 12, 2017 at 03:08:00PM -0800, Megha Dey wrote: > > > > There's work on the way to allow multiple HW PMUs. You'll either have to > > wait for that or help in making that happen. What you do not do is > > silently hack around it. > > Could I get a pointer to the code implementing this?

Re: [PATCH V2 2/3] perf/x86/intel/bm.c: Add Intel Branch Monitoring support

2017-12-12 Thread Megha Dey
On Tue, 2017-12-12 at 23:32 +0100, Peter Zijlstra wrote: > On Tue, Dec 12, 2017 at 01:10:57PM -0800, Megha Dey wrote: > > On Mon, 2017-11-20 at 12:57 +0100, Peter Zijlstra wrote: > > > On Fri, Nov 17, 2017 at 05:54:05PM -0800, Megha Dey wrote: > > > > + mutex_lock(_counter_mutex); > > > > +

Re: [PATCH V2 2/3] perf/x86/intel/bm.c: Add Intel Branch Monitoring support

2017-12-12 Thread Megha Dey
On Tue, 2017-12-12 at 23:32 +0100, Peter Zijlstra wrote: > On Tue, Dec 12, 2017 at 01:10:57PM -0800, Megha Dey wrote: > > On Mon, 2017-11-20 at 12:57 +0100, Peter Zijlstra wrote: > > > On Fri, Nov 17, 2017 at 05:54:05PM -0800, Megha Dey wrote: > > > > + mutex_lock(_counter_mutex); > > > > +

Re: [PATCH V2 2/3] perf/x86/intel/bm.c: Add Intel Branch Monitoring support

2017-12-12 Thread Peter Zijlstra
On Tue, Dec 12, 2017 at 01:10:57PM -0800, Megha Dey wrote: > On Mon, 2017-11-20 at 12:57 +0100, Peter Zijlstra wrote: > > On Fri, Nov 17, 2017 at 05:54:05PM -0800, Megha Dey wrote: > > > + mutex_lock(_counter_mutex); > > > + for (i = 0; i < BM_MAX_COUNTERS; i++) { > > > + if

Re: [PATCH V2 2/3] perf/x86/intel/bm.c: Add Intel Branch Monitoring support

2017-12-12 Thread Peter Zijlstra
On Tue, Dec 12, 2017 at 01:10:57PM -0800, Megha Dey wrote: > On Mon, 2017-11-20 at 12:57 +0100, Peter Zijlstra wrote: > > On Fri, Nov 17, 2017 at 05:54:05PM -0800, Megha Dey wrote: > > > + mutex_lock(_counter_mutex); > > > + for (i = 0; i < BM_MAX_COUNTERS; i++) { > > > + if

Re: [PATCH V2 2/3] perf/x86/intel/bm.c: Add Intel Branch Monitoring support

2017-12-12 Thread Megha Dey
On Mon, 2017-11-20 at 12:57 +0100, Peter Zijlstra wrote: > On Fri, Nov 17, 2017 at 05:54:05PM -0800, Megha Dey wrote: > > + mutex_lock(_counter_mutex); > > + for (i = 0; i < BM_MAX_COUNTERS; i++) { > > + if (bm_counter_owner[i] == NULL) { > > + counter_to_use = i; >

Re: [PATCH V2 2/3] perf/x86/intel/bm.c: Add Intel Branch Monitoring support

2017-12-12 Thread Megha Dey
On Mon, 2017-11-20 at 12:57 +0100, Peter Zijlstra wrote: > On Fri, Nov 17, 2017 at 05:54:05PM -0800, Megha Dey wrote: > > + mutex_lock(_counter_mutex); > > + for (i = 0; i < BM_MAX_COUNTERS; i++) { > > + if (bm_counter_owner[i] == NULL) { > > + counter_to_use = i; >

Re: [PATCH V2 2/3] perf/x86/intel/bm.c: Add Intel Branch Monitoring support

2017-12-12 Thread Megha Dey
On Mon, 2017-11-20 at 15:10 +0100, Jiri Olsa wrote: > On Fri, Nov 17, 2017 at 05:54:05PM -0800, Megha Dey wrote: > > SNIP > > > +/* Branch Monitoring default and mask values */ > > +#define BM_MAX_WINDOW_SIZE 0x3ff > > +#define BM_MAX_THRESHOLD 0x7f > > +#define BM_MAX_EVENTS

Re: [PATCH V2 2/3] perf/x86/intel/bm.c: Add Intel Branch Monitoring support

2017-12-12 Thread Megha Dey
On Mon, 2017-11-20 at 15:10 +0100, Jiri Olsa wrote: > On Fri, Nov 17, 2017 at 05:54:05PM -0800, Megha Dey wrote: > > SNIP > > > +/* Branch Monitoring default and mask values */ > > +#define BM_MAX_WINDOW_SIZE 0x3ff > > +#define BM_MAX_THRESHOLD 0x7f > > +#define BM_MAX_EVENTS

Re: [PATCH V2 2/3] perf/x86/intel/bm.c: Add Intel Branch Monitoring support

2017-11-20 Thread Jiri Olsa
On Fri, Nov 17, 2017 at 05:54:05PM -0800, Megha Dey wrote: SNIP > +/* Branch Monitoring default and mask values */ > +#define BM_MAX_WINDOW_SIZE 0x3ff > +#define BM_MAX_THRESHOLD 0x7f > +#define BM_MAX_EVENTS6 > +#define BM_WINDOW_SIZE_SHIFT

Re: [PATCH V2 2/3] perf/x86/intel/bm.c: Add Intel Branch Monitoring support

2017-11-20 Thread Jiri Olsa
On Fri, Nov 17, 2017 at 05:54:05PM -0800, Megha Dey wrote: SNIP > +/* Branch Monitoring default and mask values */ > +#define BM_MAX_WINDOW_SIZE 0x3ff > +#define BM_MAX_THRESHOLD 0x7f > +#define BM_MAX_EVENTS6 > +#define BM_WINDOW_SIZE_SHIFT

Re: [PATCH V2 2/3] perf/x86/intel/bm.c: Add Intel Branch Monitoring support

2017-11-20 Thread Peter Zijlstra
On Fri, Nov 17, 2017 at 05:54:05PM -0800, Megha Dey wrote: > + mutex_lock(_counter_mutex); > + for (i = 0; i < BM_MAX_COUNTERS; i++) { > + if (bm_counter_owner[i] == NULL) { > + counter_to_use = i; > + bm_counter_owner[i] = event; > +

Re: [PATCH V2 2/3] perf/x86/intel/bm.c: Add Intel Branch Monitoring support

2017-11-20 Thread Peter Zijlstra
On Fri, Nov 17, 2017 at 05:54:05PM -0800, Megha Dey wrote: > + mutex_lock(_counter_mutex); > + for (i = 0; i < BM_MAX_COUNTERS; i++) { > + if (bm_counter_owner[i] == NULL) { > + counter_to_use = i; > + bm_counter_owner[i] = event; > +

[PATCH V2 2/3] perf/x86/intel/bm.c: Add Intel Branch Monitoring support

2017-11-17 Thread Megha Dey
Currently, the cannonlake family of Intel processors support the branch monitoring feature. Intel's Branch monitoring feature is trying to utilize heuristics to detect the occurrence of an ROP (Return Oriented Programming) attack. A perf-based kernel driver has been used to monitor the occurrence

[PATCH V2 2/3] perf/x86/intel/bm.c: Add Intel Branch Monitoring support

2017-11-17 Thread Megha Dey
Currently, the cannonlake family of Intel processors support the branch monitoring feature. Intel's Branch monitoring feature is trying to utilize heuristics to detect the occurrence of an ROP (Return Oriented Programming) attack. A perf-based kernel driver has been used to monitor the occurrence