Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755484AbcJ0OqN (ORCPT ); Thu, 27 Oct 2016 10:46:13 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:34452 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754375AbcJ0OqL (ORCPT ); Thu, 27 Oct 2016 10:46:11 -0400 Date: Thu, 27 Oct 2016 10:46:38 +0200 From: Pavel Machek To: Peter Zijlstra Cc: acme@redhat.com, kernel list , mingo@redhat.com, alexander.shishkin@linux.intel.com Subject: Re: Getting interrupt every million cache misses Message-ID: <20161027084637.GA19469@amd> References: <20161026204748.GA11177@amd> <20161027082801.GE3568@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="17pEHd4RhPHOinZp" Content-Disposition: inline In-Reply-To: <20161027082801.GE3568@worktop.programming.kicks-ass.net> 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: 1874 Lines: 62 --17pEHd4RhPHOinZp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > > I'd like to get an interrupt every million cache misses... to do a > > printk() or something like that. As far as I can tell, modern hardware > > should allow me to do that. AFAICT performance events subsystem can do > > something like that, but I can't figure out where the code is / what I > > should call. > >=20 > > Can someone help? >=20 > Can you go back one step and explain why you would want this? What use > is a printk() on every 1e6-th cache miss. First, thanks for quick reply. And actually, printk() is not needed, udelay(50msec) is. Reason is, that DRAM becomes unreliable if about milion cache misses happen in under 64msec -- so I'd like to slow the system down in such cases to prevent bug from biting me. (Details are here https://googleprojectzero.blogspot.cz/2015/03/exploiting-dram-rowhammer-bug= -to-gain.html ). Bug is exploitable to get local root; it is also exploitable to gain local code execution from javascript... so it is rather severe. > That is, why doesn't: >=20 > $ perf record -e cache-misses -c 1000000 -a -- sleep 5 >=20 > suffice? Thanks for the pointer... I'd really like to do this from kernel, so that I can "almost synchronously" stop the execution when excessive cache isses happen. Best regards, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --17pEHd4RhPHOinZp Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlgRvuwACgkQMOfwapXb+vJHnwCbB3wD0dGv+II9dHO5Yz3bzFqI W7sAoLJMrZiptolUp7tjv+FRBHLB3mYp =Q1VF -----END PGP SIGNATURE----- --17pEHd4RhPHOinZp--