From owner-freebsd-hackers@FreeBSD.ORG Wed Sep 17 18:15:12 2008 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6CED106566B for ; Wed, 17 Sep 2008 18:15:12 +0000 (UTC) (envelope-from maksim.yevmenkin@gmail.com) Received: from gv-out-0910.google.com (gv-out-0910.google.com [216.239.58.189]) by mx1.freebsd.org (Postfix) with ESMTP id 72FCA8FC14 for ; Wed, 17 Sep 2008 18:15:06 +0000 (UTC) (envelope-from maksim.yevmenkin@gmail.com) Received: by gv-out-0910.google.com with SMTP id n8so1604977gve.39 for ; Wed, 17 Sep 2008 11:15:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=NWd6nmzi5Mbow9a1V/MFWB+i/V4XAgYOYn1NRA0GEtA=; b=ThyOIWOcApMqfS+0brzi0iZ8Om5m79CW3YargR3jZil6Pvungg8teRdLVEwiWHKEgb RMgpqn1un1EiGCbMAzUkN2xL5ztHyFGii0CilwKKAxvCdi7BYqq+RfDDDoz4JcLOrAgc XQzyZFepPzu9xq2NO7g0RsQqxlPOupjQyPhp4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=VJ4nU5mfuF3d9gQu+EOgTSC4BH1BytV6qxqQTqsKVQDWjh5afRXdS8oWrWMpE4Y3DO S9sC8Gx7mYnay5b39JjNAxGT7sWuGRaR7yYfPBEz9xijOOCYQM5438Z7NMo+1GCR7Pxs nozfCtna5fF9HC7jBV7LMx+VzTj9TdotiZcn0= Received: by 10.86.80.5 with SMTP id d5mr1291620fgb.11.1221673935982; Wed, 17 Sep 2008 10:52:15 -0700 (PDT) Received: by 10.86.62.1 with HTTP; Wed, 17 Sep 2008 10:52:15 -0700 (PDT) Message-ID: Date: Wed, 17 Sep 2008 10:52:15 -0700 From: "Maksim Yevmenkin" To: "Eygene Ryabinkin" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20080917161633.9E2F717101@shadow.codelabs.ru> Cc: rik@freebsd.org, hackers@freebsd.org Subject: Re: kern/127446: [patch] fix race in sys/dev/kbdmux/kbdmux.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: Wed, 17 Sep 2008 18:15:13 -0000 On 9/17/08, Eygene Ryabinkin wrote: > Maxim, good day. > > Cc'ing this discuission to hackers@ -- I was just going to write > the separate letter on this topic to the list. > > Wed, Sep 17, 2008 at 09:56:14AM -0700, Maksim Yevmenkin wrote: > > have you tried to simply set KBDMUX_LOCK/UNLOCK() to > > mtx_lock/unlock(&Giant) ? > > Since kbdmux callout is initialized as non-MPSAFE, this will result in > double locking the Giant (at least I see it from the code). I am not > sure that this is very good -- had not yet verified that Giant is > recursive. yes, giant is recursive. i think it should be fine for now (and yes, i agree, its not very clean) > Can try it tomorrow. thanks > Since you had written the code and #if 0'ed the locking part, may I ask, > why? Are there any known issues or it was just not very good to > introduce locking at that time (rev. 1.1, 3 years ago)? because i did not want to touch every single keyboard driver, keyboard subsystem and syscons :) back then. since kbdmux is pretty much keyboard driver it was easier to leave it under giant locking. thanks, max