Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964860AbcJ1IvS (ORCPT ); Fri, 28 Oct 2016 04:51:18 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:55463 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755896AbcJ1IvQ (ORCPT ); Fri, 28 Oct 2016 04:51:16 -0400 Date: Fri, 28 Oct 2016 10:50:39 +0200 From: Pavel Machek To: Ingo Molnar Cc: Kees Cook , Peter Zijlstra , Arnaldo Carvalho de Melo , kernel list , Ingo Molnar , Alexander Shishkin , "kernel-hardening@lists.openwall.com" Subject: Re: rowhammer protection [was Re: Getting interrupt every million cache misses] Message-ID: <20161028085039.GA15032@amd> References: <20161026204748.GA11177@amd> <20161027082801.GE3568@worktop.programming.kicks-ass.net> <20161027091104.GB19469@amd> <20161027093334.GK3102@twins.programming.kicks-ass.net> <20161027212747.GA18147@amd> <20161028070701.GA11376@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="/9DWx/yDrRhgMJTb" Content-Disposition: inline In-Reply-To: <20161028070701.GA11376@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1618 Lines: 57 --/9DWx/yDrRhgMJTb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri 2016-10-28 09:07:01, Ingo Molnar wrote: >=20 > * Pavel Machek wrote: >=20 > > +static void rh_overflow(struct perf_event *event, struct perf_sample_d= ata *data, struct pt_regs *regs) > > +{ > > + u64 *ts =3D this_cpu_ptr(&rh_timestamp); /* this is NMI context */ > > + u64 now =3D ktime_get_mono_fast_ns(); > > + s64 delta =3D now - *ts; > > + > > + *ts =3D now; > > + > > + /* FIXME msec per usec, reverse logic? */ > > + if (delta < 64 * NSEC_PER_MSEC) > > + mdelay(56); > > +} >=20 > I'd suggest making the absolute delay sysctl tunable, because 'wait 56 ms= ecs' is=20 > very magic, and do we know it 100% that 56 msecs is what is needed > everywhere? 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 that this works, first :-). Thanks and best regards, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --/9DWx/yDrRhgMJTb Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlgTEV8ACgkQMOfwapXb+vInWgCgkxN612QLhTOaFrxBGh+uc6Op 5WMAoIRCUeLRxbOtQ0496Lc7Ij8nAxkl =8m/2 -----END PGP SIGNATURE----- --/9DWx/yDrRhgMJTb--