From owner-freebsd-net@FreeBSD.ORG Fri Oct 24 05:27:01 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 72AFDB22 for ; Fri, 24 Oct 2014 05:27:01 +0000 (UTC) Received: from mail-wi0-x22d.google.com (mail-wi0-x22d.google.com [IPv6:2a00:1450:400c:c05::22d]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0BE99843 for ; Fri, 24 Oct 2014 05:27:00 +0000 (UTC) Received: by mail-wi0-f173.google.com with SMTP id ex7so340553wid.0 for ; Thu, 23 Oct 2014 22:26:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=lp1g4YD/6cXwu8V+0h9QIFGfyJBYzSgKTLEnxgcVWVM=; b=hs1SMwWShS0r1SmqGxmVUIWUBVJJRJIsmcayU6BU+eMi5netrz8xglbvPOyXLVmiLE JD84D/47dDwtGEgsYqaJGHq0o8EpTZDzx1avfaeElKpgOUXsGC9E9QXH2Hmz+Exfuli3 c/K7CU2tjFR+ieA5MN0hQKxDglnHkY6Aaaovk68LUTkrAMHUazwyk7iJIa+HGykdZLHC CFgrHjz3+3RebZs/r15SOOt4B5V/8UhImls7HWKb7OQRRqykzFvdS3VPu8Wd4N07B83+ WFpzIOBZ4ATtUSAG4PtFD18Ume7SyxTMekcNrElfNkWxqlpXlfgAfF72ZDEt2ICFPe9y gVpw== X-Received: by 10.180.83.37 with SMTP id n5mr1605184wiy.7.1414128419282; Thu, 23 Oct 2014 22:26:59 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id wt3sm4333773wjb.40.2014.10.23.22.26.58 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 23 Oct 2014 22:26:58 -0700 (PDT) Date: Fri, 24 Oct 2014 07:26:56 +0200 From: Mateusz Guzik To: freebsd-net@freebsd.org Subject: nd6_timer vs Giant vs locking in general Message-ID: <20141024052656.GG11222@dft-labs.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 05:27:01 -0000 Hello there, dtrace revealed that the kernel schedules nd6_timer a lot. Not only that, his callout is not mpsafe so the kernel locks Giant which I believe is an oversight. Also the code looks really suspicious as it walks V_in6_ifaddrhead without any locking (not to mention there is an interestng comment: XXXRW: in6_ifaddrhead locking :>) Dropping it here in case there is someone interested in fixing this up. -- Mateusz Guzik