From owner-freebsd-net@FreeBSD.ORG Fri Mar 11 14:28:13 2005 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 396AB16A4D0; Fri, 11 Mar 2005 14:28:13 +0000 (GMT) Received: from relay.bestcom.ru (relay.bestcom.ru [217.72.144.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2D2FD43D5A; Fri, 11 Mar 2005 14:28:12 +0000 (GMT) (envelope-from glebius@FreeBSD.org) Received: from cell.sick.ru (root@cell.sick.ru [217.72.144.68]) by relay.bestcom.ru (8.13.1/8.12.9) with ESMTP id j2BES76J089634 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 11 Mar 2005 17:28:07 +0300 (MSK) (envelope-from glebius@FreeBSD.org) Received: from cell.sick.ru (glebius@localhost [127.0.0.1]) by cell.sick.ru (8.13.1/8.12.8) with ESMTP id j2BES5Dw089079 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 11 Mar 2005 17:28:06 +0300 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.sick.ru (8.13.1/8.13.1/Submit) id j2BES5gh089078; Fri, 11 Mar 2005 17:28:05 +0300 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.sick.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Fri, 11 Mar 2005 17:28:05 +0300 From: Gleb Smirnoff To: Pawel Jakub Dawidek Message-ID: <20050311142805.GB88801@cell.sick.ru> References: <20050311110234.GA87255@cell.sick.ru> <20050311141450.GF9291@darkness.comp.waw.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20050311141450.GF9291@darkness.comp.waw.pl> User-Agent: Mutt/1.5.6i X-Virus-Scanned: ClamAV version devel-20050125, clamav-milter version 0.80ff on relay.bestcom.ru X-Virus-Status: Clean cc: dima <_pppp@mail.ru> cc: John Baldwin cc: Luigi Rizzo cc: rwatson@FreeBSD.org cc: net@FreeBSD.org cc: ru@FreeBSD.org Subject: Re: Giant-free polling [PATCH] X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Mar 2005 14:28:13 -0000 On Fri, Mar 11, 2005 at 03:14:50PM +0100, Pawel Jakub Dawidek wrote: P> On Fri, Mar 11, 2005 at 04:55:25PM +0300, dima wrote: P> +> I thought about using list also, but considered it to bring P> +> too much overhead to the code. The original idea of handling arrays P> +> seems to be very elegant. P> P> Overhead? Did you run any benchmarks to prove it? P> I find list-version much more elegant that using an array. It is also a small cookie for future. Now we have IFF_POLLING flag and IFCAP_POLLING, which indicate whether interface support polling and whether it actually does polling. This is not nice, from my viewpoint. I'd like to see only IFCAP_POLLING present and turning polling on/off for particular interface should be done by inserting/removing iface from polling list. This will also remove an extra unlocked check of interface flags (?). P> I also don't like the idea of calling handler method with two locks P> held (one sx and one mutex)... I agree with Pawel. We have LOR here between sx lock and driver lock: normal polling: (get sx shared) -> (get driver mutex) driver stop: (get driver mutex) -> (get sx exclusive) We will have deadlock if this two things process in parallel. And the per-interface mutex protects only reentrancy of interface poll method, is that right? P> There is still an unresolved problem (in your and our patch as well) of P> using ifnet structure fields without synchronization, as we don't have P> access tointerface's internal mutex, which protects those fields. This is unresolved in our patch, too, and I believe throughout many other places in kernel. -- Totus tuus, Glebius. GLEBIUS-RIPN GLEB-RIPE