From owner-freebsd-hackers@freebsd.org Wed Aug 28 13:07:58 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 55E30DC3E8 for ; Wed, 28 Aug 2019 13:07:58 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JQyj4Vyvz4BDq for ; Wed, 28 Aug 2019 13:07:57 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72e.google.com with SMTP id 4so2287349qki.6 for ; Wed, 28 Aug 2019 06:07:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DISCS1/CzBBSPv7EJVN4JB75IO1pSK26dN0u1jCtXPY=; b=L9iX3v5tTXgeHJaplrRorx2lNY4aejczOy1suf6AI2FcZAc2MJ9ljXYOaDjMZMvrIK 0tQxcByfwQUulpaups8dJqQErw7fz4KhgUcvkrsgGZikrnniwHXtlFI/ZOWg+xSh/tSc yuHah+hzaKLeZxkwhb1zgHkF/4NuQ3XutO1ZZW8qV8sF4bdYU788mOXnMbgmK0YSwd+6 Jbee1xlXwcMbxl2C2iC+JtZE8voN7mn5QQ5XMP3xYZKnyAFJ/s25Jj1Yh82v3+/cKxht HMiBVU41hOcvSApWJacgyNKxRoFCJSLSGFqtVn2K2xuvcuu+JRZwBX/+9tyQsAUB2G09 4rrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DISCS1/CzBBSPv7EJVN4JB75IO1pSK26dN0u1jCtXPY=; b=dZUxlx8oipdoBdLqB0Ai2KkzI/E0ODlzHg+k3tSIA5EraGX7b/4osufXRDtZljipOR 2DHKvOlSjNQQ1b6djrh0n2S4Uw5B4ZVNt1g7JR7UI1zdJKVl+kjd1XIoXkfiptsDSm2V LJ1FzpAPA8TxOq2fBjCjp+I60xBw7uAOKXhexcV/mdo+kq/wgXKJBC4SfX+ogaynEPLE SGlePyTr4q/bkTcjbk5UdiIIVdE2NXCFbKWSOkCCjNY6di9XEdkJSa+KWtdBbdoxMtAp EWhEe2J1KWlF6224YOi04fBQjKRpRzRiDYFIEKu/l3gYwiiP8j6ckl0z4tHMJsDwLmsm pE4w== X-Gm-Message-State: APjAAAV00cPcE7qWYRqCnO/6aEzsa5IhZKOF1UUXkQcmJaiPx22A+5uP 0EBbaUK0cjTD7gQEQJ5fnmayjRSzSgoYsRLKaSP2kg== X-Google-Smtp-Source: APXvYqxRrcNHzwba9nGidZrqC0YWO8Mm7VRCkUFgx48MbsE5eiZM8cNpb9O9fymNyjFDMlERb/0dbfg8UHPVn16tfG8= X-Received: by 2002:a37:8902:: with SMTP id l2mr3654389qkd.380.1566997676307; Wed, 28 Aug 2019 06:07:56 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: <1f91f7a6-050d-d690-d374-6b06950d2ce2@yuripv.net> From: Warner Losh Date: Wed, 28 Aug 2019 07:07:44 -0600 Message-ID: Subject: Re: ichsmb(4) and msleep() To: Yuri Pankov Cc: Hans Petter Selasky , FreeBSD Hackers X-Rspamd-Queue-Id: 46JQyj4Vyvz4BDq X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=L9iX3v5t; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::72e) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-5.91 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-1.00)[-0.996,0]; RCVD_IN_DNSWL_NONE(0.00)[e.2.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.92)[ip: (-9.35), ipnet: 2607:f8b0::/32(-2.85), asn: 15169(-2.32), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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:07:58 -0000 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? Warner > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >