From owner-freebsd-hackers@freebsd.org Wed Aug 28 13:01:06 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 2540CDC0CB for ; Wed, 28 Aug 2019 13:01:06 +0000 (UTC) (envelope-from yuripv@yuripv.net) Received: from new2-smtp.messagingengine.com (new2-smtp.messagingengine.com [66.111.4.224]) (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 46JQpn10dBz49jx for ; Wed, 28 Aug 2019 13:01:04 +0000 (UTC) (envelope-from yuripv@yuripv.net) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id A9DC838AF; Wed, 28 Aug 2019 09:01:03 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 28 Aug 2019 09:01:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yuripv.net; h= subject:from:to:references:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=I q5ivkdsVCeNNhAPzsfhY8qab9j1Coc39LUM4gmK9lU=; b=N2E/Emr6Yq0SnCrT/ RAhF1H5JDjqiz28NjMHzULnj3Pgu4BIXdPz11v4BsWqv4F8+pEhe7ck+9BmRTcvB J54Ra4c7PXf5ROnNzVFlcqrPpaMeWg13flFKfYLgVl8hLIZUwx+HppYkvs9q/Ive 0Jpq6Lmj7XEQNNnL3mN/BDsFc/LvFLTvZVijZGZKkYP2rcDnGfdc7KuJ2nYJEjyz i8ptnf2zrIWJ/qORyTOTGNjoDE5jvASmXwhVwoi7miOjRbsLJrIUjloy32LC7R2v 0gEj+AFoM+PEr5qTb9bGBOL9ny04eLm1OmcuhzfhuYBitIH4AWkCye0TiKWT0YiG 4mDvw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=Iq5ivkdsVCeNNhAPzsfhY8qab9j1Coc39LUM4gmK9 lU=; b=sofbeQhR4O8f3554oKuYZptM3XnstjuZYrZWPREiKrCcfoa5ympZdqben mOR7nM/xh5nPFvbwgKo/8TYb+2hrm83jvBWh5IJ+7WOi5NpDLZ45m+feY1geUSgA LLfwX+AOJ+I8AYYOVlkvj7XoZYwUHakvHMC+ZM0A4OZej8PclMBsbo7e4UzZXMHX 1C+R4P/3cR26dBindtagrD4KN+v0XM8zIT/5LBGiyXGvhX3iz9Sz0qW3KHRqFHF0 vTTi0fSAU2QEtj7re57INPSDbAzLn+ZSih1mejgU07XSBSTMusy8KJh5YpGZ0wW2 P7qaq0J9AlBRMZS/Zb3SKxGYdPwhQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudeitddgheekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuhffvfhfkffgfgggjtgfgsehtje ertddtfeejnecuhfhrohhmpegjuhhrihcurfgrnhhkohhvuceohihurhhiphhvseihuhhr ihhpvhdrnhgvtheqnecuffhomhgrihhnpehfrhgvvggsshgurdhorhhgnecukfhppedule ehrddvtdeirddukeefrdduieejnecurfgrrhgrmhepmhgrihhlfhhrohhmpeihuhhrihhp vheshihurhhiphhvrdhnvghtnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from [192.168.1.2] (unknown [195.206.183.167]) by mail.messagingengine.com (Postfix) with ESMTPA id 428F080059; Wed, 28 Aug 2019 09:01:01 -0400 (EDT) Subject: Re: ichsmb(4) and msleep() From: Yuri Pankov To: Hans Petter Selasky , 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> <7f6de96d-8b56-e242-8950-04a20b197bce@selasky.org> <311a21e3-ed61-8679-b416-b2a4c255c6e7@yuripv.net> Message-ID: <1f91f7a6-050d-d690-d374-6b06950d2ce2@yuripv.net> Date: Wed, 28 Aug 2019 16:00:59 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <311a21e3-ed61-8679-b416-b2a4c255c6e7@yuripv.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46JQpn10dBz49jx X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=yuripv.net header.s=fm1 header.b=N2E/Emr6; dkim=pass header.d=messagingengine.com header.s=fm3 header.b=sofbeQhR; dmarc=none; spf=pass (mx1.freebsd.org: domain of yuripv@yuripv.net designates 66.111.4.224 as permitted sender) smtp.mailfrom=yuripv@yuripv.net X-Spamd-Result: default: False [-6.40 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[yuripv.net:s=fm1,messagingengine.com:s=fm3]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:66.111.4.224]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[yuripv.net]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[yuripv.net:+,messagingengine.com:+]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_SHORT(-0.99)[-0.991,0]; IP_SCORE(-2.81)[ip: (-6.49), ipnet: 66.111.4.0/24(-4.84), asn: 11403(-2.68), country: US(-0.05)]; RCVD_IN_DNSWL_LOW(-0.10)[224.4.111.66.list.dnswl.org : 127.0.5.1]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:11403, ipnet:66.111.4.0/24, country:US]; MID_RHS_MATCH_FROM(0.00)[] 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 13:01:06 -0000 Yuri Pankov wrote: > Hans Petter Selasky wrote: >> 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. > > Thanks for the help. > > Something like the following (it seems to work)? Here's a review with the nit you mentioned fixed, thanks! https://reviews.freebsd.org/D21452