From owner-freebsd-net@FreeBSD.ORG Sun Apr 8 09:39:32 2007 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0354A16A404 for ; Sun, 8 Apr 2007 09:39:32 +0000 (UTC) (envelope-from wawa@yandex-team.ru) Received: from cmail.yandex.ru (cmail.yandex.ru [213.180.193.1]) by mx1.freebsd.org (Postfix) with ESMTP id 7DAF113C45B for ; Sun, 8 Apr 2007 09:39:31 +0000 (UTC) (envelope-from wawa@yandex-team.ru) Received: from [87.250.227.254] (v3-227-254.yandex.net [87.250.227.254]) by cmail.yandex.ru (8.13.8/8.13.8) with ESMTP id l389dREX088343; Sun, 8 Apr 2007 13:39:28 +0400 (MSD) (envelope-from wawa@yandex-team.ru) Message-ID: <4618B84C.5010208@yandex-team.ru> Date: Sun, 08 Apr 2007 13:39:24 +0400 From: Vladimir Ivanov User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.13) Gecko/20060717 Debian/1.7.13-0.2ubuntu1 X-Accept-Language: en MIME-Version: 1.0 To: Bruce Evans References: <461549BD.1020800@yandex-team.ru> <20070406121505.T43678@delplex.bde.org> In-Reply-To: <20070406121505.T43678@delplex.bde.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Ystatus: hits=-1015.0 SUBJ_RE __HAS_REFERENCES ALLTRUSTEDIP QUOTED_EMAIL_TEXT EMAIL_ATTRIBUTION CONTINUOUS_LETTERS_7 LV_YOU_CAN LV_FREE SP_HTTP_URI NEWBAYES_099 __MESS_NO_BODY SH_6_1111 WB_6_D_E SH_6_500 WB_6_B_E LINK_IN_TEXT __IMAGE__LINK SPF_PASS REPLY_WITH_QUOTES ORIGINAL_WITH_QUOTES DL_DLWC_15 REFERENCES IN_REP_TO DL_DLWC_IN_REP_TO X-Spam-Flag: NO X-Spam-Yversion: Spamooborona 1.7.0-nda Cc: freebsd-net@freebsd.org Subject: Re: Serious bug in most (?) ethernet drivers (bge, bce, ixgb etc.). X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Apr 2007 09:39:32 -0000 Bruce Evans wrote: > On Thu, 5 Apr 2007, Vladimir Ivanov wrote: > >> We have reported serious bug with em driver >> (http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/87418) one year and >> half ago. >> It's very funny but most freebsd ethernet drivers cloned this bug I >> seem. >> You can see same bug in bce, bge, ixgb and so on. > > > I can only see it in bce and ixgb. bge is much simpler and better -- Yes, you're right. I was too pessimistic. Thank you a lot. I'll resend the bce patch to David. > bge_rxeof() doesn't depend on any state after the unlock/re-lock except > the rx indexes, and these are both reset to 0 by reinitialization. > > However, reinitialization often panics bge_rxeof() anyway. The only > reasons for the panics that I can think of is that nothing is declared > volatile but the producer index is extremely volatile, so the following > races are possible: > - compiler caching the indexes. bce implements this as foot-shooting. > I think aliasing problems prevent the compiler doing it, so declaring > things as volatile would make no difference. > - a race with the hardware in initialzation might result in the producer > index being nonzero and for old data despite it having been reset to 0 > and no new data arriving. Stopping the hardware for initialization > should prevent such races. > > Bruce