From owner-freebsd-hackers@freebsd.org Wed Aug 28 11:41:12 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 70DCAD9C2E for ; Wed, 28 Aug 2019 11:41:12 +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 46JP2b2BF7z45kl for ; Wed, 28 Aug 2019 11:41:11 +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 69298A91; Wed, 28 Aug 2019 07:41:10 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 28 Aug 2019 07:41:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yuripv.net; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type; s=fm1; bh=Nc88nQg0YlS2Cz7A5UE/ZBeZu3p nq0CUkZWENzOzUpc=; b=At1JIRRTtiHor9KCdeknHXFIyvryuWGsnjonflz18dE W8BHso+GdFObHeVzOa27JbAxDUg9SiTxUAUKFhHjQctFlYG5PP2OCpIkvXgepx8/ eXMZzICKj0A7wicw2lzQ4YkzjjgWk7ux3JRoYeOBfVfHSzCGWsyYpoAfrwJCJOJN 2Mk/Vgyqikv/QqURC5tRNVzZ1ZyEu1snew6VIQsNKLUZrkZHsou4+V/Xk7Qek/rJ iyoa04veIY2E0uP1UyX9mBNTreddTJsgVs5Y06clC82Hy9bwvTXTn3t21A41ndhg OXegWtfE09bm64g3n1a4MyfqsUtXdUrtuooDZPMmhOQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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=Nc88nQ g0YlS2Cz7A5UE/ZBeZu3pnq0CUkZWENzOzUpc=; b=OYkk18KUpcGje4GYauWy02 LChu+hCvzOl818PAlXvRW3H1XX0vRAID2PI7v20leJRsxx6VYN9B1jadnqu43sCs iBkv465g9s3pnoEjeMNv5HgnlRDBEoGXQali4FfOLRnt9ErKTqiEzJ36xGp6AQQE BwNFCkjgnPAD/+ATkHJ/1G1ov5uwBbxGuDBOGmePYHjutV47go75KUV6fHahAu96 OZE+z3u37Tfv39bZM6ss1ht4L8DFshzyLAYIijHS1BNLBYYgrgLwv1e8RTIztbcs Z8ywtgUnxM3FF+2UqoAzUwvT4JPn/F++c2ko/IBFQj8a0PF1zNh4eiqUzLkN1ocA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudeitddggedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvfhfhffkffgfgggjtgesmhdtre ertdefjeenucfhrhhomhepjghurhhiucfrrghnkhhovhcuoeihuhhrihhpvheshihurhhi phhvrdhnvghtqeenucfkphepudelhedrvddtiedrudekfedrudeijeenucfrrghrrghmpe hmrghilhhfrhhomhephihurhhiphhvseihuhhrihhpvhdrnhgvthenucevlhhushhtvghr ufhiiigvpedt X-ME-Proxy: Received: from [192.168.1.2] (unknown [195.206.183.167]) by mail.messagingengine.com (Postfix) with ESMTPA id 2573F8005A; Wed, 28 Aug 2019 07:41:09 -0400 (EDT) Subject: Re: ichsmb(4) and msleep() 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> From: Yuri Pankov Message-ID: <311a21e3-ed61-8679-b416-b2a4c255c6e7@yuripv.net> Date: Wed, 28 Aug 2019 14:41:07 +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: <7f6de96d-8b56-e242-8950-04a20b197bce@selasky.org> Content-Type: multipart/mixed; boundary="------------DC60AD2380EEEBE0278B6A9E" Content-Language: en-US X-Rspamd-Queue-Id: 46JP2b2BF7z45kl X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=yuripv.net header.s=fm1 header.b=At1JIRRT; dkim=pass header.d=messagingengine.com header.s=fm3 header.b=OYkk18KU; 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 [-5.17 / 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]; HAS_ATTACHMENT(0.00)[]; MIME_GOOD(-0.10)[multipart/mixed,text/plain]; 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:+]; CTYPE_MIXED_BOGUS(1.00)[]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_SHORT(-0.99)[-0.993,0]; MIME_BASE64_TEXT(0.10)[]; RCVD_TLS_LAST(0.00)[]; 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:+,1:+,2:+]; ASN(0.00)[asn:11403, ipnet:66.111.4.0/24, country:US]; MID_RHS_MATCH_FROM(0.00)[]; IP_SCORE(-2.68)[ip: (-5.81), ipnet: 66.111.4.0/24(-4.84), asn: 11403(-2.68), country: US(-0.05)] 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 11:41:12 -0000 This is a multi-part message in MIME format. --------------DC60AD2380EEEBE0278B6A9E Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit 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)? --------------DC60AD2380EEEBE0278B6A9E Content-Type: text/plain; charset=UTF-8; name="ichsmb.diff.txt" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="ichsmb.diff.txt" ZGlmZiAtLWdpdCBhL3N5cy9kZXYvaWNoc21iL2ljaHNtYi5jIGIvc3lzL2Rldi9pY2hzbWIv aWNoc21iLm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