Re: rowhammer protection [was Re: Getting interrupt every million cache misses]

2016-10-28 Thread Pavel Machek
Hi! > > I agree this needs to be tunable (and with the other suggestions). But > > this is actually not the most important tunable: the detection > > threshold (rh_attr.sample_period) should be way more important. > > > > And yes, this will all need to be tunable, somehow. But lets verify > > tha

Re: rowhammer protection [was Re: Getting interrupt every million cache misses]

2016-10-28 Thread Pavel Machek
Hi! > > I agree this needs to be tunable (and with the other suggestions). But > > this is actually not the most important tunable: the detection > > threshold (rh_attr.sample_period) should be way more important. > > So being totally ignorant of the detail of how rowhammer abuses the DDR > thing

Re: [kernel-hardening] Re: rowhammer protection [was Re: Getting interrupt every million cache misses]

2016-10-28 Thread Mark Rutland
On Fri, Oct 28, 2016 at 11:35:47AM +0200, Ingo Molnar wrote: > > * Vegard Nossum wrote: > > > Would it make sense to sample the counter on context switch, do some > > accounting on a per-task cache miss counter, and slow down just the > > single task(s) with a too high cache miss rate? That way

Re: rowhammer protection [was Re: Getting interrupt every million cache misses]

2016-10-28 Thread Vegard Nossum
On 28 October 2016 at 11:35, Ingo Molnar wrote: > > * Vegard Nossum wrote: > >> Would it make sense to sample the counter on context switch, do some >> accounting on a per-task cache miss counter, and slow down just the >> single task(s) with a too high cache miss rate? That way there's no >> glo

Re: rowhammer protection [was Re: Getting interrupt every million cache misses]

2016-10-28 Thread Ingo Molnar
* Vegard Nossum wrote: > Would it make sense to sample the counter on context switch, do some > accounting on a per-task cache miss counter, and slow down just the > single task(s) with a too high cache miss rate? That way there's no > global slowdown (which I assume would be the case here). The

Re: rowhammer protection [was Re: Getting interrupt every million cache misses]

2016-10-28 Thread Vegard Nossum
On 28 October 2016 at 11:04, Peter Zijlstra wrote: > On Fri, Oct 28, 2016 at 10:50:39AM +0200, Pavel Machek wrote: >> On Fri 2016-10-28 09:07:01, Ingo Molnar wrote: >> > >> > * Pavel Machek wrote: >> > >> > > +static void rh_overflow(struct perf_event *event, struct >> > > perf_sample_data *data

Re: rowhammer protection [was Re: Getting interrupt every million cache misses]

2016-10-28 Thread Peter Zijlstra
On Fri, Oct 28, 2016 at 10:50:39AM +0200, Pavel Machek wrote: > On Fri 2016-10-28 09:07:01, Ingo Molnar wrote: > > > > * Pavel Machek wrote: > > > > > +static void rh_overflow(struct perf_event *event, struct > > > perf_sample_data *data, struct pt_regs *regs) > > > +{ > > > + u64 *ts = this_cp

Re: rowhammer protection [was Re: Getting interrupt every million cache misses]

2016-10-28 Thread Ingo Molnar
* Pavel Machek wrote: > On Fri 2016-10-28 09:07:01, Ingo Molnar wrote: > > > > * Pavel Machek wrote: > > > > > +static void rh_overflow(struct perf_event *event, struct > > > perf_sample_data *data, struct pt_regs *regs) > > > +{ > > > + u64 *ts = this_cpu_ptr(&rh_timestamp); /* this is NMI

Re: rowhammer protection [was Re: Getting interrupt every million cache misses]

2016-10-28 Thread Pavel Machek
On Fri 2016-10-28 09:07:01, Ingo Molnar wrote: > > * Pavel Machek wrote: > > > +static void rh_overflow(struct perf_event *event, struct perf_sample_data > > *data, struct pt_regs *regs) > > +{ > > + u64 *ts = this_cpu_ptr(&rh_timestamp); /* this is NMI context */ > > + u64 now = ktime_get_

Re: rowhammer protection [was Re: Getting interrupt every million cache misses]

2016-10-28 Thread Ingo Molnar
* Pavel Machek wrote: > +static void rh_overflow(struct perf_event *event, struct perf_sample_data > *data, struct pt_regs *regs) > +{ > + u64 *ts = this_cpu_ptr(&rh_timestamp); /* this is NMI context */ > + u64 now = ktime_get_mono_fast_ns(); > + s64 delta = now - *ts; > + > +