From owner-freebsd-net@FreeBSD.ORG Wed Dec 19 19:31: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 1D160D91 for ; Wed, 19 Dec 2012 19:31:09 +0000 (UTC) (envelope-from vijju.singh@gmail.com) Received: from mail-ee0-f44.google.com (mail-ee0-f44.google.com [74.125.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id A00058FC19 for ; Wed, 19 Dec 2012 19:31:08 +0000 (UTC) Received: by mail-ee0-f44.google.com with SMTP id b47so1300940eek.3 for ; Wed, 19 Dec 2012 11:31:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=ob/8k7y7hP5FYMvP6T8lGlt2LPE7WAU+XEePvv41PyY=; b=oqcgyHJFvGOPd64nGDfHAWbkir4YFjbP0B+0yBdIjZuoJgr5OHVWkGNdY/UJryXbWX OTmb8hOZZY0TmOMxNkGY5zIWbcRI63CzEXra2UJ1AKoIej0qm7sYGPJ5cDCvhc7XiSuB WpYZW7xEiW2mQW+FPC3d+6KNkQ9KjJCwxk+sg+UgbsA2iZqqDmdlE/ujQRTqZ/C0pAH3 0F8YUDpxVVgg+6aLomKtv2lMrVksH9CnDd4BOys8Yvmt4Jcj/K60sEAhp55gmbiQ/Hoi RV+nFwkCFbO18uhSiUl9g6lVIxq/uQvabh2liZuBElut9ItH777yP6icClTi2bSdDsXT 1u2g== MIME-Version: 1.0 Received: by 10.14.223.135 with SMTP id v7mr16466273eep.41.1355945462071; Wed, 19 Dec 2012 11:31:02 -0800 (PST) Received: by 10.223.101.77 with HTTP; Wed, 19 Dec 2012 11:31:01 -0800 (PST) Date: Wed, 19 Dec 2012 11:31:01 -0800 Message-ID: Subject: use of V_tcbinfo lock for TCP syncache From: Vijay Singh To: freebsd-net@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 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 19:31:09 -0000 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()? If there are ideas, or patches, I can give them a try. -vijay