From owner-freebsd-arch@FreeBSD.ORG Thu Apr 8 09:57:13 2010 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B7C8106566B for ; Thu, 8 Apr 2010 09:57:13 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.157]) by mx1.freebsd.org (Postfix) with ESMTP id 683E18FC1A for ; Thu, 8 Apr 2010 09:57:11 +0000 (UTC) Received: by fg-out-1718.google.com with SMTP id d23so767135fga.13 for ; Thu, 08 Apr 2010 02:57:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:received:message-id:subject :from:to:cc:content-type; bh=NCi9vXF88mcnsjKF1ZAgfMuv0nrbpfBnNBOV8i1pSug=; b=P81VGZluEGRXAPh7kPWWbrXPLYkxBB61X5GJJWFjD8IMvyKHIwb7E3wOweX0Jbuv8S XUBaGSa5vtawtipJCvs+nexUkEIz/7yVx0xzoDEZPGX9uPz3THmzupdTULIvP1oxmLZx mA65VEb/zOKoVY/7F8TL0Flq9h+mKz1uaNYoY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=jdBLGioc+e69EtPhA4PQn+gDidzyz9/hishG+cT1S0SKqT86wQ4J6ASFRzco0F3UZD BOPmOpuos2CCpA4iFPQKTQGdj14dtpBs0dJmyYSPONO4lahWIyU6hETNn9bsXHW4O4GS LH5W4ZiytT9CSvDy3UrE6o1OQeMq9Zdi9KzlE= MIME-Version: 1.0 Sender: asmrookie@gmail.com Received: by 10.239.137.131 with HTTP; Thu, 8 Apr 2010 02:57:10 -0700 (PDT) In-Reply-To: <20100404175140.GB40499@stack.nl> References: <20100404175140.GB40499@stack.nl> Date: Thu, 8 Apr 2010 11:57:10 +0200 X-Google-Sender-Auth: 4b922fec160f06e2 Received: by 10.239.184.72 with SMTP id x8mr935082hbg.44.1270720630898; Thu, 08 Apr 2010 02:57:10 -0700 (PDT) Message-ID: From: Attilio Rao To: Jilles Tjoelker Content-Type: text/plain; charset=UTF-8 Cc: Ed Maste , freebsd-arch@freebsd.org Subject: Re: so_rcv_sx, deadlkres, SIGSTOP X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2010 09:57:13 -0000 2010/4/4 Jilles Tjoelker : > The SX locks so_snd_sx and so_rcv_sx can be legitimately held for > arbitrary amounts of time, while waiting until a send or recv is > possible. Any other threads wanting to send/recv on the socket will > sleep interruptibly on the corresponding SX. If deadlkres is activated, > it may detect a deadlock even though there is no problem. > > If a SIGSTOP or similar comes in while waiting until send/recv is > possible, the SX is held across the suspension and noone will be able to > send/recv on the socket until the process is resumed. On the other hand > a thread waiting for the SX can be suspended without harm. Adding PBDRY > to various sleeps may help but may also introduce other problems > (SIGSTOP disturbing the functioning of the process more, possibly with > stuff like SO_RCVTIMEO). > > Example (using the fact that fifos are implemented using sockets): > > term1% mkfifo testfifo > term1% cat >testfifo > > term2% cat testfifo > > term3% cat testfifo > > Letting this sit for half an hour will trigger deadlkres. Jilles, may you please try this patch?: http://www.freebsd.org/~attilio/Sandvine/deadlkres/deadlkres-blessed.diff It does introduce a blessed list where the sx_lock can be whitelisted. It also fixes, for long sleeps, the wrap-up of ticks object. The obvious fallout is that deadlkres can't help much with deadlocks for whitelisted sxlock or lockmgr but that is a fair price I think. Thanks, Attilio -- Peace can only be achieved by understanding - A. Einstein