From owner-freebsd-dtrace@freebsd.org Thu May 12 07:59:26 2016 Return-Path: Delivered-To: freebsd-dtrace@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ABCAEB38107 for ; Thu, 12 May 2016 07:59:26 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [198.74.231.69]) by mx1.freebsd.org (Postfix) with ESMTP id 8FF3B1F8C; Thu, 12 May 2016 07:59:26 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [198.74.231.63]) by cyrus.watson.org (Postfix) with ESMTPS id ADDBF46C0A; Thu, 12 May 2016 03:59:25 -0400 (EDT) Date: Thu, 12 May 2016 08:59:25 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Mark Johnston cc: Abhishek Kulkarni , "freebsd-dtrace@freebsd.org" Subject: Re: Regarding Dtrace on Arm In-Reply-To: <20160511164945.GB76917@wkstn-mjohnston.west.isilon.com> Message-ID: References: <85861491-5F47-4448-B933-E1394C578646@juniper.net> <20160511164945.GB76917@wkstn-mjohnston.west.isilon.com> User-Agent: Alpine 2.20 (BSF 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2016 07:59:26 -0000 On Wed, 11 May 2016, Mark Johnston wrote: >> Hello All, >> >> I was using Dtrace using the FBT provider on an arm platform with witness >> enabled. When FBT is used with the kernel module, it generates a kernel >> panic or the system becomes unresponsive. Is this problem know or seen >> before. I am copying the kernel backtrace below for reference. The issue >> seems to be with a blockable sleep lock(kld_sx) acquired which is >> conflicting with the td->td_critnest positive value. > > Unfortunately, I think this is expected. The ARM port of DTrace will call > into the kernel linker from probe context to perform stack unwinding. This > is a bug since the kernel linker cannot be entered in arbitrary contexts - > the thread might already hold the linker lock, or might hold a critical > section as in your example. > > This is a known issue, but I'm not sure if anyone is working on fixing it. Andrew Turner and I have discussed this on multiple occasions -- the issue is that to unwind stacks on ARMv7/ARMv8, you need access to unwind tables that are accessed via the linker. In our Cambridge L41 course, our workaround was to compile everything into the kernel rather than use modules -- and, unfortunately, we've not had a chance to get back to sorting this out. The solution is not that difficult, it just requires a bit of work: we need a reference-count/lockless synchronisation model that allows safe lookup of unwind state from preemptive contexts (not just DTrace, but also HWPMC), to ensure that unwind tables are kept stable while they could be in use from those contexts. Robert