From owner-freebsd-net@FreeBSD.ORG Thu Jan 17 19:04:56 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 357E8A42 for ; Thu, 17 Jan 2013 19:04:56 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by mx1.freebsd.org (Postfix) with ESMTP id B5AABAC5 for ; Thu, 17 Jan 2013 19:04:54 +0000 (UTC) Received: by mail-wi0-f182.google.com with SMTP id hn14so2525570wib.3 for ; Thu, 17 Jan 2013 11:04:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=t8ZCjdr7t4lgl+hfKwlMsNTwEdcQcLENKwk2MgsTo2Y=; b=xljRuaKAFcEe6N56WTrNX6ighiXsgfBpvTIiEVmF78j1Yusicvt2uFnlq3nWxHPa0l 2DaBu2wvkn3EQIdxhkV1WdEShURfjWmLNavCLMkTXiY+Kjw/DwIWBfWJjtZxTDYTFH2F rANEUPddUMB7hUD90k5i4/pkyekNmKKFjLfnI5ftQnfGDKKf7IoysHv2sp4gJ8T23h2U HwgJrIM9J3XN7VDZJekOsSDEORDCi203EzF2yn7SfePYxcVXmrl5zy4Pzly35qOJvE4X JGNa95aiL0LgZLYxtvtzi52+bm5HBcXHBrtHG06ZIja/X74IjDk8gS0ahDyEmmXiCoZN 1rPQ== MIME-Version: 1.0 X-Received: by 10.195.13.67 with SMTP id ew3mr10213585wjd.59.1358449493378; Thu, 17 Jan 2013 11:04:53 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.217.57.9 with HTTP; Thu, 17 Jan 2013 11:04:53 -0800 (PST) In-Reply-To: <20130117174427.GA65218@onelab2.iet.unipi.it> References: <20130117025502.GA57613@onelab2.iet.unipi.it> <1358438932.56236.YahooMailClassic@web121601.mail.ne1.yahoo.com> <20130117174427.GA65218@onelab2.iet.unipi.it> Date: Thu, 17 Jan 2013 11:04:53 -0800 X-Google-Sender-Auth: 7OQ-tHf77zbpNU_ihzw_UQRqCcQ Message-ID: Subject: Re: two problems in dev/e1000/if_lem.c::lem_handle_rxtx() From: Adrian Chadd To: Luigi Rizzo Content-Type: text/plain; charset=ISO-8859-1 Cc: Barney Cordoba , freebsd-net@freebsd.org 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: Thu, 17 Jan 2013 19:04:56 -0000 On 17 January 2013 09:44, Luigi Rizzo wrote: > (in the "lem" driver this cannot happen until you release some > rx slots, which only happens once at the end of the lem_rxeof() routine, > not long before re-enabling interrupts) Right. >> * .. and the hardware immediately sends you the MSI or signals an interrupt; >> * .. thus you re-enter the RX processing thread almost(!) immediately. > > the problem i was actually seeing are slightly different, namely: > - once the driver lags behind, it does not have a chance to recover > even if there are CPU cycles available, because both interrupt > rate and packets per interrupt are capped. Right, but the interrupt isn't being continuously asserted whilst there are packets there. You just get a single interrupt when the queue has frames in it, and you won't get a further interrupt for whatever the mitigation period is (or ever, if you fill up the RX FIFO, right?) > - much worse, once the input stream stops, you have a huge backlog that > is not drained. And if, say, you try to ping the machine, > the incoming packet is behind another 3900 packets, so the first > interrupt drains 100 (but not the ping request, so no response), > you keep going for a while, eventually the external world sees the > machine as not responding and stops even trying to talk to it. Right, so you do need to do what you're doing - but I still think there's a possibility of a race there. Namely that your queue servicing does reach the end of the list (and so you don't immediately reschedule the taskqueue) but some more frames have arrived. You have to wait for the next mitigated interrupt for that. Adrian