From owner-freebsd-net@FreeBSD.ORG Wed Dec 19 22:06:07 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 53E68660 for ; Wed, 19 Dec 2012 22:06:07 +0000 (UTC) (envelope-from vijju.singh@gmail.com) Received: from mail-ee0-f42.google.com (mail-ee0-f42.google.com [74.125.83.42]) by mx1.freebsd.org (Postfix) with ESMTP id D61378FC14 for ; Wed, 19 Dec 2012 22:06:06 +0000 (UTC) Received: by mail-ee0-f42.google.com with SMTP id c41so1322248eek.15 for ; Wed, 19 Dec 2012 14:06:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=5WrX1sWXEhiPUmbRw0Wr+D1vbT0bO0b6i0TKquFc4b4=; b=dmDpXiObPydRKF34Te+dUhDo/vlobTO9DAZa5UqD368uIp7vHh0WBPJ/cysP2MjCO3 68tDMlO4+X2NUlkfvKBXkKLymhm/zFxgb2sg8Mz+9KMDziaApmLS/1hbrS54zJTN26KF Bt4H/KY92xs9wKLO9ZG7wCisSrRNkQvZbZURlrPNyUkyEicrT2AhcVRK3VNcsCue4lan IeMvVmWxwZrZ/+dGZMDL3tRnW7WT8wCd7/ySfZXYJTNze2iJs9u8+2h0i9LRNj4Mr5z4 ErGOO3lTOWj0MCJ2w5Ete3RNxnzBElJHX1HxUosrigyFfBkp22SlR7huHX+CWipIzqEo xYjQ== MIME-Version: 1.0 Received: by 10.14.173.69 with SMTP id u45mr17117540eel.21.1355950896111; Wed, 19 Dec 2012 13:01:36 -0800 (PST) Received: by 10.223.101.77 with HTTP; Wed, 19 Dec 2012 13:01:35 -0800 (PST) In-Reply-To: <50D21C3B.8020803@gmail.com> References: <50D218BA.7080301@FreeBSD.org> <50D21C3B.8020803@gmail.com> Date: Wed, 19 Dec 2012 13:01:35 -0800 Message-ID: Subject: Re: use of V_tcbinfo lock for TCP syncache From: Vijay Singh To: Navdeep Parhar Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-net@freebsd.org X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 22:06:07 -0000 >> Holding the pcbinfo lock prevents races between syncache_socket() and >> accept(). See rwatson's comment just above tcp_usr_accept. I noted >> this too (the comment above tod->tod_offload_socket() in tcp_syncache.c) >> back when I updated the TOE code in the kernel. > > er, I think I told you why tcp_usr_accept holds the pcbinfo lock, which > wasn't your original question... :-) But it helped. So I am thinking about trying a change where syncache_socket() would call soalloc() first, get a socket, setup the inp, and then do a (modified) sonewconn to place the socket in the listener's queue. Robert's comment indicated that this would be a better way to eliminate the race since we wouldn't need the pcblock when we make the sonewconn call. -vijay