From owner-freebsd-net@FreeBSD.ORG Wed Jan 16 05:43:57 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 9645DE12 for ; Wed, 16 Jan 2013 05:43:57 +0000 (UTC) (envelope-from jfvogel@gmail.com) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx1.freebsd.org (Postfix) with ESMTP id 42F1A99E for ; Wed, 16 Jan 2013 05:43:56 +0000 (UTC) Received: by mail-vc0-f177.google.com with SMTP id fo14so730301vcb.36 for ; Tue, 15 Jan 2013 21:43:54 -0800 (PST) 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 :cc:content-type; bh=6YuEv5Hy9TZqSuti1FqHGAl76UkjOn4GKP2vQR9deyo=; b=v+mqkTtY1qyyD5iW3wmPTUL9tNR0ZvcOkA+1uaY8Qf1uiJhyUDLpJG5aeplfVyLapy +CHUDefcZ7AHVp5tvvDeuMJq2LwCiMeYwHbh3wpzgmgMU/Mz/6wwaejSbX77wQ/tjr2U C6hjm/7PazD6vFiG+0hLvb+yFYbqAeChgJuZoO78Vc4Ziyb6jSI6cUEF8F0dI4bQBZ7V JF6U/2Pj65nTCajIwUzpxIC02pLPIBn85qMVqY56GLWGMwcLcsarlLxRr/P1dYAoQe+6 fYIEf8hZzOtaxu8t6Am2ts6V0WczobbSMHXyahwd0hIwCrWNSGlOVrdqUfNwYBj0tjSr CSZg== MIME-Version: 1.0 Received: by 10.221.11.205 with SMTP id pf13mr106604185vcb.70.1358315034769; Tue, 15 Jan 2013 21:43:54 -0800 (PST) Received: by 10.220.50.6 with HTTP; Tue, 15 Jan 2013 21:43:54 -0800 (PST) In-Reply-To: References: Date: Tue, 15 Jan 2013 21:43:54 -0800 Message-ID: Subject: Re: two problems in dev/e1000/if_lem.c::lem_handle_rxtx() From: Jack Vogel To: Luigi Rizzo Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: "freebsd-net@freebsd.org" , head@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: Wed, 16 Jan 2013 05:43:57 -0000 OK, will look at this as soon as I can. Jack On Tue, Jan 15, 2013 at 5:23 PM, Luigi Rizzo wrote: > Hi, > i found a couple of problems in > dev/e1000/if_lem.c::lem_handle_rxtx() , > (compare with dev/e1000/if_em.c::em_handle_que() for better understanding): > > 1. in if_em.c::em_handle_que(), when em_rxeof() exceeds the > rx_process_limit, the task is rescheduled so it can complete the work. > Conversely, in if_lem.c::lem_handle_rxtx() the lem_rxeof() is > only run once, and if there are more pending packets the only > chance to drain them is to receive (many) more interrupts. > > This is a relatively serious problem, because the receiver has > a hard time recovering. > > I'd like to commit a fix to this same as it is done in e1000. > > 2. in if_em.c::em_handle_que(), interrupts are reenabled unconditionally, > whereas lem_handle_rxtx() only enables them if IFF_DRV_RUNNING is set. > > I cannot really tell what is the correct way here, so I'd like > to put a comment there unless there is a good suggestion on > what to do. > > Accesses to the intr register are race-prone anyways > (disabled in fastintr, enabled in the rxtx task without > holding any lock, and generally accessed under EM_CORE_LOCK > in other places), and presumably enabling/disabling the > interrupts around activations of the taks is just an > optimization (and on a VM, it is actually a pessimization > due to the huge cost of VM exits). > > cheers > luigi >