From owner-freebsd-current@FreeBSD.ORG Sat Jul 25 23:59:35 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8AA06106564A; Sat, 25 Jul 2009 23:59:35 +0000 (UTC) (envelope-from maksim.yevmenkin@gmail.com) Received: from qw-out-2122.google.com (qw-out-2122.google.com [74.125.92.27]) by mx1.freebsd.org (Postfix) with ESMTP id 074298FC0A; Sat, 25 Jul 2009 23:59:34 +0000 (UTC) (envelope-from maksim.yevmenkin@gmail.com) Received: by qw-out-2122.google.com with SMTP id 3so1175116qwe.7 for ; Sat, 25 Jul 2009 16:59:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=xTEvr4xQcDdcYtKwkXVBctnR6Sds9By6ScUc95T9tQc=; b=fc3LBTYX07RuAc3qMBOOcoUdA+ZCaMhV+dRLpIZuiZiYuEPOqzTFbYwBg2d+wXe+m6 UlsP9P9GuuUz1Q/vjvSbPBlweRlrM1Z+RPRmV4S+ZuH+Tl/bXqYwxOwMiAqPiddX4iCu HW890R4rsvG6OMAjRhCGR4QvlhWA0nhaOa14Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=HN7ekF8zigibRFs9ynJGe5knLBE8wBzKkjb3bEh5KdLfdAWMhxt98TAqtOF/gm3deM iSZbAlA1Xyts0sLXiJ+FlfH4Gtf3lt5iVWlyEKC/LSjExqWOjFnfDJxAfddQn8lZzMrt LuyhiWsUvSUxOdy0uInDALlx10JkT3bh+WSvQ= MIME-Version: 1.0 Received: by 10.220.46.5 with SMTP id h5mr3042215vcf.28.1248566373903; Sat, 25 Jul 2009 16:59:33 -0700 (PDT) In-Reply-To: <4A69AB91.2010208@icyb.net.ua> References: <1280352d0907101020q69f494cdndb01ff14ecf7ea8c@mail.gmail.com> <200907152236.58049.hselasky@c2i.net> <20090720215141.GL49724@elvis.mu.org> <200907211420.33571.hselasky@c2i.net> <4A69AB91.2010208@icyb.net.ua> Date: Sat, 25 Jul 2009 16:59:33 -0700 Message-ID: From: Maksim Yevmenkin To: Andriy Gapon Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: usb@freebsd.org, freebsd-current@freebsd.org, Andrew Thompson , Hans Petter Selasky Subject: Re: USB polling (75% done) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 25 Jul 2009 23:59:36 -0000 On Fri, Jul 24, 2009 at 5:39 AM, Andriy Gapon wrote: > on 23/07/2009 21:23 Maksim Yevmenkin said the following: >> On Tue, Jul 21, 2009 at 5:20 AM, Hans Petter Selasky wrote: >>> On Monday 20 July 2009 23:51:41 Alfred Perlstein wrote: >>>> * Hans Petter Selasky [090715 13:37] wrote: > ... >>>>> Using USB keyboard in KDB: Does not work because Giant is not locked when >>>>> calling into the UKBD's get char routine. UKBD is Giant locked. Someone >>>>> familiar with the keyboard system on FreeBSD please step forward and fix >>>>> this so that UKBD gets independent of the Giant mutex. >>>> the ukbd driver needs giant? >>> I think the keyboard mux is under Giant, and does not have any concept about >>> mutexes. Most simple solution would be that DDB locks Giant before entering >>> into the keyboard code. >> >> as i understand it, keyboard drivers (and kbdmux(4) is a keyboard >> driver), can/should not use any locks. period. so whatever calls into >> keyboard driver should take care of locking. > > Maybe I am missing something but I do not see any explicit locking or lock > assertions in kbdmux code. All lock defines are under #if 0. that is what i said, no? :) keyboard drivers can/should not use any locks. > kbdmux does use taskqueue_swi_giant though. Tasks are queued on it in > kbdmux_kbd_intr_timo (periodic callout) and in kbdmux_kbd_event (kbd callback). so? it only means that callout will be called with giant held. which is exactly what i said, whatever calls into keyboard driver should take care of locking. > But, these shouldn't get called in polling mode, right? (because there shouldn't > be any interrupts) well, there is polling mode and then there is polling mode :) when ddb is active, yes, there should not be any interrupts, however, there are cases when keyboard is running in polled mode with interrupts enabled. for example, mountroot prompt, geli passphrase prompt, etc. > Maybe Giant asserts in ukbd are not needed? > Or should be asserted only in "normal" mode? again, as far as i understand it, keyboard driver should/can not use any locks. imo, it means that keyboard driver generally should/can not assert on any lock as well. if system drops into ddb because it has panic'ed, any lock can be in any state (potentially) . thanks, max