From owner-freebsd-hackers@freebsd.org Wed Aug 28 13:34:52 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 3387DDCE8E for ; Wed, 28 Aug 2019 13:34:52 +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 46JRYl2p1Cz4Cgx for ; Wed, 28 Aug 2019 13:34:51 +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 9A06C3986; Wed, 28 Aug 2019 09:34:50 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 28 Aug 2019 09:34:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yuripv.net; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=w DqRu2m/Er3AisAK3GcZJ8nkk7uDZ//nq8+hii7JNQY=; b=fyy6wkVouAzIPxCia CQFHWh7akw0WSXB/ZYD7LMJ/DYaYdYjUxXxCetPAZ6iWZ9Xg3EmnjmrNWH/IKjuq f1cTC2xNRafz5er1CACOr+lBmFmFL/LFjDzHvSPCgpi0DAX+rfMTh4N9vLVlqn/I 950fCzMqxWCOPkR8FMzPHGK6HugzBMSRNIxcShaZqldwlzw8PQjR7LVDC3oupWRo fSREfqifm1VPYEmdPfHYICY42ZsYMrDWoNa7V/Yv01VcOkQCkLdqi8023KZVvIXX dx3B61ThjkPUxYMdoOzfaQeZDkl9WHJb8xf6fbyqXFPRhl05cZiaorKTX67OZxYi /iChw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=wDqRu2m/Er3AisAK3GcZJ8nkk7uDZ//nq8+hii7JN QY=; b=KisdpYit53bDc/79y4sqbcPIJC4t29uLRVovYeoNCDXdY2ej/Qe2PHVoh Rg38aFzSF6B4zR3WDGp85ATQA5Dt1qoHVMhy3JidiL7TJOm7xIzgDxzIczJCqEnM tYeGcK8RmBKqyJjVroW1JfpBBvAs65/XRXiE9xGYmgNyxM1e8eES3PU+/AbnaJEA mBjPLxXnSxeoQYx2KISVobKTQK7C5VXH9ZMT7EqwQ0T7HauE+2tfMge87MIl2XHt pTfibwH8SZDcWScteG6WWddcBSwRLxrYGpKE/HzXRg2fpPtJCIobrlsaJPMfjrxu TVy6ixe2jzk0wPceoOMq4aZmU7VbQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudeitddgieeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthejredttdefjeenucfhrhhomhepjghurhhi ucfrrghnkhhovhcuoeihuhhrihhpvheshihurhhiphhvrdhnvghtqeenucffohhmrghinh epfhhrvggvsghsugdrohhrghenucfkphepudelhedrvddtiedrudekfedrudeijeenucfr rghrrghmpehmrghilhhfrhhomhephihurhhiphhvseihuhhrihhpvhdrnhgvthenucevlh hushhtvghrufhiiigvpedt X-ME-Proxy: Received: from [192.168.1.2] (unknown [195.206.183.167]) by mail.messagingengine.com (Postfix) with ESMTPA id 6C87E80066; Wed, 28 Aug 2019 09:34:48 -0400 (EDT) Subject: Re: ichsmb(4) and msleep() To: Warner Losh Cc: Hans Petter Selasky , FreeBSD Hackers 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> <1f91f7a6-050d-d690-d374-6b06950d2ce2@yuripv.net> From: Yuri Pankov Message-ID: <4201916c-0f7f-0bf6-2d17-e9f6a1879ba7@yuripv.net> Date: Wed, 28 Aug 2019 16:34:47 +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: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46JRYl2p1Cz4Cgx X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=yuripv.net header.s=fm1 header.b=fyy6wkVo; dkim=pass header.d=messagingengine.com header.s=fm3 header.b=KisdpYit; 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.51 / 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)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+ip4:66.111.4.224:c]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[yuripv.net]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[yuripv.net:+,messagingengine.com:+]; NEURAL_HAM_SHORT(-0.99)[-0.990,0]; IP_SCORE(-2.92)[ip: (-7.02), ipnet: 66.111.4.0/24(-4.84), asn: 11403(-2.68), country: US(-0.05)]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:11403, ipnet:66.111.4.0/24, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[224.4.111.66.list.dnswl.org : 127.0.5.1] 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:34:52 -0000 Warner Losh wrote: > On Wed, Aug 28, 2019, 7:01 AM Yuri Pankov wrote: > >> 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 > > > > What's the advantages of doing this instead of deferring attach until the > interrupts are running? None that I can think of, just going with what was suggested and seeing other drivers doing the same. Could you please name a driver that defers attach until !cold?