From owner-freebsd-hackers@freebsd.org Wed Aug 28 09:47:53 2019 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D50D1D76E3 for ; Wed, 28 Aug 2019 09:47:53 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46JLWr5my3z40rn for ; Wed, 28 Aug 2019 09:47:52 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.235]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 4D064260240; Wed, 28 Aug 2019 11:47:50 +0200 (CEST) Subject: Re: ichsmb(4) and msleep() To: Yuri Pankov , freebsd-hackers@freebsd.org References: <7dfebbd3-85d6-c7b7-b83b-fae8b644649e@yuripv.net> <478965aa-5256-e356-5339-de6fb82c3459@selasky.org> <63daa36a-5c22-6b08-3cd7-562fa961ab61@yuripv.net> From: Hans Petter Selasky Message-ID: <7f6de96d-8b56-e242-8950-04a20b197bce@selasky.org> Date: Wed, 28 Aug 2019 11:47:07 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <63daa36a-5c22-6b08-3cd7-562fa961ab61@yuripv.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46JLWr5my3z40rn X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 2a01:4f8:c17:6c4b::2 as permitted sender) smtp.mailfrom=hps@selasky.org X-Spamd-Result: default: False [-5.86 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net:c]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[selasky.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.98)[-0.983,0]; RCPT_COUNT_TWO(0.00)[2]; IP_SCORE(-2.58)[ip: (-9.11), ipnet: 2a01:4f8::/29(-1.97), asn: 24940(-1.80), country: DE(-0.01)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:2a01:4f8::/29, country:DE]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Aug 2019 09:47:53 -0000 On 2019-08-28 11:44, Yuri Pankov wrote: > Hans Petter Selasky wrote: >> On 2019-08-28 11:07, Yuri Pankov wrote: >>> I have a "timed sleep before timers are working" panic in ichsmb_readb() >>> calling ichsmb_wait() which uses msleep(). That is trying to >>> jedec_dimm(4) module so it's trying to attach pretty early in boot. >>> What would be the correct replacement for msleep() here? >>> >> >> If you only need a sleep-delay, pause() is the right one. It handles >> cold-boot. > > I guess that won't work here as we need to be waked up by interrupt > handler on command completion, and pause() seems to sleep > unconditionally for the given time in 'cold' case (if I'm reading the > code correctly). If you are too early inside a SYSINIT() path, then you cannot use sleeping. You will have to use polling in a loop with a fixed DELAY() to know the timeout. --HPS