From owner-freebsd-arch@freebsd.org Mon May 8 18:58:56 2017 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03BAED6368E; Mon, 8 May 2017 18:58:56 +0000 (UTC) (envelope-from vladimir@kondratyev.su) Received: from corp.infotel.ru (corp.infotel.ru [195.170.219.3]) by mx1.freebsd.org (Postfix) with ESMTP id 8F3E51315; Mon, 8 May 2017 18:58:55 +0000 (UTC) (envelope-from vladimir@kondratyev.su) Received: from corp (corp.infotel.ru [195.170.219.3]) by corp.infotel.ru (Postfix) with ESMTP id 7CDAF1B98D; Mon, 8 May 2017 21:58:52 +0300 (MSK) X-Virus-Scanned: amavisd-new at corp.infotel.ru Received: from corp.infotel.ru ([195.170.219.3]) by corp (corp.infotel.ru [195.170.219.3]) (amavisd-new, port 10024) with ESMTP id q9bdRV5_3aNd; Mon, 8 May 2017 21:58:35 +0300 (MSK) Received: from mail.cicgroup.ru (unknown [195.170.219.74]) by corp.infotel.ru (Postfix) with ESMTP id 4ADA01B987; Mon, 8 May 2017 21:58:35 +0300 (MSK) Received: from mail.cicgroup.ru (localhost [127.0.0.1]) by mail.cicgroup.ru (Postfix) with ESMTP id 50D2B574ABD; Mon, 8 May 2017 21:58:34 +0300 (MSK) X-Virus-Scanned: amavisd-new at cicgroup.ru Received: from mail.cicgroup.ru ([127.0.0.1]) by mail.cicgroup.ru (mail.cicgroup.ru [127.0.0.1]) (amavisd-new, port 10024) with SMTP id VlOhyAJvWf2z; Mon, 8 May 2017 21:58:27 +0300 (MSK) Received: from localhost (localhost [127.0.0.1]) by mail.cicgroup.ru (Postfix) with ESMTPA id 15C0A574A91; Mon, 8 May 2017 21:58:27 +0300 (MSK) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 08 May 2017 21:58:27 +0300 From: Vladimir Kondratyev To: Warner Losh Cc: freebsd-arch@freebsd.org, owner-freebsd-arch@freebsd.org Subject: Re: psm(4) & atkbdc(4) locking In-Reply-To: References: Message-ID: <80600e8d3da7725a66e2a1e24cbfd916@kondratyev.su> X-Sender: vladimir@kondratyev.su User-Agent: Roundcube Webmail/1.2.2 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 May 2017 18:58:56 -0000 On 2017-05-08 21:39, Warner Losh wrote: > On Mon, May 8, 2017 at 12:33 PM, Vladimir Kondratyev > wrote: >> Hi All >> >> In order to implement evdev support in psm(4) driver I`m going to add >> mutexes to psm and atkbdc drivers and mark psm interrupt and cdev >> handlers >> MPSAFE. >> Atkbd(4) is depending on Giant like before. >> >> Locking of these drivers seems to be low-hanging fruit as spl() calls >> are >> still in place but it has not occurred. >> >> Does someone know why it is not done yet? For reasons other than >> "Nobody >> took care of it"? >> Any hidden traps? > > Working rock-solid reliably in ddb(4) is what tripped me up when I > started down this path 10 years ago. I tried to avoid atkbd changes as much as possible. Patch adds atkbdc mutex acquisition before each hardware access and nothing more. I think mutexes should be ignored in ddb mode. > Understanding all the rules for > that was a bridge too far for me given the time I had for the project > then. If you have that covered (I haven't looked at the diffs yet), > you're golden. I`m not familiar with ddb internals, that is why i wrote first mail. > > Warner >> Patches can be found here: >> https://reviews.freebsd.org/D10263 (atkbdc, serialize hw registers >> access) >> https://reviews.freebsd.org/D10264 (psm, serialize softc access, mark >> interrupt and cdev handlers MPSAFE) >> -- WBR Vladimir Kondratyev