From owner-freebsd-net@FreeBSD.ORG Wed Dec 19 20:05:09 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 84850B18 for ; Wed, 19 Dec 2012 20:05:09 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: from mail-da0-f52.google.com (mail-da0-f52.google.com [209.85.210.52]) by mx1.freebsd.org (Postfix) with ESMTP id 4F9028FC17 for ; Wed, 19 Dec 2012 20:05:09 +0000 (UTC) Received: by mail-da0-f52.google.com with SMTP id f10so1094236dak.11 for ; Wed, 19 Dec 2012 12:05:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=pvWmdi9tJDIqlVBov5HP+TrxLkWRTwEP/HBeGkoQsrM=; b=SsxwX+TpHt0CQGPFca0FRwkaA6WFPsx9IHM6vXuaOEq5ZDM8H6DTmxLJs35oXQMIht +HKpyCvLYxh3h/Z0ShIaPKYo+u7p9e31rbtieXUOgVV7K1JYOfT5vZ2G5SpcYr5UH2Uh iTIDuBamY0sf2Pv2S1zI/UnhrYr5MZUkUqU9iUEzXqDEuqhBNNT2FHt0xGUD7Ges/HRi uDNHTX2CrtfRXklJeZpuFwObsEWGqAIzjLHLJZhkb5bSugoi4nB5MhifA+AjL6wkJKmD 5VaXnKtoFDpPu/JT9uwTUhNtI/smQGvznqfc48cBLWXN7cTAj5209enve1/I2fuR0AQ4 JoFw== X-Received: by 10.68.138.229 with SMTP id qt5mr21481626pbb.122.1355947070341; Wed, 19 Dec 2012 11:57:50 -0800 (PST) Received: from [10.192.166.0] (stargate.chelsio.com. [67.207.112.58]) by mx.google.com with ESMTPS id l5sm3937876paz.14.2012.12.19.11.57.48 (version=SSLv3 cipher=OTHER); Wed, 19 Dec 2012 11:57:49 -0800 (PST) Message-ID: <50D21C3B.8020803@gmail.com> Date: Wed, 19 Dec 2012 11:57:47 -0800 From: Navdeep Parhar User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Vijay Singh Subject: Re: use of V_tcbinfo lock for TCP syncache References: <50D218BA.7080301@FreeBSD.org> In-Reply-To: <50D218BA.7080301@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 20:05:09 -0000 On 12/19/12 11:42, Navdeep Parhar wrote: > On 12/19/12 11:31, Vijay Singh wrote: >> As it is today, a socket upcall on a listener socket is made with the >> V_tcbinfo lock held. [tcp_input -> syncache_socket -> sonewconn -> >> sowakeup]. >> >> I feel that the use of the V_tcbinfo is not consistent in the syncache code. >> >> In syncache_add(), we drop the lock before doing the lookup: >> >> INP_WUNLOCK(inp); >> INP_INFO_WUNLOCK(&V_tcbinfo); >> [..snip..] >> sc = syncache_lookup(inc, &sch); /* returns locked entry */ >> >> However, when going through syncache_expand() or syncache_chkrst() we >> keep the V_tcbinfo lock. >> >> Since the syncache has its own lock, do we need to hold the V_tcbinfo >> lock when calling syncache_socket()? > > 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... :-)