From owner-freebsd-current@FreeBSD.ORG Thu Nov 6 17:27:29 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3323F16A4CE; Thu, 6 Nov 2003 17:27:29 -0800 (PST) Received: from oslonett.no (imail.oslonett.no [194.234.215.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1DBF043FBF; Thu, 6 Nov 2003 17:27:27 -0800 (PST) (envelope-from mail@morten-johansen.net) Received: from morten-johansen.net [213.234.113.122] by oslonett.no with ESMTP (SMTPD32-8.01) id A4FBB0B0046; Fri, 07 Nov 2003 02:27:23 +0100 Message-ID: <3FAAF50B.9030105@morten-johansen.net> Date: Fri, 07 Nov 2003 02:27:39 +0100 From: Morten Johansen User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.4) Gecko/20030817 X-Accept-Language: no, nb, en-us, en MIME-Version: 1.0 To: Scott Long References: <3FA966B2.9040704@morten-johansen.net> <20031105202947.A43448@pooker.samsco.home> <3FAA2CEB.6000403@morten-johansen.net> In-Reply-To: <3FAA2CEB.6000403@morten-johansen.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Declude-Sender: mail@morten-johansen.net [213.234.113.122] X-Declude-Spoolname: Df4fb0b0b0046bab0.SMD X-Note: This E-mail was scanned by Declude JunkMail (www.declude.com) for spam. cc: freebsd-current@freebsd.org Subject: Re: the PS/2 mouse problem X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Nov 2003 01:27:29 -0000 Morten Johansen wrote: > Scott Long wrote: > >> One thought that I had was to make psmintr() be INTR_FAST. I need to >> stare at the code some more to fully understand it, but it looks like it >> wouldn't be all that hard to do. Basically just use the interrupt >> handler >> to pull all of the data out of the hardware and into a ring buffer in >> memory, and then a fast taskqueue to process that ring buffer. It would >> at least answer the question of whether the observed problems are due to >> ithread latency. And if done right, no locks would be needed in >> psmintr(). >> >> Scott > > > > I can reproduce the problem consistently on my machine, by moving the > mouse around, while executing e.g this command in a xterm: > > dd if=/dev/zero of=test bs=32768 count=4000; sync; sync; sync > > when the sync'ing sets in the mouse attacks. > It is very likely due to interrupt latency. > > I'd be happy to test any clever patches. > > > Morten > > Wow. You are completly right! By using a MTX_SPIN mutex instead, and marking the interrupt handler INTR_MPSAFE | INTR_FAST, my problem goes away. I am no longer able to reproduce the mouse attack. I have not noticed any side-effects of this. Could there be any? I will file a PR with an updated patch, unless you think it's a better idea to rearrange the driver. Probably the locking could be done better anyway. Morten