From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754915AbcLNIli (ORCPT ); Wed, 14 Dec 2016 03:41:38 -0500 Received: from merlin.infradead.org ([205.233.59.134]:39882 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752830AbcLNIlh (ORCPT ); Wed, 14 Dec 2016 03:41:37 -0500 Date: Wed, 14 Dec 2016 09:40:29 +0100 From: Peter Zijlstra To: Segher Boessenkool Cc: christophe leroy , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Scott Wood , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [RFC 1/2] powerpc/32: Unset MSR RI in exception epilogs Message-ID: <20161214084029.GO3124@twins.programming.kicks-ass.net> References: <20161213191514.GJ30845@gate.crashing.org> <1fbdc292-df1c-f6a8-efc4-019350209536@c-s.fr> <20161213225430.GN30845@gate.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20161213225430.GN30845@gate.crashing.org> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 13, 2016 at 04:54:30PM -0600, Segher Boessenkool wrote: > On Tue, Dec 13, 2016 at 09:39:55PM +0100, christophe leroy wrote: > > Le 13/12/2016 à 20:15, Segher Boessenkool a écrit : > > >On Tue, Dec 13, 2016 at 07:19:41PM +0100, Christophe Leroy wrote: > > >>At exception prologs, once SRR0 and SRR1 have been saved, MSR RI is > > >>set to mark the interrupt as recoverable. > > >> > > >>MSR RI has to be unset before writing into SRR0 and SRR1 at exception > > >>epilogs. > > > > > >Why? What goes wrong without this? Etc. > > > > The following patch implements perf instruction counting using the 8xx > > debug counters. When the counter reaches 0, it fires a debug exception. > > If that exception happens between the setting of srr0/srr1 and the rfi, > > values set to srr0/srr1 are lost and we end up with an Oops. > > > > To avoid that, MSR RI has to be unset. That way, because the debug > > counters mode is set to masked mode in register LCTRL2, no debug > > interrupt will happen during that critical phase. > > Okay, so why then do you do an expensive sequence on all other processors? > Does ppc32 support runtime code patching? If so, you could perhaps utilize that to only inflict the painful code sequence when perf is enabled.