From owner-freebsd-transport@freebsd.org Wed Jul 20 19:00:52 2016 Return-Path: Delivered-To: freebsd-transport@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AAF7AB9F56E for ; Wed, 20 Jul 2016 19:00:52 +0000 (UTC) (envelope-from gallatin@netflix.com) Received: from mail-it0-x229.google.com (mail-it0-x229.google.com [IPv6:2607:f8b0:4001:c0b::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 767B5105A for ; Wed, 20 Jul 2016 19:00:52 +0000 (UTC) (envelope-from gallatin@netflix.com) Received: by mail-it0-x229.google.com with SMTP id j124so59224613ith.1 for ; Wed, 20 Jul 2016 12:00:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netflix.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=wPyr2t3wYDveshK11H2cClRAPtxuumW187ON3kdfVck=; b=GUOtjcqascREHrPH/2O0XEWPZsqxKd2unSgGFl6+lsspxX6kQdC5kJ2Dy6djQC/rMd iG0stLaiPQfcQGzIt1UUDlZYLJrWgiRAswKwnktUfm7Hw0KnEKWKl/43yWAyKOSJpixe T1EFaWTRucs3Jf0rhnYsI9GLo5HgnBBfZYKGA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=wPyr2t3wYDveshK11H2cClRAPtxuumW187ON3kdfVck=; b=Y3/QMRPUc5Z71wMpjWexeqkEd+cEQCFrUaN4zpm7+WPmOVWxQYlxM3W7sFdi5O0kt9 IDJeo4RWkQw9LQnM4DeAeUjolcDnvAEf6P1VNZHV8/grRyJU2klDM87s7i6D6W5edxXS Maht+CnvHSXJMRoJxJmtMHRNXd1ZXkrVGFE8K9PB+A7O/pkQJo8bP97r+jDfG6Ggz64C nj7rni9Tr3CnzYs6U6y6ijd5eNxnqrJcbMfXcWcpt/4d7oobvsoeYEC9ZBEBey05vgQt 2DK5E2ddkLEDJ3Rd5b78AMpp/CEZeVJQV94BbFusUqq+/yuUEBIQpwwJ/i0V5s+1UIyZ l58g== X-Gm-Message-State: ALyK8tLYAsl1ccKSlKF01ZZbmxMEJ80V9uW8fKYFtWClNGsbTEUY1YQXAeFsfM4u3quDTe9RYy0/MGLpSyBqsrxZ X-Received: by 10.36.19.16 with SMTP id 16mr63155577itz.41.1469041251871; Wed, 20 Jul 2016 12:00:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.64.41.163 with HTTP; Wed, 20 Jul 2016 12:00:51 -0700 (PDT) In-Reply-To: References: From: Drew Gallatin Date: Wed, 20 Jul 2016 15:00:51 -0400 Message-ID: Subject: Re: in_broadcast() called for almost every packet in ip_output() To: Ryan Stone Cc: freebsd-transport@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: freebsd-transport@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Discussions of transport level network protocols in FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jul 2016 19:00:52 -0000 I'd certainly prefer not to add any overhead. Properly managing this (and other similar) lists is a job for some lightweight lifecycle based mechanism like concurrency kit or rcu. Unless you have a solid reason to fix it, I'd suggest just adding the locking commented out (the way rwatson did with IN_IFADDR_RLOCK in ip_input(), so that the next person to trip over it will know what's going on. Drew On Wed, Jul 20, 2016 at 1:29 PM, Ryan Stone wrote: > I've hit a dilemma in a fix I have in review[1]. Currently, in_broadcast() > iterates over the ifnet address list without holding any locks. I can > pretty easily panic the kernel by constantly adding and removing addresses > while passing traffic over the interface. The fix is to acquire the > appropriate rlock, but the catch is that according to dtrace, > in_broadcast() is called on almost every packet that passes through > ip_output(). I'm concerned about adding additional locking operations to > the transmit path. > > Do we actually need to call in_broadcast() so often? It seems silly to > check whether we are sending to a broadcast address on a per-packet basis. > > > [1] https://reviews.freebsd.org/D7227 > _______________________________________________ > freebsd-transport@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-transport > To unsubscribe, send any mail to " > freebsd-transport-unsubscribe@freebsd.org" >