From owner-freebsd-hackers@FreeBSD.ORG Tue May 11 17:11:26 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A20C31065673 for ; Tue, 11 May 2010 17:11:26 +0000 (UTC) (envelope-from patfbsd@davenulle.org) Received: from smtp.lamaiziere.net (net.lamaiziere.net [91.121.44.19]) by mx1.freebsd.org (Postfix) with ESMTP id 6780F8FC16 for ; Tue, 11 May 2010 17:11:26 +0000 (UTC) Received: from baby-jane.lamaiziere.net (unknown [192.168.1.10]) by smtp.lamaiziere.net (Postfix) with ESMTP id D6D3C63307D; Tue, 11 May 2010 19:11:24 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by baby-jane.lamaiziere.net (Postfix) with ESMTP id 6F52A2CEE1D; Tue, 11 May 2010 19:11:41 +0200 (CEST) Date: Tue, 11 May 2010 19:11:40 +0200 From: Patrick Lamaiziere To: Sam Leffler Message-ID: <20100511191140.2111cc70@davenulle.org> In-Reply-To: References: <4BE46650.7010008@bluezbox.com> <20100510001637.2a564cd5@davenulle.org> X-Mailer: Claws Mail 3.7.5 (GTK+ 2.18.7; i386-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Cc: freebsd-hackers@freebsd.org Subject: Re: hifn(4) DMA fix for review X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 May 2010 17:11:26 -0000 Le Mon, 10 May 2010 08:26:08 -0700, Sam Leffler a écrit : Hello, > > I noticed several things in hifn, if you want to look: > > http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/130286 > > > > IMHO some locks are missing in the use of sc->sc_sessions (the array > > containing the sessions) : in hifn_newsession(), if there is no > > space left in sc->sc_sessions, a new array is allocated and the > > sessions are copied to it. Unfortunaly, sc->sc_sessions is used in > > hifn_process without any lock and we use some pointers on the array > > (my patch should > > addresses this if I remember...). > > Isn't this just the glx locking? (no offense intended) I've said > before I think we to move session management up into the crypto > layer since it's implemented in many drivers (usually w/ c&p of the > same code as you noted here sometimes a bit different). Yes, the code comes mostly from padlock and glxsb. glxsb and padlock use a TAILQ to store the sessions instead of an array. It is better when we want to add or remove a session but we have to search the session each time when processing the operation. In hifn, the session id (sid) is directly the index so it should be more efficient. I'm not sure if this is a concern or not. Regards.