From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 20 22:50:20 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2B4EE16A415 for ; Fri, 20 Oct 2006 22:50:20 +0000 (UTC) (envelope-from usleepless@gmail.com) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.169]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5088343D4C for ; Fri, 20 Oct 2006 22:50:14 +0000 (GMT) (envelope-from usleepless@gmail.com) Received: by ug-out-1314.google.com with SMTP id k3so424913ugf for ; Fri, 20 Oct 2006 15:50:13 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=cicHfpwjY39L6VxEW6ymcbr6aYyA10FU8LyH0E/TjceT2Nb2YlJ1MSmhE5O73kq18QTIrphA6mZWzY/CqcQJsxgxo8+ciAYjY5B7+ydvmGwkptxefbetdSCiKmvrf+xqXQQJYzaAYCAuIJ/aIciAGKjCVMLAQuXVLIB6ddioykc= Received: by 10.78.203.15 with SMTP id a15mr2893039hug; Fri, 20 Oct 2006 15:50:12 -0700 (PDT) Received: by 10.78.124.8 with HTTP; Fri, 20 Oct 2006 15:50:12 -0700 (PDT) Message-ID: Date: Sat, 21 Oct 2006 00:50:12 +0200 From: usleepless@gmail.com To: "John-Mark Gurney" , usleepless@gmail.com, freebsd-hackers@freebsd.org In-Reply-To: <20061020213453.GR23971@funkthat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20061020213453.GR23971@funkthat.com> Cc: Subject: Re: Fwd: Removing Giant from a driver 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: Fri, 20 Oct 2006 22:50:20 -0000 Dear John-Mark, > > what should it look like? > > You should be creating a mutex (using mtx_init) at attach time, and > pass that mutex instead of Giant... and don't touch busdma_lock_mutex? ( i am passing NULL, NULL at the moment ) > > and how will i prevent the interrupt routine from interfering with > > userland operations? can i place a "mtx_lock()" call in the interrupt > > routine? > > Correct.... Fast interrupt handlers cannot use a sleeping mutex, but > I doubt this driver is using a fast interrupt handler... what is the benefit of a fast interrupt handler? ( i assume a taskqueue is involved ). the interrupt-dma-code of this driver includes tsleep-calls. does that hurt? i have a shared intterupt with the second tuner-module and my soundcard. i ask because the performance on my FBSD 6.x, P4 2.4ghz, 1 card, 2 tuners setup dissapoints me compared to my 4.11, P3 1.0ghz(!), 2 cards, 4 tuners setup. the 4.11 machine is headless, the 6.x machine has 2 lcds through 1 ati-radeon. it is on the 6.x machine i try to run mythfrontend and use the card at the same time. i can imagine this is very complex: the 6.x machine is dealing with: - capturing video ( using this driver ) - running mythfrontend ( driving XVideo and OSS ) - mythbackend reading from the cxm device, and writing to a NFS-share this driver is generating about 1 megabyte per second. the 4.11 machine is handling 4 x 1 megabyte per second just fine writing it to disk, and doing other stuff ( apache, postgresql, hylafax, firewall, natd, nfs-server, mythbackends ). > > is there a howto somewhere? > > There are man pages on how to use the various locking primitives, but > it is assumed that you have knowlege of concurrent programming... i have, i know mutexes, semaphores, critical sections etc. heck, i implemented 32-bits threading for watson-c on w3.11 once. i have read http://www.freebsd.org/projects/busdma/ - this driver uses the busdma framework - i have registered the interrupt INTR_MPSAFE - SMPng locked: i have employed a mutex instead of spltty() - p!=a safety: i don't think this is relevant right now but i lack the connection with the freebsd-kernel. for example: i don't understand what Giant is good for. i can imagine Giant is important for a network-interface-driver because of the framework. but what does the cxm driver has to do with it? is transforming this driver to use fast-interrupts worthwhile? ( like the if-em driver ) > You can take a look at books on pthreads and other related > matierals for info on using locks... > > If you figure out the licensing issues w/ the firmware, I'll import > the driver into FreeBSD... i suppose that will never happen: - hauppauge firmware is needed - i used GPLed linux/v4l2 headers and sourefiles to make the pvr150s/500s work thank you for your time, regards, usleep