From owner-freebsd-hackers@FreeBSD.ORG Tue Nov 23 13:26:57 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 990971065675; Tue, 23 Nov 2010 13:26:57 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id B53FE8FC13; Tue, 23 Nov 2010 13:26:56 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id PAA21018; Tue, 23 Nov 2010 15:26:55 +0200 (EET) (envelope-from avg@freebsd.org) Message-ID: <4CEBC11F.9000402@freebsd.org> Date: Tue, 23 Nov 2010 15:26:55 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.12) Gecko/20101029 Lightning/1.0b2 Thunderbird/3.1.6 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org, "Robert N. M. Watson" References: <4CEB6039.2040700@freebsd.org> In-Reply-To: <4CEB6039.2040700@freebsd.org> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=x-viet-vps Content-Transfer-Encoding: 7bit Cc: Subject: Re: dtrace/cyclic deadlock X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2010 13:26:57 -0000 on 23/11/2010 08:33 Andriy Gapon said the following: > I think that this is quite similar to what we do for per-CPU caches in UMA and > so the same approach should work here. > That is, as in (Open)Solaris, the data should be accessed only from the owning > CPU and spinlock_enter()/spinlock_exit() should be used to prevent races between > non-interrupt code and nested interrupt code. Here's a patch that makes our version of cyclic.c a little bit closer to the upstream version whilst implementing the above idea: http://people.freebsd.org/~avg/cyclic-deadlock.diff All accesses to per-CPU cyclics data are performed strictly from the corresponding CPUs in an interrupt or interrupt-like context. "Upcalls" occur in event timer's interrupt filter and all down calls are performed via smp_rendezvous_cpus(). I will appreciate reviews and testing. Thanks! -- Andriy Gapon