From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 6 06:36:41 2005 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 2DDCE16A41C for ; Mon, 6 Jun 2005 06:36:41 +0000 (GMT) (envelope-from NKoch@demig.de) Received: from server.absolute-media.de (server.absolute-media.de [213.239.231.9]) by mx1.FreeBSD.org (Postfix) with ESMTP id BFA2243D49 for ; Mon, 6 Jun 2005 06:36:40 +0000 (GMT) (envelope-from NKoch@demig.de) Received: from localhost (unknown [127.0.0.1]) by server.absolute-media.de (Postfix) with ESMTP id 1C83D7F3DC; Mon, 6 Jun 2005 08:36:38 +0200 (CEST) Received: from server.absolute-media.de ([127.0.0.1]) by localhost (server [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 03897-05; Mon, 6 Jun 2005 08:36:33 +0200 (CEST) Received: from firewall.demig (p50839338.dip0.t-ipconnect.de [80.131.147.56]) by server.absolute-media.de (Postfix) with ESMTP id 25BCB7F350; Mon, 6 Jun 2005 08:36:33 +0200 (CEST) Received: from ws-ew-3 (ws-ew-3.w2kdemig [192.168.1.72]) by firewall.demig (8.13.4/8.13.1) with SMTP id j566YUBB018102; Mon, 6 Jun 2005 08:34:37 +0200 (CEST) (envelope-from NKoch@demig.de) From: "Norbert Koch" To: "Maksim Yevmenkin" Date: Mon, 6 Jun 2005 08:34:37 +0200 Message-ID: <008001c56a61$cf92bf00$4801a8c0@ws-ew-3.W2KDEMIG> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2120.0 In-Reply-To: <42A090DE.8060002@savvis.net> X-Virus-Scanned: by amavisd-new X-Virus-Scanned: by amavisd-new at absolute-media.de Cc: "Freebsd-Hackers@Freebsd. Org" Subject: RE: synchronization question about /sys/dev/vkbd/vkbd.c 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: Mon, 06 Jun 2005 06:36:41 -0000 > > My question is: > > Is it not possible, that vkbd_dev_intr() could be > > interrupted at any position before the VKBD_LOCK() > > and then vkbd_dev_write() called? > > in theory it is possible. > > > If yes, how should vkbd_dev_write() know, that it should > > call task_enqueue(), as TASK is still set? > > well, i guess it is possible to miss interrupt in this case. also, the > scancodes are not lost, they will be processed on next write. > I agree, that it is hardly possible to miss an interrupt, as keys come in so slowly. But that also means if it happens, you will notice it, because you have to press an additional key. > i suspect that the vkbd_dev_intr() should be interrupted exactly > in between > > (*kbdsw[kbd->kb_index]->intr)(kbd, NULL); > > and > > VKBD_LOCK(state); > Yes, precisely. > yes, that could be done. it is also possible to have a callout going few > times a second to check if there is a scancodes in the queue and > schedule vkbd_dev_intr(). funny that atkbd(4) and ukbd(4) have just this. Thank you for your comments, Norbert