From owner-freebsd-arch@FreeBSD.ORG Thu Apr 8 09:58:11 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 69E89106566B for ; Thu, 8 Apr 2010 09:58:11 +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 ED2568FC1F for ; Thu, 8 Apr 2010 09:58:10 +0000 (UTC) Received: by fg-out-1718.google.com with SMTP id l26so1733145fgb.13 for ; Thu, 08 Apr 2010 02:58:10 -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=9WUuwuzl6AedpshxT6zAAIfLfObFrchCGILsya6JeWo=; b=hNjcdBpOrNAuT3+gwp8df1sFVowv+ZclfgsBEVXdpy3AKdsy5FWsabT/zg1JZZsiSL F24Ec5b/41cMphlsqR7ey6+W4jooqSwKaIUTiXErusMjGfyqcBFIj3OWkMYK5o7D6+1m YXflnku9ZRsWw/+GssLpP5LF4Pzsn9YWqrHUI= 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=bMbeyv8f40x8/6tE/CWvEAxjpFwpU5bVZtZeR2H578+uG9rzguFe0BU4IbGxKxI1zX aglUIQDLGFZR8erSH2UEmRpEk3OQ+/Lf4XkymkF26NjUQiAURjgZBpPAN1dNB1nm4ufp 95ixv5gtqu7Ue4GYxEkbVCVISo8sN/JMG4aMY= MIME-Version: 1.0 Sender: asmrookie@gmail.com Received: by 10.239.137.131 with HTTP; Thu, 8 Apr 2010 02:58:08 -0700 (PDT) In-Reply-To: References: <20100404175140.GB40499@stack.nl> Date: Thu, 8 Apr 2010 11:58:08 +0200 X-Google-Sender-Auth: 9e1991996186e240 Received: by 10.239.187.129 with SMTP id l1mr957269hbh.86.1270720689902; Thu, 08 Apr 2010 02:58:09 -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:58:11 -0000 2010/4/8 Attilio Rao : > 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. Forgot to mention: mutex are left out from this design by purpose because a similar problem might never happen for them by design. Attilio -- Peace can only be achieved by understanding - A. Einstein