From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753095Ab3JWUsv (ORCPT ); Wed, 23 Oct 2013 16:48:51 -0400 Received: from merlin.infradead.org ([205.233.59.134]:55201 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751788Ab3JWUsu (ORCPT ); Wed, 23 Oct 2013 16:48:50 -0400 Date: Wed, 23 Oct 2013 22:48:38 +0200 From: Peter Zijlstra To: Linus Torvalds Cc: Don Zickus , Andi Kleen , dave.hansen@linux.intel.com, Stephane Eranian , jmario@redhat.com, Linux Kernel Mailing List , Arnaldo Carvalho de Melo , Ingo Molnar Subject: Re: [PATCH] perf, x86: Optimize intel_pmu_pebs_fixup_ip() Message-ID: <20131023204838.GB19466@laptop.lan> References: <20131016230712.GC26785@twins.programming.kicks-ass.net> <20131017094145.GE3364@laptop.programming.kicks-ass.net> <20131017160034.GO227855@redhat.com> <20131017160439.GP227855@redhat.com> <20131017163039.GR10651@twins.programming.kicks-ass.net> <20131017220156.GB10651@twins.programming.kicks-ass.net> <20131022211237.GH2490@laptop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 23, 2013 at 08:09:53AM +0100, Linus Torvalds wrote: > On Tue, Oct 22, 2013 at 10:12 PM, Peter Zijlstra wrote: > >> > >> Careful! There is one magic piece of state that you need to > >> save-and-restore if you do this, namely %cr2. Taking a page fault > >> always writes to %cr2, and we must *not* corrupt it in the NMI > >> handler. > > > > It looks like this is already dealt with (a similar thing is done for > > i386). > > Oh, ok then, we should be good to go. I wonder why we needed that > special "_nmi()" version, then.. Ah, the whole fault from nmi trickery from Steve is from after we did the copy_from_user_nmi() thing. We're only just catching up :-) > Please do check that NMI increment the irq-counts etc.. Otherwise > you'll need to add the explicit "pagefault_disable/enable()" pair > around the __copy_from_user_inatomic().. Yeah, we add NMI_OFFSET to preempt_count on nmi_enter. I'll also make sure to test we actually hit the fault path by concurrently running something like: while :; echo 1 > /proc/sys/vm/drop_caches ; done while doing perf top or so..