Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034099AbcJ0OgT (ORCPT ); Thu, 27 Oct 2016 10:36:19 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:34091 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935657AbcJ0OgN (ORCPT ); Thu, 27 Oct 2016 10:36:13 -0400 Date: Thu, 27 Oct 2016 11:11:04 +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: <20161027091104.GB19469@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="K8nIJk4ghYZn606h" 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: 1886 Lines: 73 --K8nIJk4ghYZn606h Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu 2016-10-27 10:28:01, Peter Zijlstra wrote: > On Wed, Oct 26, 2016 at 10:54:16PM +0200, Pavel Machek wrote: > > Hi! > >=20 > > 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. >=20 > That is, why doesn't: >=20 > $ perf record -e cache-misses -c 1000000 -a -- sleep 5 >=20 > suffice? How to work around rowhammer, break my system _and_ make kernel perf maintainers scream at the same time: (:-) ) I think I got the place now. Let me try... Thanks, Pavel diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index d31735f..ce83f5e 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -1495,6 +1495,11 @@ perf_event_nmi_handler(unsigned int cmd, struct pt_r= egs *regs) =20 perf_sample_event_took(finish_clock - start_clock); =20 + /* Here */ + { + udelay(58000); + } + return ret; } NOKPROBE_SYMBOL(perf_event_nmi_handler); --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --K8nIJk4ghYZn606h Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlgRxKgACgkQMOfwapXb+vL18wCeOwPWT+IEM7FJYeeSRh3kA39i w9MAn3/hmc51mm8oLuv5LQ0hk31unuOy =xZQz -----END PGP SIGNATURE----- --K8nIJk4ghYZn606h--