From owner-freebsd-current@freebsd.org Sat Jan 30 19:21:07 2016 Return-Path: Delivered-To: freebsd-current@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 1AB41A72281 for ; Sat, 30 Jan 2016 19:21:07 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (heidi.turbocat.net [88.198.202.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D412E1C08 for ; Sat, 30 Jan 2016 19:21:06 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 4C3491FE023; Sat, 30 Jan 2016 20:20:58 +0100 (CET) Subject: Re: thread-unsafety problems as spl*() ones are NOP To: Slawa Olhovchenkov , mokhi References: <20160130180256.GT37895@zxy.spb.ru> <20160130182521.GM88527@zxy.spb.ru> <20160130183131.GN88527@zxy.spb.ru> Cc: freebsd-current@freebsd.org From: Hans Petter Selasky Message-ID: <56AD0DA6.3090502@selasky.org> Date: Sat, 30 Jan 2016 20:23:18 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <20160130183131.GN88527@zxy.spb.ru> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 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, 30 Jan 2016 19:21:07 -0000 On 01/30/16 19:31, Slawa Olhovchenkov wrote: > On Sat, Jan 30, 2016 at 09:25:21PM +0300, Slawa Olhovchenkov wrote: > >> On Sat, Jan 30, 2016 at 09:42:13PM +0330, mokhi wrote: >> >>> i currently only wanna do patch on kbd.c (because i'm sure there is a >>> thread-unsafety) >>> and i don't want to add anything to spltty() nor splx(), i just wanna >>> add things under where they've been used. >>> isn't problem with using mutex/spin/lock/unlock etc there? >> >> yes. >> currenly spltty act as mutex_lock(&spltty_mutex), like global lock for >> all used files. this is also inter-files lock, not only lock inside >> only kbd.c. >> you need patch all files. all using spltty need to remove >> simultaneously. >> > > oh, sorry. > i am see now all splXXX is nop. > may be incorretly -- for example, in digi.c i am don't see any lockind > instead spltty(). Hi, Code that uses splxxx() needs to have the Giant lock locked when running. Refer to the various MPSAFE flags. --HPS