From owner-svn-src-all@FreeBSD.ORG Sun Nov 2 19:56:14 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A976CE59; Sun, 2 Nov 2014 19:56:14 +0000 (UTC) Received: from gromit.grondar.org (grandfather.grondar.org [IPv6:2a01:348:0:15:5d59:5c20:0:2]) (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 6D54FC8E; Sun, 2 Nov 2014 19:56:14 +0000 (UTC) Received: from [2001:470:9174:1:1da0:4ef1:3fbf:d630] by gromit.grondar.org with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.84 (FreeBSD)) (envelope-from ) id 1Xl1G0-000H4V-L8; Sun, 02 Nov 2014 19:56:13 +0000 Subject: Re: svn commit: r273958 - head/sys/dev/random Mime-Version: 1.0 (Mac OS X Mail 8.0 \(1990.1\)) Content-Type: text/plain; charset=utf-8 From: Mark R V Murray In-Reply-To: <20141102194625.GC53947@kib.kiev.ua> Date: Sun, 2 Nov 2014 19:56:11 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <751CD860-95B9-4F68-AE69-976B42823AD0@grondar.org> References: <201411020201.sA221unt091493@svn.freebsd.org> <720EB74E-094A-43F3-8B1C-47BC7F6FECC3@grondar.org> <1414934579.17308.248.camel@revolution.hippie.lan> <6FB65828-6A79-4BDE-A9F7-BC472BA538CE@grondar.org> <20141102192057.GB53947@kib.kiev.ua> <29A795E1-19E2-49E4-9653-143D3F6F3F12@grondar.org> <20141102194625.GC53947@kib.kiev.ua> To: Konstantin Belousov X-Mailer: Apple Mail (2.1990.1) X-SA-Score: -1.0 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Nov 2014 19:56:14 -0000 > On 2 Nov 2014, at 19:46, Konstantin Belousov = wrote: >=20 >> I don???t quite follow what you mean, but it sounds like you = understand >> the problem. Could you please explain with a bit more detail? >=20 > Which problem ? There are two. >=20 > One is the Adrian' complain. tsleep(9) catches signals, and return > EINTR/ERESTART when catched. Typical driver code checks for the > errors from {t,m}sleep(9) and aborts the operation if error is > returned. I.e. you should do > error =3D tsleep(...); > if (error !=3D 0) { > abort the loop; > return to caller; > } > The fine detail is that for the case when read has already partially > progressed, i.e. something was copied out to uio, the error must > not be returned, but short read performed instead. OK, I think I follow this. In another mail you say: > Yes, this is because error from tsleep() in random_adaptor_read() > does not abort the loop. But next loop iteration calls tsleep() > which returns immediately since there is still pending signal. > The process continues indefinitely. .. which supports this what you say further above. Thanks. > This leads to another question about the code in = random_adapter_read(): > if ra_read method sleeps, it must handle the signals as well, return > error, and the second loop which perorms ra_read/uiomove should be > aborted as well. Again, error from either ra_read or uiomove(9) > must result in short read if something was already copied to uio. > Currently, there is no error returned by ra_read (or it is ignored), > and error from uiomove always returned, even if something was already > copied. Are you saying the same thing again, or something else? If you are = saying something else, then I am struggling to follow you. > Second problem is that random_adaptor_lock is owned while tsleep() > is called (or whatever sleep primitive is used inside ra_read). If > platform could only provide randomness through some hw, and module > is loaded while thread is blocked, module cannot register, while > reading thread cannot make progress. I=E2=80=99m sorry, I don=E2=80=99t understand this. M --=20 Mark R V Murray