Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755177AbbLKMPH (ORCPT ); Fri, 11 Dec 2015 07:15:07 -0500 Received: from queue01b.mail.zen.net.uk ([212.23.3.242]:36193 "EHLO queue01b.mail.zen.net.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755136AbbLKMPE (ORCPT ); Fri, 11 Dec 2015 07:15:04 -0500 Message-ID: <1449836032.2815.39.camel@linaro.org> Subject: Re: [RFC] kprobe'ing conditionally executed instructions From: "Jon Medhurst (Tixy)" To: Russell King - ARM Linux Cc: David Long , Pratyush Anand , Steve Capper , Ananth N Mavinakayanahalli , will.deacon@arm.com, "linux-kernel@vger.kernel.org" , anil.s.keshavamurthy@intel.com, Sandeepa Prabhu , masami.hiramatsu.pt@hitachi.com, wcohen@redhat.com, davem@davemloft.net, "linux-arm-kernel@lists.infradead.org" Date: Fri, 11 Dec 2015 12:13:52 +0000 In-Reply-To: <20151211103459.GS8644@n2100.arm.linux.org.uk> References: <566A5997.9020908@linaro.org> <1449829633.2815.27.camel@linaro.org> <20151211103459.GS8644@n2100.arm.linux.org.uk> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.9-1+b1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Originating-smarthost01a-IP: [82.69.122.217] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2102 Lines: 43 On Fri, 2015-12-11 at 10:34 +0000, Russell King - ARM Linux wrote: > On Fri, Dec 11, 2015 at 10:27:13AM +0000, Jon Medhurst (Tixy) wrote: > > On Fri, 2015-12-11 at 00:05 -0500, David Long wrote: > > > There is a moderate amount of code already in kprobes on ARM and the > > > current ARMv8 patch to deal with conditional execution of instructions. > > > One aspect of how this is handled is that instructions that fail their > > > predicate and are not (technically) executed are also not treated as a > > > hit kprobe. Steve Capper has suggested that the probe handling should > > > still take place because we stepped through the instruction even if it > > > was effectively a nop. This would be a significant change in how it > > > currently works on 32-bit ARM > > > > 32-bit ARM uses undefined instructions for kprobe 'breakpoints' and the > > ARM ARM says it's implementation defined behaviour whether these > > generate exceptions or not, i.e. whether the kprobe handler will be > > called. > > There are two classes of undefined instructions. There are those which > fall into the above category, and there are those which are guaranteed > to raise an exception. We should always be using the guaranteed ones, > not the other set. I wonder if I'm going senile or have been subject to having the ARM ARM evolve under me. I could swear we used instructions that were defined as undefined (so to speak) and that conditional versions of undefined instructions were UNPREDICTABLE. However, checking the ARM ARM again I see those instruction encodings are for the BKPT instruction which says: Breakpoint causes a software breakpoint to occur. Breakpoint is always unconditional, even when inside an IT block. So, my previous statements about not being able to implement the proposed kprobe changes consistently aren't true. -- Tixy -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/