From owner-cvs-all@FreeBSD.ORG Mon Sep 5 18:00:53 2005 Return-Path: X-Original-To: cvs-all@FreeBSD.org Delivered-To: cvs-all@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A39D516A41F; Mon, 5 Sep 2005 18:00:53 +0000 (GMT) (envelope-from glebius@FreeBSD.org) Received: from cell.sick.ru (cell.sick.ru [217.72.144.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9DD5843D48; Mon, 5 Sep 2005 18:00:52 +0000 (GMT) (envelope-from glebius@FreeBSD.org) Received: from cell.sick.ru (glebius@localhost [127.0.0.1]) by cell.sick.ru (8.13.3/8.13.3) with ESMTP id j85I0oX4042523 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 5 Sep 2005 22:00:51 +0400 (MSD) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.sick.ru (8.13.3/8.13.1/Submit) id j85I0ohO042522; Mon, 5 Sep 2005 22:00:50 +0400 (MSD) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.sick.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Mon, 5 Sep 2005 22:00:50 +0400 From: Gleb Smirnoff To: Luigi Rizzo Message-ID: <20050905180050.GB41863@cell.sick.ru> References: <200509051602.j85G2Bpo090258@repoman.freebsd.org> <20050905094341.A23343@xorpc.icir.org> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20050905094341.A23343@xorpc.icir.org> User-Agent: Mutt/1.5.6i Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/kern kern_poll.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Sep 2005 18:00:53 -0000 On Mon, Sep 05, 2005 at 09:43:41AM -0700, Luigi Rizzo wrote: L> gleb, could you document how you are using the PRF_RUNNING L> and PRF_LEAVING flags that you added ? Ok, I will. Tomorrow or today. L> also i am unclear on whether there is a race condition involving L> unregistering poll (second part of netisr_poll()) L> while running the section of ether_poll() where it drops L> the mutex before calling the handler. L> L> ether_poll signals its activity with PRF_RUNNING, but L> netisr_poll() does not check it, so it might happen that L> L> 1. on one CPU, ether_poll() drops the lock before calling L> pr[i].handler(), perhaps even getting descheduled L> L> 2. on another CPU, netisr_poll() gets the lock and goes L> all the way to the end, setting pr[i].handler = NULL L> L> 3. on the first CPU, without further checks, the code L> tries to dereference the field. Yes, the race is possible and known to me, though I haven't triggered it. To fix it the plan is to turn polling off/on functionally, not on the next tick or on next interrupt. This idea has already been implemented in DragonFlyBSD. Since the race is not runtime one, and requires idle_poll to be enabled, which is not default setting, we can live with it. L> Also, what is the overall design - do you want to support multiple polling L> loops running concurrently (netisr_poll, one poll_idle per CPU, L> and possibly the poll_in_trap) ? The aim was to remove Giant from polling. When the polling was enabled we got a half-Giant-locked network stack - the receive part was all running with Giant. This does not fit into SMPng design and our statement that with debug.mpsafenet=1 the Giant is not used in network stack. With current design really we get a very small parallelizm in three threads: netisr, idlepoll, trap. This was not the main aim. The future plans have been described by Robert in his mail. -- Totus tuus, Glebius. GLEBIUS-RIPN GLEB-RIPE