From owner-freebsd-hackers@FreeBSD.ORG Tue May 29 20:20:17 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 69202106564A for ; Tue, 29 May 2012 20:20:17 +0000 (UTC) (envelope-from vasanth.raonaik@gmail.com) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id EB83D8FC0A for ; Tue, 29 May 2012 20:20:16 +0000 (UTC) Received: by werg1 with SMTP id g1so3742911wer.13 for ; Tue, 29 May 2012 13:20:10 -0700 (PDT) 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 :content-type; bh=uOniq/MIOqgLAJhwVD47uqCiDCy87Xa8pO80D7lEc+g=; b=QOQOhAPRBrktsbWUAsOLOcIXkCW9/FzEL3wEVvUqwOgteyhUNK2fdSI52njxWucJ9q C8enSwO9Z5AwW9aORqgYIqw36aQpVg4wT36//ylKS7zbHqNST7INK4r8IRXWbd6j5AT1 B9+xbC+9CPj77jY8w5x+ths+7RIPqgYyyItVBzi/+NVTDcq27CoXIn8QaTInOtWDKIaJ 2G8ZRMGXH5uf+jcQdt0P0ssXJWecslWZvW+UgV8oUzZ3eI1sdnDX4+kafSx9dJersx7U Io1DHF0Ji2zSP3FTtli6xPCMZ8rWyYgSIz6j1hmuWtCwuNewvqVNhY0xt+65wjG/Q6pw NL9Q== MIME-Version: 1.0 Received: by 10.216.206.164 with SMTP id l36mr8406567weo.154.1338322809905; Tue, 29 May 2012 13:20:09 -0700 (PDT) Received: by 10.180.146.37 with HTTP; Tue, 29 May 2012 13:20:09 -0700 (PDT) In-Reply-To: References: Date: Tue, 29 May 2012 16:20:09 -0400 Message-ID: From: vasanth rao naik sabavat To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Re: SMP: protocol control block protection for a multithreaded process (ex: udp). X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2012 20:20:17 -0000 Can somebody please reply to this email. basically, can udp_detach() and udp_send() execute simultaneously for a process with multiple threads? if yes, then inp reference in udp_send() will be stale if udp_detach() free's the inp? Thanks, Vasanth On Tue, May 29, 2012 at 10:53 AM, vasanth rao naik sabavat < vasanth.raonaik@gmail.com> wrote: > Hi, > > In case of a Multicore cpu system running a multithreaded process. > > For protocol control blocks there is no protection provided in the FreeBSD > 9. For example, udp_close() and udp_send() access the inp before taking the > lock. Couldn't this cause the inp inconsistency on a multithreaded process > running on multicore cpu system? > > Say, If the two threads of a process are concurrently executing socket > send and socket close say on a udp connection (this can happen in case of > poorly written user code.). > udp_close() will access the inp on one cpu and udp_send() will access the > inp on another cpu. it is possible that udp_close() gets the locks first > and free's the inp before udp_send() has a chance to run? > > Am I missing anything? > > Thanks, > Vasanth > > > > >